:root,
html[data-theme="dark"] {
  --bg: #050810;
  --bg-elevated: #0a1018;
  --panel: rgba(12, 20, 32, 0.82);
  --panel-hover: rgba(18, 28, 44, 0.9);
  --panel-solid: #141a2a;
  --panel-solid-border: #2a3150;
  --nav-bg: rgba(0, 0, 0, 0.35);
  --overlay: rgba(0, 0, 0, 0.45);
  --chart-surface: #0a1018;
  --chart-bar-bg: rgba(8, 14, 24, 0.96);
  --inset-surface: rgba(0, 0, 0, 0.32);
  --inset-surface-strong: rgba(0, 0, 0, 0.42);
  --section-surface: rgba(0, 0, 0, 0.22);
  --pos-card-bg: rgba(10, 16, 28, 0.95);
  --fs-scrim: rgba(2, 6, 12, 0.92);
  --btn-surface: rgba(0, 0, 0, 0.4);
  --text: #e8f4ff;
  --muted: #6b8aa8;
  --border: rgba(0, 212, 255, 0.22);
  --border-soft: rgba(0, 212, 255, 0.1);
  --green: #00ff9d;
  --red: #ff4d6d;
  --accent: #00d4ff;
  --accent-2: #7b61ff;
  --accent-dim: rgba(0, 212, 255, 0.12);
  --glow: 0 0 24px rgba(0, 212, 255, 0.15);
  --radius: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --plan-title: #f0f2ff;
  --plan-meta: #8892b0;
  --plan-meta-accent: #6ab8ff;
  --plan-lbl: #8b95b8;
  --plan-val: #f0f2ff;
  --plan-val-neutral: #cfd3ef;
  --plan-border-dash: #2a3558;
  --plan-col-divider: #243050;
  --plan-dca-th: #6a7598;
  --plan-close-bg: #5c1e2a;
  --plan-close-fg: #ffb4b4;
  --plan-be-label: #cfd3ef;
  --plan-be-input-bg: #0f1424;
  --plan-be-input-border: #304164;
  --plan-be-btn-bg: #1f4a3a;
  --primary-btn-bg: linear-gradient(135deg, rgba(0, 212, 255, 0.38), rgba(123, 97, 255, 0.28));
  --primary-btn-fg: #ffffff;
  --primary-btn-border: var(--accent);
  --status-done: #4cd97f;
  --status-pending: #9aa3c4;
  --ai-sum-heading: #9adbff;
  --ai-sum-heading-bg: rgba(0, 212, 255, 0.07);
  --ai-sum-heading-border: rgba(0, 212, 255, 0.38);
  --ai-sum-name: #d4ecff;
  --font: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --display: "Orbitron", var(--font);
  --mono: var(--font);
  --layout-max: 1520px;
  --archive-chart-bg: rgba(0, 0, 0, 0.12);
  --archive-axis-fg: rgba(255, 255, 255, 0.42);
  --archive-grid-stroke: rgba(255, 255, 255, 0.06);
  --archive-grid-zero-stroke: rgba(255, 255, 255, 0.16);
  --archive-viz-surface: rgba(0, 0, 0, 0.12);
  --archive-viz-surface-border: rgba(255, 255, 255, 0.05);
  --archive-viz-kpi-bg: rgba(255, 255, 255, 0.04);
  --archive-viz-kpi-border: rgba(255, 255, 255, 0.06);
  --archive-viz-track-bg: rgba(255, 255, 255, 0.08);
  --archive-viz-mid-line: rgba(255, 255, 255, 0.2);
  --archive-profit: #4cd97f;
  --archive-loss: #ff6b6b;
  --nav-link-idle: var(--muted);
  --nav-link-hover-bg: var(--panel-hover);
  --nav-link-active-fg: var(--accent);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #d4dde8;
  --bg-elevated: #f6f9fc;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-hover: rgba(248, 252, 255, 0.98);
  --panel-solid: #ffffff;
  --panel-solid-border: #b8c8d8;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --overlay: rgba(15, 35, 60, 0.28);
  --chart-surface: #f0f4f9;
  --chart-bar-bg: #e8eef5;
  --inset-surface: rgba(255, 255, 255, 0.9);
  --inset-surface-strong: #eef3f8;
  --section-surface: rgba(255, 255, 255, 0.82);
  --pos-card-bg: rgba(255, 255, 255, 0.96);
  --fs-scrim: rgba(212, 221, 232, 0.94);
  --btn-surface: rgba(255, 255, 255, 0.85);
  --text: #142232;
  --muted: #4a6078;
  --border: rgba(0, 95, 140, 0.26);
  --border-soft: rgba(0, 75, 115, 0.14);
  --green: #0a8f5c;
  --red: #c93552;
  --accent: #006e9a;
  --accent-2: #5b4fc7;
  --accent-dim: rgba(0, 110, 154, 0.12);
  --glow: 0 0 16px rgba(0, 110, 154, 0.1);
  --shadow: 0 6px 24px rgba(30, 60, 100, 0.1);
  --plan-title: var(--text);
  --plan-meta: var(--muted);
  --plan-meta-accent: var(--accent);
  --plan-lbl: var(--muted);
  --plan-val: var(--text);
  --plan-val-neutral: #5a6f85;
  --plan-border-dash: rgba(0, 75, 115, 0.2);
  --plan-col-divider: rgba(0, 75, 115, 0.16);
  --plan-dca-th: var(--muted);
  --plan-close-bg: rgba(201, 53, 82, 0.12);
  --plan-close-fg: var(--red);
  --plan-be-label: var(--muted);
  --plan-be-input-bg: var(--bg-elevated);
  --plan-be-input-border: var(--border-soft);
  --plan-be-btn-bg: rgba(10, 143, 92, 0.14);
  --primary-btn-bg: #006e9a;
  --primary-btn-fg: #ffffff;
  --primary-btn-border: #005a82;
  --status-done: #087a50;
  --status-pending: #3d556d;
  --ai-sum-heading: #9e1e38;
  --ai-sum-heading-bg: rgba(201, 53, 82, 0.08);
  --ai-sum-heading-border: rgba(201, 53, 82, 0.42);
  --ai-sum-name: #7a182c;
  --archive-chart-bg: var(--chart-surface);
  --archive-axis-fg: var(--muted);
  --archive-grid-stroke: rgba(20, 34, 50, 0.1);
  --archive-grid-zero-stroke: rgba(20, 34, 50, 0.28);
  --archive-viz-surface: var(--inset-surface-strong);
  --archive-viz-surface-border: var(--border-soft);
  --archive-viz-kpi-bg: var(--bg-elevated);
  --archive-viz-kpi-border: var(--border-soft);
  --archive-viz-track-bg: var(--chart-bar-bg);
  --archive-viz-mid-line: rgba(20, 34, 50, 0.22);
  --archive-profit: var(--green);
  --archive-loss: var(--red);
  --nav-link-idle: #3a5068;
  --nav-link-hover-bg: rgba(0, 110, 154, 0.08);
  --nav-link-active-fg: #004d6e;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-shadow: 0 0 12px rgba(0, 212, 255, 0.4);
}

.app-bg,
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 255, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(123, 97, 255, 0.08), transparent);
  background-size: 48px 48px, 48px 48px, auto, auto;
}

.app-bg::after,
.login-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  opacity: 0.4;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--layout-max);
  margin-left: auto;
  margin-right: auto;
  padding: 0 24px 48px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent), 0 0 24px rgba(0, 212, 255, 0.5);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.92);
  }
}

.brand-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text);
}

.brand-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.14em;
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sys-pill {
  font-size: 10px;
  letter-spacing: 0.12em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--accent);
  background: var(--accent-dim);
  font-family: var(--display);
}

.sys-pill.warn {
  color: var(--red);
  border-color: rgba(255, 77, 109, 0.4);
  background: rgba(255, 77, 109, 0.1);
}

.sys-pill.syncing {
  opacity: 0.85;
  animation: sys-pill-pulse 1.2s ease-in-out infinite;
}

@keyframes sys-pill-pulse {
  50% {
    opacity: 0.55;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.theme-toggle-btn:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.theme-toggle-btn.is-active {
  color: var(--accent);
  background: var(--accent-dim);
  box-shadow: inset 0 0 0 1px var(--border);
}

.theme-toggle-btn .theme-icon {
  display: block;
}

.top-nav {
  display: flex;
  gap: 4px;
  background: var(--nav-bg);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(8px);
}

.top-nav a {
  padding: 8px 16px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--nav-link-idle);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  border: 1px solid transparent;
}

.top-nav a.nav-hidden {
  display: none !important;
}

.top-nav a:hover {
  color: var(--text);
  background: var(--nav-link-hover-bg);
  text-decoration: none;
}

.top-nav a.active {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(123, 97, 255, 0.15));
  color: var(--nav-link-active-fg);
  border-color: var(--border);
  box-shadow: var(--glow);
  font-weight: 600;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 11px;
  padding: 7px 12px;
}

button.ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border);
}

.page.hidden {
  display: none;
}

.page-head {
  margin: 24px 0 16px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.head-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  color: var(--accent);
}

.page-desc {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.hint-box {
  margin-bottom: 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.hint-box summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
  list-style: none;
}
.hint-box summary::-webkit-details-marker {
  display: none;
}
.hint-box summary::before {
  content: "▸ ";
  color: var(--accent);
}
.hint-box[open] summary::before {
  content: "▾ ";
}

.hint-box .hint-body {
  padding: 0 14px 12px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.65;
  border-top: 1px solid var(--border-soft);
}
.hint-box .hint-body code {
  font-family: var(--mono);
  font-size: 10px;
  background: rgba(0, 212, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent);
  border: 1px solid var(--border-soft);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
  box-shadow: var(--glow);
}

.toolbar-spacer {
  flex: 1;
  min-width: 8px;
}

.toolbar-meta {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}

button,
.btn {
  background: var(--btn-surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font);
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--panel-hover);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.12);
}

button.primary {
  background: var(--primary-btn-bg);
  border-color: var(--primary-btn-border);
  color: var(--primary-btn-fg);
  font-weight: 600;
  text-shadow: none;
}

button.danger {
  border-color: rgba(255, 77, 109, 0.5);
  color: var(--red);
  background: rgba(255, 77, 109, 0.08);
}

button.danger:hover:not(:disabled) {
  background: rgba(255, 77, 109, 0.15);
  border-color: var(--red);
  box-shadow: 0 0 16px rgba(255, 77, 109, 0.2);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-link {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--accent);
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 6px;
}
.btn-link:hover {
  background: var(--accent-dim);
  text-decoration: none;
  box-shadow: var(--glow);
}

.btn-close-pos.btn-sm {
  white-space: nowrap;
}

.data-table .td-actions {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

.chk-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

.card.card-online {
  border-color: rgba(0, 255, 157, 0.35);
}
.card.card-online::before {
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: 0.8;
}

.card.card-offline {
  border-color: rgba(255, 77, 109, 0.3);
}
.card.card-offline::before {
  background: linear-gradient(90deg, transparent, var(--red), transparent);
}

.card:hover {
  border-color: rgba(0, 212, 255, 0.45);
  box-shadow: var(--glow);
}

.card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.ok {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}
.status-dot.bad {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.status-dot.warn {
  background: #ffb020;
  box-shadow: 0 0 8px rgba(255, 176, 32, 0.45);
}

/* —— 手机监控总览瓦片 —— */
.monitor-alert-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--panel);
  font-size: 12px;
}

.monitor-alert-summary.hidden {
  display: none !important;
}

.mas-item.mas-ok {
  color: var(--green);
}

.mas-item.mas-warn {
  color: #ffb020;
}

.mas-item.mas-err {
  color: var(--red);
}

.mas-sep {
  color: var(--muted);
}

.monitor-macro-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 176, 32, 0.45);
  background: linear-gradient(90deg, rgba(255, 176, 32, 0.12), rgba(255, 120, 80, 0.08));
}

.monitor-macro-banner.hidden {
  display: none !important;
}

.monitor-macro-banner-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.monitor-macro-badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  color: #ffb020;
  border: 1px solid rgba(255, 176, 32, 0.5);
  background: rgba(255, 176, 32, 0.12);
}

.monitor-macro-text {
  flex: 1 1 240px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.monitor-macro-banner.phase-imminent {
  border-color: rgba(255, 120, 80, 0.55);
  background: linear-gradient(90deg, rgba(255, 120, 80, 0.14), rgba(255, 176, 32, 0.1));
}

.macro-event-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0 14px;
  align-items: end;
}

.macro-event-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.macro-event-field-wide {
  grid-column: 1 / -1;
}

.macro-event-field input,
.macro-event-field select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12px;
  font-family: var(--mono);
}

.macro-event-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.macro-event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.macro-event-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(150px, 1fr) minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 12px;
}

.macro-event-row.is-active {
  border-color: rgba(255, 176, 32, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 176, 32, 0.12);
}

.macro-event-row-title {
  font-weight: 600;
  color: var(--text);
}

.macro-event-row-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.macro-event-row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.macro-event-empty {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius);
}

.host-status-panel {
  margin: 0 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--panel);
  font-size: 12px;
}

.host-status-panel.hidden {
  display: none !important;
}

.host-status-summary {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.host-status-summary::-webkit-details-marker {
  display: none;
}

.host-status-summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 11px;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.host-status-panel[open] > .host-status-summary::before {
  transform: rotate(90deg);
}

.host-status-summary-title {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.host-status-summary-text {
  font-size: 11px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

.host-status-summary-text.bad {
  color: var(--red);
}

.host-summary-host,
.host-summary-sep {
  color: var(--muted);
}

.host-metric-tone.ok,
.host-metric-val.ok {
  color: var(--green);
  font-weight: 600;
}

.host-metric-tone.bad,
.host-metric-val.bad {
  color: var(--red);
  font-weight: 600;
}

.host-status-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--border-soft);
  margin-top: 0;
  padding-top: 12px;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  background: transparent;
}

.host-status-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.host-status-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 220px;
}

.host-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
}

.host-status-dot.ok {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.host-status-dot.warn {
  background: #ffb020;
  box-shadow: 0 0 8px rgba(255, 176, 32, 0.45);
}

.host-status-dot.bad {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.host-status-name {
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host-status-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 11px;
  flex: 0 1 auto;
}

.host-status-uptime,
.host-status-updated {
  white-space: nowrap;
}

.host-status-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.host-metric-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.14);
}

html[data-theme="light"] .host-metric-card {
  background: rgba(0, 0, 0, 0.03);
}

.host-metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.host-metric-label {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.host-metric-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

html[data-theme="light"] .host-metric-bar {
  background: rgba(0, 0, 0, 0.06);
}

.host-metric-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: #22c55e;
  transition: width 0.35s ease, background 0.2s ease;
}

.host-metric-fill.ok {
  background: #22c55e;
}

.host-metric-fill.warn {
  background: #ffb020;
}

.host-metric-fill.bad {
  background: var(--red);
}

.host-metric-val {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.host-metric-val-net {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.host-metric-sub,
.host-net-line {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.host-net-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 1080px) {
  .host-status-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.grid-monitor.grid-monitor-tiles {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px;
  align-content: start;
}

.hub-tile {
  margin: 0;
  padding: 0;
  min-height: 118px;
  overflow: hidden;
}

.hub-tile .hub-tile-body {
  cursor: pointer;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 118px;
}

.hub-tile-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.hub-tile-name {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-tile-pnl {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
}

.hub-tile-pnl small {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.hub-tile-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-tile-foot {
  margin-top: auto;
  font-size: 10px;
  color: var(--muted);
}

.hub-tile-error {
  border-color: rgba(255, 77, 109, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 77, 109, 0.12);
}

.hub-tile-warn {
  border-color: rgba(255, 176, 32, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 176, 32, 0.1);
}

.hub-tile-ok {
  border-color: var(--border-soft);
}

.hub-tile-body:hover .hub-tile-name {
  color: var(--accent);
}

.card-title {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.card-sub {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--mono);
  word-break: break-all;
}

.card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.card-body {
  padding: 14px 16px;
}

.grid-monitor {
  display: grid;
  gap: 16px;
  /* 列数由 app.js syncMonitorGridColumns 按卡片数量设置 */
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.grid-monitor.grid-monitor-with-stats {
  grid-template-columns: 1fr;
}

.grid-monitor.grid-monitor-options-split {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.grid-monitor.grid-monitor-options-split .monitor-stats-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 8px 14px;
}

.grid-monitor.grid-monitor-options-split .monitor-stats-card .card-head,
.monitor-stats-card .monitor-stats-head {
  padding: 0;
  border-bottom: none;
  flex: 0 0 auto;
  width: 100%;
  align-items: center;
}

.monitor-stats-head-main {
  min-width: 0;
  flex: 1 1 auto;
}

.monitor-stats-float-summary {
  flex: 0 0 auto;
  text-align: right;
  padding: 2px 4px 2px 12px;
}

.monitor-stats-float-summary .monitor-stat-label {
  margin-bottom: 0;
  font-size: 11px;
}

.monitor-stats-float-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.btn-monitor-stats-toggle {
  font-size: 11px;
  padding: 2px 8px;
  min-height: 0;
  line-height: 1.3;
  color: var(--accent);
  border-color: var(--border-soft);
}

.monitor-stats-card.is-collapsed .monitor-stats-detail {
  display: none;
}

.monitor-stats-card:not(.is-collapsed) .monitor-stats-float-summary {
  display: none;
}

.grid-monitor.grid-monitor-options-split .monitor-stats-card .card-body {
  padding: 8px 0 0;
  flex: 1;
  min-width: 0;
}

.grid-monitor.grid-monitor-options-split .monitor-stats-card .card-title {
  font-size: 12px;
  margin: 0;
}

.grid-monitor.grid-monitor-options-split .monitor-stats-card .card-sub {
  font-size: 10px;
  margin-top: 2px;
}

.grid-monitor.grid-monitor-options-split .monitor-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.grid-monitor.grid-monitor-options-split .monitor-stat-cell {
  padding: 10px 8px 8px;
  border-radius: 8px;
  min-width: 0;
  text-align: center;
}

.grid-monitor.grid-monitor-options-split .monitor-stat-label {
  font-size: 11px;
  margin-bottom: 4px;
}

.grid-monitor.grid-monitor-options-split .monitor-stat-value {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
}

.grid-monitor.grid-monitor-options-split .monitor-stat-sub {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.25;
}

.monitor-split-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: 0;
}

/* 四卡平铺 2×2:左右等宽;同行同高;多仓时该行 min-content 变高,左右一起长 */
.monitor-split-body.monitor-split-2x2 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(min-content, 1fr) minmax(min-content, 1fr);
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}

.monitor-split-2x2 > .card {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.monitor-split-2x2 > .card-monitor-placeholder {
  visibility: hidden;
  pointer-events: none;
  border: none;
  background: transparent;
  box-shadow: none;
}

.monitor-split-left,
.monitor-split-right {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-content: stretch;
  overflow: hidden;
}

.monitor-split-left > .card,
.monitor-split-right > .card {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.card-monitor-okx-split,
.card-monitor-split-side {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-monitor-okx-split .card-body,
.card-monitor-split-side .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
  min-height: 0;
}

.hub-slot-pos {
  min-height: 2.4em;
  flex: 0 0 auto;
}

.hub-slot-pos[data-pos-count="0"] .empty-hint {
  margin: 0;
  padding: 6px 0;
}

.hub-opt-target-cell.is-on {
  color: var(--green);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hub-inner-cards {
  flex: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.hub-inner-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: color-mix(in srgb, var(--inset-surface) 92%, transparent);
  overflow: visible;
}

.hub-inner-card-head {
  flex: 0 0 auto;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text);
  border-bottom: 1px solid var(--border-soft);
}

.hub-inner-card-options .hub-inner-card-head {
  color: var(--accent);
}

.hub-inner-card-body {
  flex: 1;
  padding: 10px 12px;
  overflow: visible;
  min-height: 0;
}

.grid-monitor-options-split .hub-options-table-wrap,
.grid-monitor-options-split .pos-table-wrap,
.grid-monitor-options-split .table-scroll {
  overflow: visible;
  max-height: none;
}

@media (max-width: 1100px) {
  .grid-monitor.grid-monitor-options-split .monitor-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .grid-monitor.grid-monitor-options-split .monitor-stat-cell {
    padding: 4px 4px 3px;
  }
}

@media (max-width: 960px) {
  .monitor-split-body,
  .monitor-split-body.monitor-split-2x2 {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .monitor-split-left,
  .monitor-split-right {
    grid-template-rows: auto auto;
  }
}

.monitor-stats-card .card-head {
  padding-bottom: 0;
}

.monitor-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
}

.monitor-stat-cell {
  min-width: 0;
  padding: 10px 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
}

.monitor-stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.monitor-stats-card .card-title {
  font-family: var(--font);
  letter-spacing: 0.01em;
}

.monitor-stat-value {
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--text);
}

.monitor-stat-value.pnl-pos,
.monitor-stat-value.pnl-neg {
  text-shadow: none;
}

.monitor-stat-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

@media (max-width: 720px) {
  .monitor-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.card-expand-zone {
  cursor: pointer;
}

.card-expand-zone:hover .card-title {
  color: var(--accent);
}

body.hub-fullscreen-open {
  overflow: hidden;
}

body.hub-instance-frame-open {
  overflow: hidden;
}

body.market-chart-fs-open {
  overflow: hidden;
}

.instance-frame-shell {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: var(--bg, #0a0e14);
  isolation: isolate;
}

.instance-frame-shell.hidden {
  display: none !important;
}

.instance-frame-shell.is-instance-nav-loading .instance-frame {
  pointer-events: none;
}

.instance-frame-loading {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 49px;
  z-index: 2;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg, #0a0e14) 72%, transparent);
  color: var(--muted, #8892b0);
  font-size: 0.9rem;
  pointer-events: none;
}

.instance-frame-shell.is-instance-nav-loading .instance-frame-loading {
  display: flex;
}

.instance-frame-loading-inner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
}

.instance-frame-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--muted, #8892b0) 35%, transparent);
  border-top-color: var(--accent, #6eb5ff);
  animation: instance-frame-spin 0.75s linear infinite;
}

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

.instance-frame-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel-solid);
}

.instance-frame-title {
  flex: 1;
  font-weight: 600;
  color: var(--text, #dbe4ff);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instance-frame-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.instance-frame {
  flex: 1 1 auto;
  width: 100%;
  border: none;
  background: var(--bg);
}

.exchange-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--fs-scrim);
  backdrop-filter: blur(6px);
  overflow: auto;
  padding: 16px 20px 24px;
}

.exchange-fullscreen.hidden {
  display: none !important;
}

.exchange-fullscreen-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.exchange-fullscreen-panel {
  position: relative;
  z-index: 1;
  max-width: min(1800px, 98vw);
  margin: 0 auto;
}

.fs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.fs-title {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.04em;
}

.fs-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  word-break: break-all;
}

.fs-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.fs-head-actions .btn-open-trade {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-weight: 600;
}

.fs-head-actions .btn-open-trade:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.card-actions .btn-open-trade {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.card-expand-hint {
  margin-top: 12px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--border-soft);
  border-radius: 8px;
  background: rgba(0, 212, 255, 0.03);
}

/* 分栏卡:提示条贴卡片最底部 */
.card-monitor-split-side .card-body,
.card-monitor-okx-split .card-body {
  display: flex;
  flex-direction: column;
}

.card-monitor-split-side .card-expand-hint,
.card-monitor-okx-split .card-expand-hint {
  margin-top: auto;
  flex-shrink: 0;
}

.compact-pos-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.compact-pos-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 6px 8px;
  background: var(--inset-surface);
  border-radius: 6px;
  border: 1px solid var(--border-soft);
}

.hub-pos-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

/* 全屏放大:持仓卡片横向排列,列数随仓位数量自适应 */
.exchange-fullscreen .hub-pos-list {
  display: grid;
  gap: 14px;
  align-items: stretch;
  width: 100%;
}

.exchange-fullscreen .hub-pos-list.count-1 {
  grid-template-columns: minmax(0, 1fr);
}

.exchange-fullscreen .hub-pos-list.count-1 .hub-pos-card.pos-card {
  max-width: min(960px, 100%);
  margin-inline: auto;
  width: 100%;
}

.exchange-fullscreen .hub-pos-list.count-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.exchange-fullscreen .hub-pos-list.count-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.exchange-fullscreen .hub-pos-list.count-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.exchange-fullscreen .hub-pos-list.count-5,
.exchange-fullscreen .hub-pos-list.count-6 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.exchange-fullscreen .hub-pos-list.count-many {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.exchange-fullscreen .hub-pos-card.pos-card {
  min-width: 0;
  height: 100%;
}

@media (max-width: 1100px) {
  .exchange-fullscreen .hub-pos-list.count-3,
  .exchange-fullscreen .hub-pos-list.count-5,
  .exchange-fullscreen .hub-pos-list.count-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .exchange-fullscreen .hub-pos-list.count-many {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

@media (max-width: 640px) {
  .exchange-fullscreen .hub-pos-list.count-2,
  .exchange-fullscreen .hub-pos-list.count-3,
  .exchange-fullscreen .hub-pos-list.count-4,
  .exchange-fullscreen .hub-pos-list.count-5,
  .exchange-fullscreen .hub-pos-list.count-6,
  .exchange-fullscreen .hub-pos-list.count-many {
    grid-template-columns: minmax(0, 1fr);
  }
  .exchange-fullscreen .hub-pos-list.count-1 .hub-pos-card.pos-card {
    max-width: 100%;
  }
}

/* 平板横屏:持仓与区块双列 */
@media (min-width: 641px) and (max-width: 1200px) and (orientation: landscape) {
  .exchange-fullscreen .hub-pos-list.count-2,
  .exchange-fullscreen .hub-pos-list.count-3,
  .exchange-fullscreen .hub-pos-list.count-4,
  .exchange-fullscreen .hub-pos-list.count-many {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .exchange-fullscreen .hub-section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hub-fs-sections-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }
}

/* 手机竖屏:全屏顶栏与持仓单列 */
@media (max-width: 720px), (max-width: 900px) and (orientation: portrait) {
  .exchange-fullscreen .hub-pos-list {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

.hub-fs-sections-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 720px), (max-width: 900px) and (orientation: portrait) {
  .hub-fs-sections-grid {
    display: flex;
    flex-direction: column;
  }
}

/* 对齐实盘「实时持仓」pos-card */
.hub-pos-card.pos-card {
  background: var(--pos-card-bg);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
}

.hub-pos-card .pos-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.hub-pos-card .pos-card-symbol {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.hub-pos-card .pos-symbol-time-close,
.hub-mini-title .pos-symbol-time-close,
.td-symbol .pos-symbol-time-close {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  color: #8fc8ff;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(143, 200, 255, 0.1);
  white-space: nowrap;
  vertical-align: middle;
}
.hub-pos-card .pos-symbol-time-close .pos-time-close-cd,
.hub-mini-title .pos-symbol-time-close .pos-time-close-cd,
.td-symbol .pos-symbol-time-close .pos-time-close-cd {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}
.hub-pos-card .pos-symbol-force-close,
.hub-mini-title .pos-symbol-force-close,
.td-symbol .pos-symbol-force-close {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  color: #ffc870;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 200, 112, 0.12);
  white-space: nowrap;
  vertical-align: middle;
}
.hub-pos-card .pos-symbol-force-close .pos-force-close-cd,
.hub-mini-title .pos-symbol-force-close .pos-force-close-cd,
.td-symbol .pos-symbol-force-close .pos-force-close-cd {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}
.hub-pos-card .pos-card-symbol strong {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.hub-pos-card .pos-side-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
}

.hub-pos-card .pos-side-long,
.hub-pos-card .pos-side-badge.side-long {
  background: rgba(0, 255, 157, 0.12);
  color: var(--green);
  border: 1px solid rgba(0, 255, 157, 0.35);
}

.hub-pos-card .pos-side-short,
.hub-pos-card .pos-side-badge.side-short {
  background: rgba(255, 77, 109, 0.12);
  color: var(--red);
  border: 1px solid rgba(255, 77, 109, 0.35);
}

.side-long {
  color: var(--green);
  font-weight: 600;
  text-shadow: 0 0 10px rgba(0, 255, 157, 0.25);
}

.side-short {
  color: var(--red);
  font-weight: 600;
  text-shadow: 0 0 10px rgba(255, 77, 109, 0.25);
}

.data-table td.side-long,
.data-table td.side-short {
  font-weight: 600;
}

.hub-pos-card .pos-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.hub-pos-card .pos-entrust-btn {
  padding: 6px 12px;
  background: rgba(42, 74, 122, 0.9);
  color: #8fc8ff;
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.hub-pos-card .pos-close-btn {
  padding: 6px 14px;
  background: rgba(196, 84, 84, 0.95);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.hub-pos-card .pos-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
}

.hub-pos-card .pos-meta-item:not(:last-child)::after {
  content: "|";
  margin: 0 8px;
  color: var(--border-soft);
}

.hub-pos-card .pos-meta-on {
  color: #6eb5ff;
}

.hub-pos-card .pos-meta-off {
  color: var(--muted);
}

.hub-pos-card .pos-breakeven-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #1a3d2e;
  color: #4cd97f;
}

.pos-breakeven-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #1a3d2e;
  color: #4cd97f;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table .td-symbol {
  white-space: nowrap;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
}

.hub-pos-card .pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 14px;
  margin-bottom: 12px;
}

.exchange-fullscreen .hub-opt-pos-list {
  margin-bottom: 14px;
}

.hub-opt-pos-card .pos-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hub-opt-pos-card .opt-pos-cell--depth {
  grid-column: span 2;
}

.hub-opt-pos-card .opt-bid-plain {
  color: #dbe6ff;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  white-space: normal;
}

.hub-opt-pos-card .opt-close-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hub-opt-pos-card .pos-card-symbol strong {
  font-size: 0.72rem;
  word-break: break-all;
}

.hub-pos-card .pos-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.hub-pos-card .pos-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.hub-pos-card .pos-value {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.hub-pos-card .pos-value.pnl-pos {
  color: var(--green);
  font-weight: 600;
  text-shadow: 0 0 12px rgba(0, 255, 157, 0.25);
}

.hub-pos-card .pos-value.pnl-neg {
  color: var(--red);
  font-weight: 600;
}

.hub-pos-card .pos-tp-profit {
  color: #4cd97f;
  font-weight: 600;
}

html[data-theme="light"] .hub-pos-card .pos-label {
  color: #0f172a;
  font-weight: 500;
}

html[data-theme="light"] .hub-pos-card .pos-meta,
html[data-theme="light"] .hub-pos-card .pos-meta-item {
  color: #1e293b;
}

html[data-theme="light"] .hub-pos-card .pos-value {
  color: #020617;
  font-weight: 600;
}

html[data-theme="light"] .hub-pos-card .pos-side-long,
html[data-theme="light"] .hub-pos-card .pos-side-badge.side-long {
  background: #006e9a;
  color: #fff;
  border-color: #005a82;
}

html[data-theme="light"] .hub-pos-card .pos-side-short,
html[data-theme="light"] .hub-pos-card .pos-side-badge.side-short {
  background: #b03030;
  color: #fff;
  border-color: #8a2424;
}

html[data-theme="light"] .hub-opt-pos-card .opt-bid-plain {
  color: #0f172a;
}

html[data-theme="light"] .hub-opt-pos-card .opt-close-value {
  color: #9f1239;
}

html[data-theme="light"] .hub-pos-card .pos-tp-profit {
  color: #1a8f4a;
}

.hub-pos-card .pos-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.hub-pos-card .pos-ex-orders {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
}

.hub-pos-card .pos-ex-orders-title {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.hub-pos-card .pos-ex-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-top: 5px;
}

.hub-pos-card .pos-ex-order-main {
  flex: 1;
  min-width: 0;
}

.hub-pos-card .pos-ex-cancel-btn {
  padding: 3px 10px;
  background: rgba(58, 48, 72, 0.9);
  color: #d4b8ff;
  border: 1px solid rgba(123, 97, 255, 0.35);
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
}

.hub-pos-card .pos-orders-collapse {
  margin-top: 10px;
}

.hub-section-card {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--section-surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

.hub-section-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.hub-section-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hub-key-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 全屏放大:关键位 3 列网格 */
.exchange-fullscreen .hub-key-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.exchange-fullscreen .hub-key-list .hub-mini-card {
  min-width: 0;
  height: 100%;
}

@media (max-width: 1100px) {
  .exchange-fullscreen .hub-key-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .exchange-fullscreen .hub-key-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

.hub-mini-card {
  padding: 10px 12px;
  background: var(--inset-surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

.hub-mini-card.hub-key-pending,
.list-line.hub-key-pending {
  border-color: rgba(0, 212, 255, 0.55);
  background: rgba(0, 212, 255, 0.08);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.12);
}

.hub-key-pending-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(0, 212, 255, 0.15);
  border: 1px solid rgba(0, 212, 255, 0.45);
  border-radius: 4px;
  vertical-align: middle;
}

.hub-key-pending .hub-key-status-line,
.list-line.hub-key-pending {
  color: var(--text);
}

.hub-mini-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.hub-mini-line {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.pos-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed var(--border-soft);
  border-radius: 10px;
}

@media (max-width: 520px) {
  .hub-pos-card .pos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stat-box {
  background: var(--inset-surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 12px;
}

.stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.section-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 14px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}

.section-title:first-child {
  margin-top: 0;
}

.pos-block {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-soft);
}

.pos-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.pos-table-wrap {
  margin-bottom: 8px;
}

.data-table-positions tbody tr:not(:last-child) td {
  border-bottom: 1px dashed var(--border-soft);
}

.card-strategy-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-soft);
}

.card-stat-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.3;
  border: 1px solid transparent;
}

/* 突破 + 斐波 */
.card-stat-chip.card-stat-key-breakout {
  color: var(--accent);
  background: rgba(0, 212, 255, 0.14);
  border-color: rgba(0, 212, 255, 0.38);
}

/* 关键位监控(阻力/支撑等) */
.card-stat-chip.card-stat-key-watch {
  color: #b8a0ff;
  background: rgba(123, 97, 255, 0.18);
  border-color: rgba(123, 97, 255, 0.42);
}

/* 趋势回调 */
.card-stat-chip.card-stat-trend {
  color: var(--green);
  background: rgba(0, 255, 157, 0.1);
  border-color: rgba(0, 255, 157, 0.38);
}

/* 趋势回调:与三所实例 strategy_trend_panel 同款卡片 */
.hub-trend-running-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 600;
}

.hub-trend-plan-list.running-plans-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hub-trend-plan-card.plan-position-card {
  background: var(--panel-solid);
  border: 1px solid var(--panel-solid-border);
  border-radius: 12px;
  padding: 12px 14px;
}

.hub-trend-plan-card .plan-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.hub-trend-plan-card .plan-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 1rem;
  font-weight: 700;
  color: var(--plan-title);
}

.hub-trend-plan-card .plan-card-meta {
  font-size: 0.76rem;
  color: var(--plan-meta);
  line-height: 1.55;
  margin-bottom: 10px;
}

.hub-trend-plan-card .plan-card-meta .accent {
  color: var(--plan-meta-accent);
}

.hub-trend-plan-card .plan-card-meta strong {
  color: var(--accent);
}

.hub-trend-plan-body-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 18px;
  align-items: start;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--plan-border-dash);
}

.hub-trend-plan-col-left .plan-card-meta {
  margin-bottom: 10px;
}

.hub-trend-plan-col-left .plan-card-grid {
  margin-bottom: 0;
}

.hub-trend-plan-card .plan-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
}

.hub-trend-plan-card .plan-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hub-trend-plan-card .plan-cell .lbl {
  font-size: 0.72rem;
  color: var(--plan-lbl);
}

.hub-trend-plan-card .plan-cell .val {
  color: var(--plan-val);
  font-size: 0.88rem;
  font-weight: 500;
}

.hub-trend-plan-card .plan-cell .val.pnl-profit {
  color: #4cd97f;
}

.hub-trend-plan-card .plan-cell .val.pnl-loss {
  color: #ff6666;
}

.hub-trend-plan-card .plan-cell .val.pnl-neutral {
  color: var(--plan-val-neutral);
}

.hub-trend-plan-card .btn-close-plan {
  padding: 7px 14px;
  background: var(--plan-close-bg);
  color: var(--plan-close-fg);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  display: inline-block;
}

.hub-trend-plan-card .btn-close-plan:hover {
  filter: brightness(1.08);
}

.hub-trend-plan-card .plan-dca-block--side {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  height: 100%;
}

.hub-trend-plan-col-right {
  min-width: 0;
  border-left: 1px solid var(--plan-col-divider);
  padding-left: 14px;
}

.hub-dca-empty {
  font-size: 0.76rem;
  color: var(--plan-meta);
  padding: 8px 0;
}

.hub-trend-plan-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.hub-trend-plan-foot .hub-plan-breakeven-row {
  margin-top: 0;
}

.hub-trend-plan-foot .hub-plan-account-foot {
  margin-bottom: 0;
}

.hub-trend-plan-card .plan-dca-title {
  font-size: 0.74rem;
  color: var(--plan-lbl);
  margin-bottom: 8px;
}

.hub-trend-plan-card .plan-dca-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.hub-trend-plan-card .plan-dca-table th,
.hub-trend-plan-card .plan-dca-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--plan-col-divider);
  text-align: left;
  font-weight: 500;
}

.hub-trend-plan-card .plan-dca-table td {
  color: var(--text);
}

.hub-trend-plan-card .plan-dca-table th {
  color: var(--plan-dca-th);
  font-weight: 600;
}

.hub-trend-plan-card .plan-dca-table .st-done {
  color: var(--status-done);
  font-weight: 700;
}

.hub-trend-plan-card .plan-dca-table .st-pending {
  color: var(--status-pending);
  font-weight: 600;
}

.hub-trend-plan-card .hub-plan-breakeven-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
}

.hub-trend-plan-card .hub-plan-be-label {
  font-size: 0.78rem;
  color: var(--plan-be-label);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hub-trend-plan-card .hub-plan-be-input {
  width: 72px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--plan-be-input-border);
  background: var(--plan-be-input-bg);
  color: var(--plan-val);
  opacity: 0.92;
}

.hub-trend-plan-card .hub-plan-be-btn {
  padding: 6px 12px;
  background: var(--plan-be-btn-bg);
  color: var(--accent);
  border: 1px solid var(--plan-be-input-border);
  border-radius: 8px;
  font-size: 0.78rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.hub-trend-plan-card button.hub-plan-be-btn {
  font-family: inherit;
}

.hub-trend-plan-card .hub-plan-be-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hub-trend-plan-card .hub-plan-be-btn--static {
  cursor: default;
}

.hub-trend-plan-card .hub-plan-be-done {
  color: #6ab88a;
  font-size: 0.75rem;
}

.hub-trend-plan-card .hub-plan-account-foot {
  margin-bottom: 0;
}

.hub-trend-plan-card .badge.direction-long {
  color: #4cd97f;
  border-color: rgba(76, 217, 127, 0.45);
}

.hub-trend-plan-card .badge.direction-short {
  color: #ff6666;
  border-color: rgba(255, 102, 102, 0.45);
}

.exchange-fullscreen .hub-trend-plan-card.plan-position-card {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 900px) {
  .hub-trend-plan-body-cols {
    grid-template-columns: 1fr;
  }

  .hub-trend-plan-col-right {
    border-left: none;
    padding-left: 0;
    padding-top: 10px;
    border-top: 1px dashed var(--plan-border-dash);
  }
}

@media (max-width: 720px) {
  .hub-trend-plan-card .plan-card-grid {
    grid-template-columns: 1fr;
  }
}

/* 顺势加仓 */
.card-stat-chip.card-stat-roll {
  color: #ffb020;
  background: rgba(255, 176, 32, 0.14);
  border-color: rgba(255, 176, 32, 0.42);
}

.hub-tile .card-strategy-stats {
  margin: 4px 0 0;
  padding-top: 6px;
  border-top: none;
  gap: 4px;
}

.hub-tile .card-stat-chip {
  font-size: 10px;
  padding: 2px 6px;
}

.pos-action-group {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.data-table .td-actions .btn-sm {
  margin: 0;
  vertical-align: middle;
}

button.btn-sm {
  padding: 4px 11px;
  font-size: 11px;
  line-height: 1.35;
  border-radius: 6px;
  min-width: 48px;
}

.btn-place-tpsl.btn-sm {
  border-color: rgba(0, 212, 255, 0.35);
  color: var(--accent);
}

.pos-orders-collapse {
  margin: 10px 0 0;
  padding: 0;
  background: var(--inset-surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  overflow: hidden;
}

.pos-orders-collapse-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: rgba(0, 212, 255, 0.04);
  border-bottom: 1px solid transparent;
}

.pos-orders-collapse[open] > .pos-orders-collapse-summary {
  border-bottom-color: var(--border-soft);
}

.pos-orders-collapse-summary::-webkit-details-marker {
  display: none;
}

.pos-orders-collapse-summary::before {
  content: "▸";
  flex-shrink: 0;
  color: var(--accent);
  font-size: 11px;
  width: 12px;
  transition: transform 0.15s ease;
}

.pos-orders-collapse[open] > .pos-orders-collapse-summary::before {
  transform: rotate(90deg);
}

.pos-orders-collapse-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
}

.pos-orders-collapse-label em {
  font-style: normal;
  color: var(--accent);
  margin-left: 2px;
}

.pos-orders-collapse-meta {
  flex: 1;
  font-size: 10px;
  color: var(--muted);
  min-width: 0;
}

.pos-orders-collapse-summary .btn-cancel-cond-all {
  flex-shrink: 0;
  margin-left: auto;
}

.pos-orders-collapse-body {
  padding: 8px 10px 10px;
}

.orders-section + .orders-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
}

.orders-section-head {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.data-table-sub {
  font-size: 10px;
}

.data-table-sub th,
.data-table-sub td {
  padding: 5px 6px;
}

.order-empty {
  font-size: 11px;
  color: var(--muted);
  padding: 6px 4px 8px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.modal-panel,
.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  padding: 20px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.06em;
}

.plan-modal-close {
  flex-shrink: 0;
  min-width: 32px;
  padding: 4px 8px;
  font-size: 18px;
  line-height: 1;
}

.modal-panel h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.06em;
}

.modal-meta {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
}

.modal-field {
  margin-bottom: 12px;
}

.modal-field label {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-field input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
}

.modal-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.data-table {
  width: 100%;
  min-width: 300px;
  border-collapse: collapse;
  font-size: 11px;
}

.data-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 10px;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}

.data-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.list-line {
  font-size: 11px;
  color: var(--muted);
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-soft);
  line-height: 1.45;
}
.list-line:last-child {
  border-bottom: none;
}

.empty-hint {
  font-size: 11px;
  color: var(--muted);
  padding: 8px 0;
}

.board-loading-sub {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 36rem;
}

.board-loading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 120px;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
}

.board-loading-spin {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: hub-spin 0.8s linear infinite;
}

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

.pnl-pos {
  color: var(--green);
  text-shadow: 0 0 12px rgba(0, 255, 157, 0.3);
}
.pnl-neg {
  color: var(--red);
}

.data-table td.pnl-pos {
  color: var(--green);
  font-weight: 600;
}

.data-table td.pnl-neg {
  color: var(--red);
  font-weight: 600;
}
.err {
  color: var(--red);
  font-size: 12px;
}

.badge {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: 0.06em;
}

.settings-meta-line {
  font-size: 11px;
  color: var(--muted);
  padding: 10px 14px;
  background: var(--panel);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 16px;
  line-height: 1.55;
  border: 1px solid var(--border-soft);
  border-left-width: 3px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label,
.field > span {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.field input,
.field select,
.form-row input,
.form-row select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12px;
  font-family: var(--mono);
  width: 100%;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2), var(--glow);
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
}

.field-check label {
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
}

.settings-display-panel,
.settings-macro-panel,
.settings-supervisor-panel {
  margin-bottom: 0;
}

/* 中控系统设置 · CSS Tab(与实例 env 配置同方案) */
.hub-config-body {
  margin-bottom: 16px;
}

.hub-tab-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  border: 0;
}

.hub-config-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-soft);
  padding: 0 8px;
  scrollbar-width: thin;
}

.hub-tab-btn {
  flex: 0 0 auto;
  display: inline-block;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}

.hub-tab-btn:hover {
  color: color-mix(in srgb, var(--text) 80%, var(--muted));
}

.hub-config-panels .hub-panel {
  display: none;
}

#hub-sec-0:checked ~ .hub-config-tabs label[for="hub-sec-0"],
#hub-sec-1:checked ~ .hub-config-tabs label[for="hub-sec-1"],
#hub-sec-2:checked ~ .hub-config-tabs label[for="hub-sec-2"],
#hub-sec-3:checked ~ .hub-config-tabs label[for="hub-sec-3"],
#hub-sec-4:checked ~ .hub-config-tabs label[for="hub-sec-4"],
#hub-sec-5:checked ~ .hub-config-tabs label[for="hub-sec-5"],
#hub-sec-6:checked ~ .hub-config-tabs label[for="hub-sec-6"] {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

#hub-sec-0:checked ~ .hub-config-panels .hub-panel--0,
#hub-sec-1:checked ~ .hub-config-panels .hub-panel--1,
#hub-sec-2:checked ~ .hub-config-panels .hub-panel--2,
#hub-sec-3:checked ~ .hub-config-panels .hub-panel--3,
#hub-sec-4:checked ~ .hub-config-panels .hub-panel--4,
#hub-sec-5:checked ~ .hub-config-panels .hub-panel--5,
#hub-sec-6:checked ~ .hub-config-panels .hub-panel--6 {
  display: block;
}

.hub-config-panels {
  padding: 14px 16px 16px;
}

.hub-settings-tab-panel {
  margin: 0;
}

.hub-settings-tab-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.hub-settings-tab-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.hub-settings-tab-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hub-settings-tab-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.hub-password-grid {
  margin-top: 8px;
}

.hub-ai-env-grid .field-wide {
  grid-column: 1 / -1;
}

.settings-status-line {
  font-size: 0.8rem;
  color: var(--muted);
}

.settings-status-line.is-err {
  color: var(--danger, #f87171);
}

.settings-section {
  margin-bottom: 16px;
}

.settings-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.settings-section.is-collapsed .settings-section-head {
  border-bottom-color: transparent;
}

.settings-section-head .settings-display-title {
  flex: 1;
  margin: 0;
  min-width: 0;
}

.settings-section-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.settings-section-fold {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 90%, var(--accent) 10%);
  color: var(--accent);
  cursor: pointer;
  font-size: 0;
  line-height: 1;
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.settings-section-fold::before {
  content: "▾";
  font-size: 0.85rem;
  line-height: 28px;
  display: block;
  text-align: center;
}

.settings-section-fold:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border-soft));
}

.settings-section.is-collapsed .settings-section-fold::before {
  content: "▸";
}

.settings-section-save {
  flex-shrink: 0;
  font-size: 0.82rem;
  padding: 6px 14px;
}

.settings-section-body {
  padding: 14px 16px;
}

.settings-section.is-collapsed .settings-section-body {
  display: none;
}

.settings-page-toolbar {
  margin-top: 4px;
}

.settings-card-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-soft);
}

.settings-card-fold {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0;
  line-height: 1;
  transition: color 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.settings-card-fold::before {
  content: "▾";
  font-size: 0.8rem;
  line-height: 26px;
  display: block;
  text-align: center;
}

.settings-card-fold:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border-soft));
}

.settings-card.is-collapsed .settings-card-fold::before {
  content: "▸";
}

.settings-card-title {
  flex: 1;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-card-save {
  flex-shrink: 0;
  font-size: 0.78rem;
  padding: 5px 12px;
}

.settings-card-body {
  display: block;
}

.settings-card.is-collapsed .settings-card-body {
  display: none;
}

@media (max-width: 720px) {
  .settings-section-head {
    flex-wrap: wrap;
  }

  .settings-section-head-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .settings-card-topbar {
    flex-wrap: wrap;
  }
}

.settings-display-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--text);
}

.settings-display-chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.settings-display-chk + .settings-display-chk {
  margin-top: 8px;
}

.settings-display-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.backup-settings-grid {
  margin-top: 12px;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.backup-status-line {
  font-size: 0.82rem;
  color: var(--muted);
}

.backup-status-line.err {
  color: var(--danger, #f87171);
}

.backup-restore-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.backup-upload-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.backup-list {
  margin-top: 16px;
}

.backup-meta {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.backup-meta code {
  font-size: 0.76rem;
}

.backup-empty {
  font-size: 0.82rem;
  color: var(--muted);
}

.backup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.backup-table th,
.backup-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.backup-row-actions {
  white-space: nowrap;
}

.backup-row-actions .ghost,
.backup-row-actions .danger {
  font-size: 0.78rem;
  padding: 4px 8px;
}

.settings-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(10px);
}

.settings-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.settings-card-head .ex-name {
  flex: 1;
  min-width: 160px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--display);
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--border);
  color: var(--text);
  padding: 4px 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.settings-grid .field input {
  font-size: 11px;
}

.cap-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.cap-chips label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  border: 1px solid var(--border-soft);
}

.settings-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.settings-card-foot .field {
  max-width: 80px;
}

#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: min(420px, 92vw);
  background: var(--panel);
  border: 1px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius);
  display: none;
  z-index: 50;
  white-space: pre-wrap;
  font-size: 12px;
  box-shadow: var(--glow);
  backdrop-filter: blur(12px);
}

#toast.show {
  display: block;
}

/* —— 登录页 —— */
body.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-theme-bar {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.login-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 28px 26px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow), var(--glow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.login-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.16em;
  margin-top: 4px;
}

.login-form .field {
  margin-bottom: 16px;
}

.login-submit {
  width: 100%;
  padding: 12px;
}

.login-err {
  color: var(--red);
  font-size: 12px;
  margin: 10px 0 0;
}

.login-foot {
  margin: 20px 0 0;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
}
.login-foot code {
  color: var(--accent);
  font-size: 10px;
}

/* —— 手机 / 窄屏自适应 —— */
@media (max-width: 720px) {
  .app-shell {
    padding: 0 max(12px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 0;
  }

  .brand-sub {
    display: none;
  }

  .app-header {
    padding: 10px 0;
    margin-bottom: 4px;
  }

  .header-right {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px;
  }

  .header-right .theme-toggle {
    grid-column: 1;
    justify-self: start;
  }

  .sys-pill {
    grid-column: 2;
    align-self: center;
  }

  button.ghost#btn-logout {
    grid-column: 3;
    width: auto;
    min-height: 36px;
    padding: 6px 12px;
    justify-self: end;
  }

  .top-nav {
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 2px;
  }

  .top-nav::-webkit-scrollbar {
    display: none;
  }

  .top-nav a {
    flex: 0 0 auto;
    text-align: center;
    padding: 8px 14px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }

  .page-desc {
    display: none;
  }

  .market-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: end;
  }

  .market-field {
    min-width: 0;
  }

  .market-field select,
  .market-field input {
    width: 100%;
    min-width: 0;
  }

  .market-field-symbol {
    grid-column: 1 / -1;
  }

  .market-toolbar .toolbar-spacer {
    display: none;
  }

  .market-toolbar #market-load {
    grid-column: 1;
  }

  .market-toolbar #market-refresh {
    grid-column: 2;
  }

  .market-toolbar .toolbar-meta {
    grid-column: 1 / -1;
    text-align: left;
    font-size: 0.72rem;
  }

  .market-chart-wrap {
    min-height: 260px;
    height: min(52vh, 420px);
  }

  .archive-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    align-items: center;
  }

  .archive-toolbar .archive-field {
    grid-column: 1 / -1;
  }

  .archive-toolbar .chk-label {
    margin: 0;
    min-height: 36px;
    justify-content: flex-start;
  }

  .archive-toolbar #archive-btn-refresh {
    grid-column: 1;
  }

  .archive-toolbar #archive-btn-sync {
    grid-column: 2;
  }

  .archive-toolbar .toolbar-meta {
    grid-column: 1 / -1;
    text-align: left;
  }

  body.hub-page-ai .page-head {
    margin: 4px 0 6px;
  }

  body.hub-page-ai .page-head h1 {
    margin: 0;
    font-size: 15px;
  }

  .page-head {
    margin: 16px 0 12px;
  }

  .page-head h1 {
    font-size: 17px;
    flex-wrap: wrap;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .toolbar-spacer {
    display: none;
  }

  .toolbar-meta {
    text-align: center;
    order: 10;
  }

  .toolbar button,
  .toolbar .chk-label {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .grid-monitor:not(.grid-monitor-tiles),
  .settings-grid-wrap {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px;
  }

  .grid-monitor.grid-monitor-tiles {
    /* 手机监控单列,避免统计与交易所卡并排挤字 */
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  #page-monitor .page-head {
    margin-bottom: 8px;
  }

  #page-monitor .page-head h1 {
    margin-bottom: 0;
  }

  .monitor-alert-summary {
    margin-bottom: 8px;
  }

  .host-status-panel {
    margin-bottom: 10px;
  }

  .host-status-summary {
    flex-wrap: wrap;
    padding: 8px 10px;
  }

  .host-status-bar {
    padding: 10px;
  }

  .host-status-top {
    flex-direction: column;
    align-items: stretch;
  }

  .host-status-meta {
    justify-content: flex-start;
  }

  .host-status-metrics {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .card-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .card-actions {
    flex-wrap: wrap;
    width: 100%;
    gap: 8px;
  }

  .card-actions .btn-link,
  .card-actions button {
    flex: 1 1 calc(50% - 4px);
    min-height: 40px;
    text-align: center;
    justify-content: center;
  }

  .card-body {
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .stat-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .stat-value {
    font-size: 14px;
  }

  .stat-label {
    font-size: 9px;
  }

  .instance-frame-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
  }

  .instance-frame-title {
    flex: 1 1 100%;
    order: -1;
    font-size: 0.82rem;
  }

  .instance-frame-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .instance-frame {
    height: calc(100dvh - 96px);
  }

  .exchange-fullscreen {
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .exchange-fullscreen-panel {
    max-width: 100%;
  }

  .fs-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .fs-head-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .fs-head-actions .btn-expand-back {
    grid-column: 1 / -1;
  }

  .fs-head-actions .btn-open-trade {
    grid-column: 1 / -1;
  }

  .fs-head-actions .btn-link,
  .fs-head-actions button {
    min-height: 44px;
    text-align: center;
    justify-content: center;
  }

  .hub-pos-card .pos-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .hub-pos-card .pos-head-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .hub-pos-card .pos-entrust-btn,
  .hub-pos-card .pos-close-btn {
    width: 100%;
    min-height: 44px;
    text-align: center;
  }

  .hub-pos-card .pos-ex-order-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-card-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .settings-card-foot .field {
    max-width: none;
  }

  .modal {
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    align-items: flex-end;
  }

  .modal-panel {
    max-width: none;
    width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
    min-height: 44px;
  }

  #toast {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    max-width: none;
  }

  body.login-page {
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  }

  .login-panel {
    padding: 22px 18px;
  }
}

/* —— 可折叠条:桌面/平板始终展开(隐藏 summary) —— */
.hub-m-fold {
  margin: 0 0 12px;
  border: none;
  background: transparent;
  padding: 0;
}

.hub-m-fold > .hub-m-fold-summary {
  display: none;
  list-style: none;
}

.hub-m-fold > .hub-m-fold-summary::-webkit-details-marker {
  display: none;
}

.calc-mobile-tabs {
  display: none;
}

.card-stat-chip.card-stat-options {
  border-color: rgba(0, 212, 255, 0.35);
  color: var(--accent, #6ea8ff);
  background: rgba(0, 212, 255, 0.08);
}

.hub-tile-opt {
  color: var(--accent, #6ea8ff) !important;
  font-weight: 500;
}

/* —— 手机壳:底栏四件套(仅 ≤720px;桌面/平板完全不进此规则) —— */
.hub-mobile-tabbar,
.hub-mobile-more {
  display: none;
}

@media (max-width: 720px) {
  :root {
    --hub-m-tabbar-h: 56px;
  }

  body.hub-phone .app-header .top-nav {
    display: none !important;
  }

  /* 顶栏一行:省纵向空间,底栏已标当前页 */
  body.hub-phone .app-header {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    margin-bottom: 4px;
  }

  body.hub-phone .brand-sub {
    display: none;
  }

  body.hub-phone .brand-title {
    font-size: 12px;
    letter-spacing: 0.02em;
  }

  body.hub-phone .header-right {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: auto;
    margin-left: auto;
    grid-template-columns: none;
    grid-template-rows: none;
  }

  body.hub-phone .header-right .theme-toggle {
    transform: scale(0.92);
    transform-origin: center right;
  }

  body.hub-phone button.ghost#btn-logout {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 12px;
  }

  body.hub-phone .app-shell {
    padding-bottom: calc(var(--hub-m-tabbar-h) + max(10px, env(safe-area-inset-bottom)));
  }

  /* 四页标题与底栏重复,手机隐藏 */
  body.hub-phone #page-monitor > .page-head,
  body.hub-phone #page-market > .page-head,
  body.hub-phone #page-calculator > .page-head,
  body.hub-phone #page-ai > .page-head {
    display: none;
  }

  /* —— 监控 —— */
  body.hub-phone .grid-monitor.grid-monitor-tiles {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  body.hub-phone .hub-tile {
    min-height: 0;
  }

  body.hub-phone .hub-tile .hub-tile-body {
    min-height: 0;
    padding: 12px 14px;
  }

  body.hub-phone .hub-tile-pnl {
    font-size: 22px;
  }

  body.hub-phone .monitor-stats-card .monitor-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  body.hub-phone .monitor-stat-cell {
    padding: 8px 6px;
  }

  body.hub-phone .monitor-stat-label {
    font-size: 10px;
  }

  body.hub-phone .monitor-stat-value {
    font-size: 14px;
  }

  body.hub-phone #page-monitor .host-status-panel {
    margin-bottom: 8px;
  }

  body.hub-phone #page-monitor .host-status-summary {
    padding: 8px 10px;
    gap: 6px 8px;
  }

  body.hub-phone #page-monitor .host-status-summary-text {
    font-size: 11px;
  }

  body.hub-phone #page-monitor .toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
  }

  body.hub-phone #page-monitor .toolbar .primary,
  body.hub-phone #page-monitor .toolbar .danger {
    flex: 1 1 auto;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 13px;
  }

  body.hub-phone #page-monitor .toolbar .chk-label {
    order: 3;
    flex: 1 1 100%;
    margin: 0;
    font-size: 11px;
    color: var(--muted);
  }

  body.hub-phone #page-monitor .toolbar .toolbar-spacer {
    display: none;
  }

  body.hub-phone #page-monitor .toolbar .toolbar-meta {
    order: 4;
    flex: 1 1 100%;
    font-size: 10px;
    opacity: 0.85;
  }

  /* —— 行情:控件收短,图表优先 —— */
  body.hub-phone #page-market .market-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 8px;
    align-items: end;
    padding: 8px 10px;
    margin-bottom: 8px;
  }

  body.hub-phone #page-market .market-field > span {
    font-size: 10px;
    margin-bottom: 2px;
  }

  body.hub-phone #page-market .market-field select,
  body.hub-phone #page-market .market-field input {
    min-height: 34px;
    padding: 4px 8px;
    font-size: 13px;
  }

  body.hub-phone #page-market .market-field-symbol {
    grid-column: 1 / -1;
  }

  body.hub-phone #page-market .market-field-symbol .market-symbol-wrap {
    flex-direction: column;
    gap: 6px;
  }

  body.hub-phone #page-market .market-scan-tabs {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 1px;
  }

  body.hub-phone #page-market .market-scan-tabs::-webkit-scrollbar {
    display: none;
  }

  body.hub-phone #page-market .market-scan-tab {
    min-height: 30px;
    padding: 0 10px;
    font-size: 11px;
  }

  body.hub-phone #page-market .market-toolbar #market-load {
    grid-column: 1;
    min-height: 34px;
    padding: 6px 10px;
  }

  body.hub-phone #page-market .market-toolbar #market-refresh {
    grid-column: 2;
    min-height: 34px;
    padding: 6px 8px;
    font-size: 11px;
  }

  body.hub-phone #page-market .market-toolbar .toolbar-meta {
    display: none;
  }

  body.hub-phone #page-market #market-status {
    display: none;
  }

  body.hub-phone #page-market #market-status.err,
  body.hub-phone #page-market #market-status.warn {
    display: block;
    font-size: 11px;
    margin: 0 0 6px;
  }

  body.hub-phone #page-market .market-vol-rank-anchor {
    margin: 0 0 6px;
  }

  body.hub-phone #page-market .market-chart-wrap {
    min-height: min(58vh, 480px);
    height: min(58vh, 480px);
  }

  body.hub-phone #page-market .market-ohlcv-bar {
    padding: 8px 10px 6px;
  }

  body.hub-phone #page-market .market-ohlcv-title {
    gap: 6px;
    margin-bottom: 2px;
  }

  /* 交易所/币种已在顶栏出现,图表内重复标签隐藏 */
  body.hub-phone #page-market .mkt-exchange-tag,
  body.hub-phone #page-market #mkt-symbol-label,
  body.hub-phone #page-market #mkt-tf-label {
    display: none;
  }

  body.hub-phone #page-market .market-day-split-opt {
    display: none;
  }

  body.hub-phone #page-market .market-chart-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  body.hub-phone #page-market .market-ohlcv-row {
    gap: 4px 10px;
    font-size: 12px;
  }

  /* —— 计算器 —— */
  body.hub-phone #page-calculator .toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 8px;
  }

  body.hub-phone #page-calculator .toolbar .primary {
    min-height: 32px;
    padding: 4px 12px;
    font-size: 12px;
  }

  body.hub-phone #page-calculator .toolbar .toolbar-meta {
    font-size: 10px;
  }

  body.hub-phone #page-calculator .calc-layout {
    gap: 10px;
  }

  body.hub-phone #page-calculator .calc-card {
    padding: 12px 12px 14px;
  }

  body.hub-phone #page-calculator .calc-card h2 {
    margin: 0 0 6px;
    font-size: 14px;
  }

  body.hub-phone #page-calculator .calc-hint {
    display: none;
  }

  body.hub-phone #page-calculator .calc-form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
  }

  body.hub-phone #page-calculator .calc-field-span2 {
    grid-column: 1 / -1;
  }

  body.hub-phone #page-calculator .calc-market-info {
    font-size: 10px;
    line-height: 1.35;
    padding: 6px 8px;
    max-height: 3.2em;
    overflow: hidden;
  }

  body.hub-phone #page-calculator .calc-field span {
    font-size: 10px;
  }

  body.hub-phone #page-calculator .calc-field input,
  body.hub-phone #page-calculator .calc-field select {
    min-height: 34px;
    padding: 4px 8px;
    font-size: 13px;
  }

  /* 手机折叠条 */
  body.hub-phone .hub-m-fold {
    margin: 0 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    overflow: hidden;
  }

  body.hub-phone .hub-m-fold > .hub-m-fold-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
  }

  body.hub-phone .hub-m-fold > .hub-m-fold-summary::after {
    content: "▾";
    color: var(--muted);
    font-size: 12px;
    transition: transform 0.15s;
  }

  body.hub-phone .hub-m-fold[open] > .hub-m-fold-summary::after {
    transform: rotate(180deg);
  }

  body.hub-phone .hub-m-fold-meta {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    font-size: 10px;
    font-weight: 500;
    font-family: var(--mono);
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.hub-phone .hub-m-fold .toolbar,
  body.hub-phone .hub-m-fold .market-toolbar {
    margin-bottom: 0;
    border: none;
    border-top: 1px solid var(--border-soft);
    border-radius: 0;
    box-shadow: none;
  }

  /* 计算器手机 Tab */
  body.hub-phone .calc-mobile-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 0 0 10px;
  }

  body.hub-phone .calc-m-tab {
    min-height: 38px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--nav-bg, rgba(255, 255, 255, 0.03));
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }

  body.hub-phone .calc-m-tab.is-active {
    color: var(--accent, #6ea8ff);
    border-color: color-mix(in srgb, var(--accent, #6ea8ff) 45%, var(--border-soft));
    background: var(--accent-dim, rgba(110, 168, 255, 0.12));
  }

  body.hub-phone .calc-layout[data-calc-tab="trend"] [data-calc-pane="roll"],
  body.hub-phone .calc-layout[data-calc-tab="roll"] [data-calc-pane="trend"] {
    display: none;
  }

  body.hub-phone .calc-layout {
    grid-template-columns: 1fr;
  }

  body.hub-phone #page-calculator .calc-card h2 {
    display: none;
  }

  /* 行情全屏:竖屏提示转横;横屏吃满 */
  @media (orientation: portrait) {
    body.hub-phone.market-chart-fs-open .market-chart-wrap.is-fullscreen::before {
      content: "全屏看图请横持手机";
      position: absolute;
      top: max(10px, env(safe-area-inset-top));
      left: 50%;
      transform: translateX(-50%);
      z-index: 5;
      padding: 6px 12px;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.72);
      color: #fff;
      font-size: 12px;
      pointer-events: none;
    }
  }

  @media (orientation: landscape) {
    body.hub-phone.market-chart-fs-open .app-header,
    body.hub-phone.market-chart-fs-open .hub-mobile-tabbar {
      display: none !important;
    }
  }

  .hub-mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    height: calc(var(--hub-m-tabbar-h) + env(safe-area-inset-bottom));
    padding: 0 max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom)
      max(8px, env(safe-area-inset-left));
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
    background: color-mix(in srgb, var(--panel, #12161f) 92%, transparent);
    border-top: 1px solid var(--border-soft);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-sizing: border-box;
  }

  .hub-mobile-tabbar .hub-m-tab.nav-hidden {
    display: none !important;
  }

  .hub-m-tab {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 6px 2px;
    padding: 0 4px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--nav-link-idle, var(--muted));
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .hub-m-tab:hover,
  .hub-m-tab:focus-visible {
    color: var(--text);
    background: var(--nav-link-hover-bg, rgba(255, 255, 255, 0.04));
    outline: none;
  }

  .hub-m-tab.active {
    color: var(--accent, #6ea8ff);
    background: var(--accent-dim, rgba(110, 168, 255, 0.12));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #6ea8ff) 35%, transparent);
  }

  body.hub-phone #toast {
    bottom: calc(var(--hub-m-tabbar-h) + max(12px, env(safe-area-inset-bottom)));
  }

  /* 更多抽屉 */
  body.hub-mobile-more-open .hub-mobile-more {
    display: block;
  }

  .hub-mobile-more {
    position: fixed;
    inset: 0;
    z-index: 90;
  }

  .hub-mobile-more-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
  }

  .hub-mobile-more-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(78vh, 560px);
    overflow: auto;
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    background: var(--panel, #12161f);
    border: 1px solid var(--border-soft);
    border-bottom: none;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
  }

  .hub-mobile-more-handle {
    width: 36px;
    height: 4px;
    margin: 2px auto 12px;
    border-radius: 999px;
    background: var(--border);
  }

  .hub-mobile-more-title {
    margin: 0 0 4px;
    font-size: 1rem;
  }

  .hub-mobile-more-hint {
    margin: 0 0 14px;
    font-size: 11px;
    color: var(--muted);
  }

  .hub-mobile-more-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .hub-mobile-more-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 8px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: var(--nav-bg, rgba(255, 255, 255, 0.03));
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
  }

  .hub-mobile-more-nav a.nav-hidden {
    display: none !important;
  }

  .hub-mobile-more-nav a.active {
    border-color: color-mix(in srgb, var(--accent, #6ea8ff) 45%, var(--border-soft));
    background: var(--accent-dim, rgba(110, 168, 255, 0.12));
    color: var(--accent, #6ea8ff);
  }

  .hub-mobile-more-close {
    width: 100%;
    margin-top: 14px;
    min-height: 44px;
  }

  /* AI 页为底栏让位;键盘打开时藏底栏 */
  body.hub-page-ai.hub-phone .app-shell {
    padding-bottom: calc(var(--hub-m-tabbar-h) + max(8px, env(safe-area-inset-bottom)));
  }

  body.hub-page-ai.hub-phone.hub-ai-keyboard-open .hub-mobile-tabbar {
    display: none;
  }

  body.hub-page-ai.hub-phone.hub-ai-keyboard-open .app-shell {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  body.hub-page-ai.hub-phone .app-header .top-nav {
    display: none !important;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 12px;
  }

  .brand-title {
    font-size: 13px;
  }

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

  .card-actions .btn-link,
  .card-actions button {
    flex: 1 1 100%;
  }

  .fs-head-actions {
    grid-template-columns: 1fr;
  }

  .pos-action-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .pos-action-group .btn-sm {
    width: 100%;
    min-height: 44px;
  }

  .data-table .td-actions {
    white-space: normal;
  }
}

/* ---------- 行情区 ---------- */
.market-toolbar {
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.market-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--muted);
}

.market-field select,
.market-field input {
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font);
}

.market-status {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 10px;
}

.market-status.err {
  color: var(--red);
}

.market-status.warn {
  color: #ffb84d;
}

.market-countdown {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.market-countdown.market-tf-key-hint {
  color: #ffb84d;
}

.market-chart-wrap {
  display: flex;
  flex-direction: column;
  height: min(76vh, 680px);
  min-height: 380px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--chart-surface);
  overflow: hidden;
}

.market-chart-wrap.has-pos-panel {
  height: min(80vh, 740px);
  min-height: 440px;
}

.market-chart-wrap.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 8500;
  width: 100vw;
  height: 100vh !important;
  max-height: none;
  min-height: 0;
  border-radius: 0;
  border: none;
}

.market-chart-wrap.is-fullscreen.has-pos-panel {
  height: 100vh !important;
}

.market-chart-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.market-day-split-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
  white-space: nowrap;
}

.market-day-split-opt:hover {
  color: var(--text);
  border-color: var(--border);
}

.market-day-split-opt input {
  accent-color: #3b82f6;
}

.market-day-split-opt:has(input:checked) {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.45);
}

.market-ind-menu {
  position: relative;
  font-size: 0.72rem;
}

.market-ind-menu summary {
  cursor: pointer;
  list-style: none;
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
  color: var(--muted);
  user-select: none;
}

.market-ind-menu summary::-webkit-details-marker {
  display: none;
}

.market-ind-menu[open] summary {
  color: var(--accent);
  border-color: rgba(0, 255, 157, 0.35);
}

.market-ind-options {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 168px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.market-ind-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
}

.market-ind-opt input {
  accent-color: var(--accent);
}

.market-fs-btn,
.market-fs-exit {
  font-size: 0.72rem;
  padding: 2px 10px;
}

.market-fs-exit {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 12;
}

.market-chart-wrap.is-fullscreen .market-fs-exit:not(.hidden) {
  display: inline-flex !important;
}

.market-chart-wrap.is-fullscreen .market-fs-btn {
  display: none;
}

.market-fs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}

.market-fs-toolbar.hidden {
  display: none;
}

.market-fs-field.market-field-symbol .market-symbol-wrap {
  min-width: 180px;
}

.market-fs-field span {
  font-size: 0.68rem;
  color: var(--muted);
}

.market-fs-field select,
.market-fs-field input {
  font-size: 0.78rem;
  min-width: 100px;
}

.market-div-legend {
  margin-top: 4px;
  font-size: 0.72rem;
  color: #ffb84d;
  line-height: 1.4;
}

.market-div-legend.hidden {
  display: none;
}

.market-ohlcv-bar {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--chart-bar-bg);
  font-size: 0.78rem;
}

.market-chart-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
  position: relative;
}

.market-draw-toolbar {
  flex: 0 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-right: 1px solid var(--border-soft);
  background: var(--chart-bar-bg);
  z-index: 4;
  overflow-y: auto;
}

.market-draw-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.market-draw-btn svg {
  width: 18px;
  height: 18px;
}

.market-draw-btn-text {
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font);
}

.market-draw-btn:hover {
  color: var(--text);
  background: var(--inset-surface);
  border-color: var(--border-soft);
}

.market-draw-btn.is-active {
  color: var(--accent);
  background: rgba(0, 255, 157, 0.1);
  border-color: rgba(0, 255, 157, 0.35);
}

.market-draw-sep {
  width: 22px;
  height: 1px;
  background: var(--border-soft);
  margin: 2px 0;
}

.market-chart-main {
  flex: 1;
  min-width: 0;
  height: 100%;
  position: relative;
  display: flex;
}

.market-chart-host {
  flex: 1;
  min-width: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.market-draw-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  pointer-events: none;
  touch-action: none;
}

.market-draw-canvas.is-drawing {
  cursor: crosshair;
  pointer-events: auto;
}

.market-field-symbol .market-symbol-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}

.market-field-symbol .market-symbol-wrap > input {
  flex: 1;
  min-width: 120px;
}

.market-vol-rank-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--inset-surface);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font);
  white-space: nowrap;
  cursor: pointer;
}

.market-scan-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 0 0 auto;
}

.market-scan-tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--inset-surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font);
  white-space: nowrap;
  cursor: pointer;
}

.market-scan-tab:hover {
  border-color: rgba(0, 255, 157, 0.35);
  color: var(--text);
}

.market-scan-tab.is-active {
  border-color: rgba(0, 255, 157, 0.45);
  background: rgba(0, 255, 157, 0.12);
  color: var(--accent);
}

.market-vol-rank-btn:hover {
  border-color: rgba(0, 255, 157, 0.35);
  background: rgba(0, 255, 157, 0.08);
}

.market-vol-rank-btn.is-active {
  border-color: rgba(0, 255, 157, 0.45);
  background: rgba(0, 255, 157, 0.12);
  color: var(--accent);
}

.market-vol-rank-anchor {
  margin: -6px 0 12px;
}

.market-vol-rank-anchor:empty,
.market-vol-rank-anchor-fs:empty {
  display: none;
}

.market-vol-rank-sheet {
  padding: 10px 12px 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--glow);
}

.market-chart-wrap .market-vol-rank-sheet {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  box-shadow: none;
}

.market-chart-wrap.is-fullscreen .market-vol-rank-sheet {
  background: var(--chart-bar-bg);
}

.market-vol-rank-sheet.hidden {
  display: none;
}

.market-vol-rank-meta {
  padding: 0 10px 6px;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.35;
}

.market-vol-rank-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 2px 12px;
  max-height: 200px;
  overflow: auto;
}

.market-vol-rank-list.is-div-scan-list {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 8px;
  max-height: min(52vh, 420px);
  padding: 4px 2px 8px;
}

.market-vol-rank-li {
  list-style: none;
  min-width: 0;
}

.market-div-scan-meta-title,
.div-scan-meta-title {
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 600;
}

.market-div-scan-meta-sub,
.div-scan-meta-sub {
  margin-top: 2px;
  font-size: 0.68rem;
  color: var(--muted);
}

.market-vol-rank-item.is-div-scan {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--inset-surface);
  min-height: 4.5rem;
}

.market-vol-rank-item.is-div-scan:hover {
  border-color: rgba(0, 255, 157, 0.28);
  background: rgba(0, 255, 157, 0.06);
}

.market-vol-rank-item.is-div-scan.is-active {
  border-color: rgba(0, 255, 157, 0.45);
  background: rgba(0, 255, 157, 0.1);
}

.div-scan-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.div-scan-head {
  gap: 10px;
}

.div-scan-head .market-vol-rank-sym {
  font-size: 0.92rem;
  font-weight: 700;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.div-scan-head .market-vol-rank-no {
  font-size: 0.72rem;
}

.div-scan-head .market-vol-rank-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
}

.div-scan-sub {
  gap: 10px;
  padding-left: 2px;
}

.div-scan-dir {
  font-size: 0.8rem;
  font-weight: 600;
}

.div-scan-dir.is-bull {
  color: #4cd97f;
}

.div-scan-dir.is-bear {
  color: #ff7a9a;
}

.div-scan-dir.is-split {
  color: #b8bcc4;
}

.div-scan-fresh {
  font-size: 0.72rem;
  color: var(--muted);
}

.div-scan-split-detail {
  font-size: 0.72rem;
  color: #b8bcc4;
}

.div-scan-tf-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: auto;
}

.div-scan-tf-pill {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.market-vol-rank-item {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
}

.market-vol-rank-item:hover {
  background: var(--inset-surface);
}

.market-vol-rank-item.is-active {
  background: rgba(0, 255, 157, 0.1);
  color: var(--accent);
}

.market-vol-rank-item.confluence-c1 {
  border-left: 3px solid #6b8cae;
}

.market-vol-rank-item.confluence-c2 {
  border-left: 3px solid #e6a23c;
}

.market-vol-rank-item.confluence-c3 {
  border-left: 3px solid #ff4d8d;
}

.market-vol-rank-item.confluence-split {
  border-left: 3px solid #8a8f98;
}

.market-vol-rank-item.is-div-scan.confluence-c1,
.market-vol-rank-item.is-div-scan.confluence-c2,
.market-vol-rank-item.is-div-scan.confluence-c3,
.market-vol-rank-item.is-div-scan.confluence-split {
  border-left-width: 4px;
}

.market-vol-rank-badge {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  white-space: nowrap;
}

.market-vol-rank-badge.confluence-c1 {
  background: rgba(107, 140, 174, 0.22);
  color: #9eb8d4;
}

.market-vol-rank-badge.confluence-c2 {
  background: rgba(230, 162, 60, 0.2);
  color: #f0c070;
}

.market-vol-rank-badge.confluence-c3 {
  background: rgba(255, 77, 141, 0.18);
  color: #ff8cb8;
}

.market-vol-rank-badge.confluence-split {
  background: rgba(138, 143, 152, 0.22);
  color: #b8bcc4;
}

.market-vol-rank-div {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.market-vol-rank-no {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.market-vol-rank-sym {
  font-weight: 600;
}

.market-vol-rank-vol {
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.market-draw-menu {
  position: fixed;
  z-index: 1200;
  min-width: 168px;
  padding: 4px 0;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--panel-bg, #1a1f2e);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.market-draw-menu.hidden {
  display: none;
}

.market-draw-menu-head {
  padding: 6px 12px 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: none;
}

.market-draw-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
}

.market-draw-menu-item:hover:not(:disabled) {
  background: var(--inset-surface);
}

.market-draw-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.market-draw-menu-item.is-danger {
  color: #f87171;
}

.market-draw-menu-sep {
  border: 0;
  border-top: 1px solid var(--border-soft);
  margin: 4px 0;
}

.market-draw-menu-kbd {
  margin-left: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--inset-surface);
  color: var(--muted);
  font-size: 0.68rem;
}

.market-exchange-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center center;
  font-family: var(--font-display, var(--font));
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  opacity: 0.22;
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
}

.market-exchange-badge:empty {
  display: none;
}

.market-ohlcv-title {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.mkt-exchange-tag {
  padding: 1px 8px;
  border-radius: 4px;
  background: rgba(0, 255, 157, 0.12);
  border: 1px solid rgba(0, 255, 157, 0.35);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 600;
}

.mkt-exchange-tag:empty {
  display: none;
}

.market-ohlcv-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  font-weight: 600;
}

.market-ohlcv-row .ohlcv-item {
  white-space: nowrap;
}

.market-ohlcv-row .k {
  color: var(--muted);
  margin-right: 4px;
}

.market-pos-panel {
  flex: 0 0 auto;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--chart-bar-bg);
  color: var(--text);
  font-size: 0.8rem;
}

.market-pos-panel.hidden {
  display: none;
}

.market-pos-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
}

.market-pos-side {
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.market-pos-side.side-long {
  background: rgba(0, 255, 157, 0.12);
  border: 1px solid rgba(0, 255, 157, 0.35);
  color: var(--green);
}

.market-pos-side.side-short {
  background: rgba(255, 77, 109, 0.12);
  border: 1px solid rgba(255, 77, 109, 0.35);
  color: var(--red);
}

.market-pos-clear {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 8px;
}

.market-pos-pnl {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.market-pos-pnl.pnl-up {
  color: #3ddc84;
}

.market-pos-pnl.pnl-down {
  color: #ff7070;
}

.market-pos-panel .ohlcv-item {
  font-weight: 600;
  color: var(--text);
}

.market-pos-panel .ohlcv-item .k {
  font-weight: 600;
  color: var(--muted);
}

.market-pos-orders {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 6px;
  color: var(--text);
  font-weight: 500;
}

.market-pos-orders-empty {
  font-size: 0.72rem;
  opacity: 0.75;
}

.market-pos-order {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--inset-surface);
  border: 1px solid var(--border-soft);
  white-space: nowrap;
  font-weight: 500;
}

.market-pos-order-kind {
  color: var(--accent);
  font-size: 0.68rem;
}

.market-pos-order-label {
  color: var(--text);
}

.market-pos-order-price {
  color: #c98a20;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
}

.market-pos-order-amt {
  color: var(--muted);
  font-size: 0.68rem;
}

.market-pos-tp-monitored {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
}

.sym-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sym-link:hover {
  color: #00ff9d;
}

.pos-symbol-link {
  display: inline;
}

.pos-symbol-link strong {
  font-weight: inherit;
}

.market-price-tag {
  position: absolute;
  right: 0;
  z-index: 5;
  pointer-events: none;
  padding: 4px 8px;
  border-radius: 4px 0 0 4px;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  transform: translateY(-50%);
  min-width: 72px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.market-price-tag-head {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.market-price-tag-label {
  font-size: 0.62rem;
  font-weight: 500;
  opacity: 0.9;
  line-height: 1;
}

.market-price-tag.is-up .market-price-tag-label {
  color: rgba(10, 16, 24, 0.75);
}

.market-price-tag.is-down .market-price-tag-label {
  color: rgba(255, 255, 255, 0.85);
}

.market-price-tag.hidden {
  display: none;
}

.market-price-tag.is-up {
  background: #00ff9d;
  color: #0a1018;
}

.market-price-tag.is-down {
  background: #ff4d6d;
  color: #fff;
}

.market-price-tag-value {
  font-variant-numeric: tabular-nums;
}

.market-price-tag-time {
  margin-top: 3px;
  font-size: 0.68rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  opacity: 0.95;
}

.market-price-auto {
  position: absolute;
  right: 8px;
  bottom: 10px;
  z-index: 5;
  width: auto;
  padding: 4px 8px;
  font-size: 0.68rem;
  font-family: var(--font);
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: var(--chart-bar-bg);
  color: var(--muted);
  cursor: pointer;
  line-height: 1.2;
}

.market-price-auto:hover {
  border-color: var(--accent);
  color: var(--text);
}

.market-price-auto.is-on {
  color: var(--green);
  border-color: rgba(0, 255, 157, 0.45);
  background: rgba(0, 255, 157, 0.1);
}

.market-chart-wrap.is-fullscreen {
  background: var(--bg);
}

.market-chart-wrap.is-fullscreen .market-ohlcv-bar,
.market-chart-wrap.is-fullscreen .market-fs-toolbar {
  background: var(--chart-bar-bg);
}

/* —— 亮色主题:对比度与全屏/放大 —— */
html[data-theme="light"] .app-bg,
html[data-theme="light"] .login-bg {
  background:
    linear-gradient(rgba(0, 90, 130, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 90, 130, 0.07) 1px, transparent 1px),
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 120, 180, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(80, 70, 180, 0.05), transparent);
  background-size: 48px 48px, 48px 48px, auto, auto;
}

html[data-theme="light"] .app-bg::after,
html[data-theme="light"] .login-bg::after {
  opacity: 0.12;
}

html[data-theme="light"] a:hover {
  text-shadow: none;
}

html[data-theme="light"] .side-long,
html[data-theme="light"] .side-short {
  text-shadow: none;
}

html[data-theme="light"] .top-nav {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 75, 115, 0.18);
  box-shadow: 0 1px 4px rgba(30, 60, 100, 0.08);
}

html[data-theme="light"] .top-nav a.active {
  background: linear-gradient(135deg, rgba(0, 110, 154, 0.14), rgba(91, 79, 199, 0.08));
  color: var(--nav-link-active-fg);
  border-color: rgba(0, 95, 140, 0.28);
  box-shadow: none;
}

html[data-theme="light"] .theme-toggle {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 75, 115, 0.18);
}

html[data-theme="light"] .theme-toggle-btn.is-active {
  color: var(--nav-link-active-fg);
  background: rgba(0, 110, 154, 0.12);
}

html[data-theme="light"] .header-right #btn-logout {
  color: var(--nav-link-idle);
  border-color: rgba(0, 75, 115, 0.18);
}

html[data-theme="light"] .instance-frame-toolbar {
  background: #fff;
}

html[data-theme="light"] .instance-frame-toolbar .ghost {
  color: var(--nav-link-idle);
  border-color: rgba(0, 75, 115, 0.18);
}

html[data-theme="light"] .instance-frame-title {
  color: var(--text);
}

html[data-theme="light"] .mkt-exchange-tag {
  background: rgba(10, 143, 92, 0.1);
  border-color: rgba(10, 143, 92, 0.32);
}

html[data-theme="light"] .market-ind-menu[open] summary {
  border-color: rgba(10, 143, 92, 0.35);
}

html[data-theme="light"] .market-price-auto.is-on {
  border-color: rgba(10, 143, 92, 0.4);
}

html[data-theme="light"] .market-price-tag.is-up {
  background: var(--green);
  color: #fff;
}

html[data-theme="light"] .market-price-tag.is-up .market-price-tag-label {
  color: rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .market-price-tag {
  box-shadow: 0 1px 4px rgba(30, 60, 100, 0.15);
}

html[data-theme="light"] .stat-box {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

html[data-theme="light"] .card-stat-chip.card-stat-key-breakout {
  background: rgba(0, 110, 154, 0.1);
  border-color: rgba(0, 110, 154, 0.28);
}

html[data-theme="light"] .card-stat-chip.card-stat-trend {
  background: rgba(10, 143, 92, 0.1);
  border-color: rgba(10, 143, 92, 0.28);
}

html[data-theme="light"] .card-stat-chip.card-stat-key-watch {
  background: rgba(91, 79, 199, 0.1);
  border-color: rgba(91, 79, 199, 0.28);
}

html[data-theme="light"] .hub-pos-card .pos-entrust-btn {
  background: rgba(0, 110, 154, 0.1);
  color: var(--accent);
  border-color: var(--border-soft);
}

html[data-theme="light"] .hub-pos-card .pos-value.pnl-pos {
  text-shadow: none;
}

html[data-theme="light"] .exchange-fullscreen-panel,
html[data-theme="light"] .modal-panel {
  box-shadow: var(--shadow);
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-soft);
}

html[data-theme="light"] .hub-tile,
html[data-theme="light"] .card,
html[data-theme="light"] .hub-pos-card,
html[data-theme="light"] .hub-trend-plan-card,
html[data-theme="light"] .settings-row {
  box-shadow: 0 2px 10px rgba(30, 60, 100, 0.08);
}

html[data-theme="light"] button.primary,
html[data-theme="light"] .market-toolbar button.primary,
html[data-theme="light"] #market-load,
html[data-theme="light"] #market-fs-load,
html[data-theme="light"] #btn-monitor-refresh {
  background: #006e9a;
  border-color: #005a82;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 95, 140, 0.28);
}

html[data-theme="light"] button.primary:hover:not(:disabled),
html[data-theme="light"] #market-load:hover:not(:disabled),
html[data-theme="light"] #market-fs-load:hover:not(:disabled),
html[data-theme="light"] #btn-monitor-refresh:hover:not(:disabled) {
  background: #0088b8;
  color: #fff;
  box-shadow: 0 3px 12px rgba(0, 95, 140, 0.35);
}

html[data-theme="light"] .market-pos-panel {
  background: var(--chart-bar-bg);
  color: var(--text);
}

html[data-theme="light"] .market-pos-side.side-long {
  background: rgba(10, 143, 92, 0.12);
  border-color: rgba(10, 143, 92, 0.35);
}

html[data-theme="light"] .market-pos-side.side-short {
  background: rgba(201, 53, 82, 0.1);
  border-color: rgba(201, 53, 82, 0.35);
}

html[data-theme="light"] .market-pos-order {
  background: var(--inset-surface-strong);
}

html[data-theme="light"] .market-pos-order-price {
  color: #9a6b10;
}

html[data-theme="light"] .market-pos-pnl.pnl-up {
  color: #0a7a3d;
}

html[data-theme="light"] .market-pos-pnl.pnl-down {
  color: #c62828;
}

html[data-theme="light"] .market-pos-clear {
  font-weight: 600;
  color: var(--text);
  border-color: var(--border);
  background: var(--bg-elevated);
}

html[data-theme="light"] .market-status {
  font-weight: 600;
  color: var(--text);
  opacity: 0.88;
}

html[data-theme="light"] .toolbar-meta {
  font-weight: 600;
  color: var(--text);
  opacity: 0.85;
}

html[data-theme="light"] .chk-label {
  font-weight: 600;
  color: var(--text);
}

html[data-theme="light"] .hub-trend-plan-card .plan-dca-table {
  font-size: 0.8rem;
}

html[data-theme="light"] .hub-trend-plan-card .plan-dca-table th {
  font-weight: 700;
  color: var(--text);
}

html[data-theme="light"] button.danger {
  font-weight: 600;
  background: rgba(201, 53, 82, 0.1);
  border-color: rgba(201, 53, 82, 0.45);
}

/* --- Hub AI 教练(整页一屏,内容区内滚动)--- */
body.hub-page-ai {
  overflow: hidden;
  height: 100dvh;
  max-height: 100dvh;
}
body.hub-page-ai .app-shell {
  padding-bottom: 12px;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
body.hub-page-ai .app-shell > #page-ai {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.hub-page-ai .app-header {
  flex-shrink: 0;
  margin-bottom: 4px;
}
body.hub-page-ai #page-ai {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#page-ai .page-head {
  flex-shrink: 0;
  margin: 8px 0 10px;
}
#page-ai .page-head h1 {
  margin-bottom: 4px;
  font-size: 18px;
}
#page-ai .page-desc {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}
.ai-layout .ai-chat-panel {
  flex: 1 1 auto;
  min-height: 0;
}
.ai-mobile-tabs {
  display: none;
}

/* 手机 AI:须在 .ai-layout 双列定义之后,避免被覆盖成半屏 */
@media (max-width: 720px), ((display-mode: standalone) and (max-width: 960px)) {
  html:has(body.hub-page-ai) {
    height: 100%;
    overflow: hidden;
  }

  body.hub-page-ai .app-shell {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    height: var(--hub-vvh, 100dvh);
    max-height: var(--hub-vvh, 100dvh);
    overflow: hidden;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    will-change: transform, height;
  }

  body.hub-page-ai {
    position: fixed;
    inset: 0;
    width: 100%;
    overflow: hidden;
    background: var(--bg);
    overscroll-behavior: none;
  }

  body.hub-page-ai .app-header {
    padding: 6px 0;
    margin-bottom: 2px;
    gap: 8px;
  }

  body.hub-page-ai .top-nav a {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 11px;
  }

  body.hub-page-ai .app-header .brand {
    display: none;
  }

  body.hub-page-ai .header-right {
    grid-template-columns: 1fr auto auto;
    grid-template-rows: auto;
  }

  body.hub-page-ai .header-right .top-nav {
    grid-column: 1 / -1;
    order: 2;
  }

  body.hub-page-ai.hub-ai-keyboard-open .app-header .theme-toggle,
  body.hub-page-ai.hub-ai-keyboard-open .app-header .sys-pill,
  body.hub-page-ai.hub-ai-keyboard-open .app-header #btn-logout {
    display: none;
  }

  body.hub-page-ai.hub-ai-keyboard-open .app-header {
    padding: 4px 0;
    margin-bottom: 0;
  }

  body.hub-page-ai.hub-ai-keyboard-open .top-nav a {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 10px;
  }

  body.hub-page-ai #page-ai {
    overflow: hidden;
    width: 100%;
    min-width: 0;
  }

  body.hub-page-ai .ai-mobile-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 6px;
    flex-shrink: 0;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 12;
    padding: 4px 0 2px;
    background: var(--bg);
  }

  body.hub-page-ai .ai-mobile-tab {
    min-height: 38px;
    padding: 6px 4px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    background: var(--inset-surface);
    color: var(--muted);
    font-family: var(--font);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    text-align: center;
  }

  body.hub-page-ai .ai-mobile-tab-action {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border-soft));
  }

  body.hub-page-ai .ai-mobile-tab.is-active {
    color: var(--text);
    border-color: var(--accent);
    background: var(--accent-dim);
    box-shadow: none;
  }

  body.hub-page-ai #page-ai .page-head {
    display: none;
  }

  body.hub-page-ai .ai-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    min-height: 0;
    gap: 0;
    overflow: hidden;
  }

  body.hub-page-ai .ai-layout[data-ai-mobile-tab="trading"] .ai-chat-panel,
  body.hub-page-ai .ai-layout[data-ai-mobile-tab="general"] .ai-chat-panel,
  body.hub-page-ai .ai-layout[data-ai-mobile-tab="supervisor"] .ai-chat-panel,
  body.hub-page-ai .ai-layout[data-ai-mobile-tab="history"] .ai-chat-panel {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    min-width: 0;
  }

  body.hub-page-ai .ai-layout[data-ai-mobile-tab="trading"] .ai-chat-history-panel,
  body.hub-page-ai .ai-layout[data-ai-mobile-tab="general"] .ai-chat-history-panel,
  body.hub-page-ai .ai-layout[data-ai-mobile-tab="supervisor"] .ai-chat-history-panel {
    display: none !important;
  }

  body.hub-page-ai .ai-layout[data-ai-mobile-tab="trading"] .ai-chat-main,
  body.hub-page-ai .ai-layout[data-ai-mobile-tab="general"] .ai-chat-main,
  body.hub-page-ai .ai-layout[data-ai-mobile-tab="supervisor"] .ai-chat-main {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
  }

  body.hub-page-ai .ai-layout[data-ai-mobile-tab="history"] .ai-chat-main,
  body.hub-page-ai .ai-layout[data-ai-mobile-tab="history"] .ai-chat-topbar {
    display: none !important;
  }

  body.hub-page-ai .ai-layout[data-ai-mobile-tab="history"] .ai-chat-history-panel {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    border-left: none;
    width: 100%;
  }

  body.hub-page-ai .ai-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 8px 10px;
    gap: 6px;
  }

  body.hub-page-ai .ai-chat-panel {
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: none;
    background: transparent;
  }

  body.hub-page-ai .ai-chat-topbar {
    display: none;
  }

  body.hub-page-ai .ai-bot-tab {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 0.76rem;
  }

  body.hub-page-ai .ai-bot-tab.is-active {
    box-shadow: none;
  }

  body.hub-page-ai .ai-chat-new-btn {
    min-height: 34px;
    padding: 5px 10px;
    font-size: 0.76rem;
  }

  body.hub-page-ai .ai-chat-split {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    border: none;
    border-radius: 0;
  }

  body.hub-page-ai .ai-chat-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  body.hub-page-ai .ai-chat-session-head {
    display: none;
  }

  body.hub-page-ai .ai-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    padding: 4px 2px 8px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.hub-page-ai .ai-layout[data-ai-mobile-tab="history"] .ai-chat-history-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.hub-page-ai .ai-chat-form {
    position: relative;
    flex-shrink: 0;
    z-index: 3;
    width: 100%;
    margin: 0;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    background: var(--panel);
    border-top: 1px solid var(--border-soft);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.12);
  }

  body.hub-page-ai .ai-chat-compose {
    gap: 6px;
  }

  body.hub-page-ai .ai-chat-form textarea {
    min-height: 40px;
    max-height: 96px;
    font-size: 16px;
    width: 100%;
    padding: 8px 10px;
  }

  body.hub-page-ai .ai-chat-compose-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
  }

  body.hub-page-ai .ai-chat-pending-list {
    width: 100%;
  }

  body.hub-page-ai .ai-chat-upload-btn,
  body.hub-page-ai #btn-ai-chat-send {
    min-height: 40px;
    flex-shrink: 0;
  }

  body.hub-page-ai #btn-ai-chat-send {
    min-width: 72px;
    margin-left: auto;
    font-weight: 600;
  }

  body.hub-page-ai .ai-msg-row-user {
    max-width: 90%;
  }

  body.hub-page-ai .ai-msg-row-coach {
    max-width: 100%;
  }

  body.hub-page-ai .ai-bubble {
    font-size: 0.86rem;
    padding: 9px 11px;
  }

  body.hub-page-ai .ai-msg-role {
    font-size: 0.68rem;
  }

  body.hub-page-ai .ai-chat-history-list {
    padding: 6px 4px;
  }

  body.hub-page-ai .ai-chat-history-item {
    padding: 10px 12px;
  }
}

.ai-panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.ai-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.ai-panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-family: var(--display);
  letter-spacing: 0.04em;
}
.ai-panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
}
.ai-meta-line {
  max-width: min(420px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}
.ai-panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.ai-panel-scroll::-webkit-scrollbar {
  width: 6px;
}
.ai-panel-scroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  border-radius: 999px;
}
.ai-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.82rem;
  color: var(--muted);
  flex-shrink: 0;
}
.ai-stat-chip {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--inset-surface);
  border: 1px solid var(--border-soft);
}
.ai-stat-chip strong {
  color: var(--text);
  margin-right: 4px;
}
.ai-stat-chip.pos,
.ai-stat-val.pos {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 35%, transparent);
}
.ai-stat-chip.neg,
.ai-stat-val.neg {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
}
.ai-stat-chip.pos strong,
.ai-stat-chip.neg strong {
  color: inherit;
  opacity: 0.85;
}
.ai-md-body {
  padding: 12px;
  border-radius: 8px;
  background: var(--inset-surface);
  border: 1px solid var(--border-soft);
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ai-md-body.ai-result-md,
.ai-bubble-assistant.ai-result-md {
  white-space: normal;
}
.ai-result-md p {
  margin: 6px 0;
  color: var(--text);
}
.ai-result-md ul,
.ai-result-md ol {
  margin: 6px 0 8px 1.25em;
  padding: 0 0 0 0.25em;
  list-style-position: outside;
}
.ai-result-md ul {
  list-style-type: disc;
}
.ai-result-md ol {
  list-style-type: decimal;
}
.ai-result-md li {
  margin: 5px 0;
  line-height: 1.5;
  display: list-item;
}
.ai-result-md strong {
  color: var(--text);
  font-weight: 600;
}
.ai-md-body.ai-result-md h2 {
  font-size: 1.02rem;
  color: var(--ai-sum-heading);
  font-weight: 700;
  margin: 14px 0 8px;
  padding: 6px 0 6px 10px;
  border-left: 3px solid var(--ai-sum-heading-border);
  border-bottom: 1px solid var(--border-soft);
  background: var(--ai-sum-heading-bg);
  border-radius: 0 4px 4px 0;
}
.ai-md-body.ai-result-md h2:first-child {
  margin-top: 0;
}
.ai-md-body.ai-result-md h3 {
  font-size: 0.92rem;
  color: var(--ai-sum-heading);
  font-weight: 700;
  margin: 16px 0 8px;
  padding: 5px 0 5px 10px;
  border-left: 3px solid var(--ai-sum-heading-border);
  border-bottom: 1px solid var(--border-soft);
  background: var(--ai-sum-heading-bg);
  border-radius: 0 4px 4px 0;
}
.ai-md-body.ai-result-md h3:first-of-type {
  margin-top: 4px;
}
.ai-md-body.ai-result-md h4 {
  font-size: 0.92rem;
  color: var(--ai-sum-heading);
  font-weight: 700;
  margin: 10px 0 6px;
  padding: 4px 0 4px 8px;
  border-left: 2px solid var(--ai-sum-heading-border);
  background: var(--ai-sum-heading-bg);
  border-radius: 0 4px 4px 0;
}
.ai-result-md h2 {
  font-size: 1.02rem;
  color: var(--accent-2, var(--accent));
  margin: 14px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}
.ai-result-md h3,
.ai-result-md h4 {
  font-size: 0.92rem;
  color: var(--accent-2, var(--accent));
  margin: 10px 0 6px;
}
.ai-result-md code {
  background: color-mix(in srgb, var(--inset-surface) 70%, var(--border-soft));
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.82em;
}
.ai-result-md .md-raw-block-title {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
  color: var(--muted);
  font-weight: 600;
}
.ai-bubble-assistant.ai-result-md p {
  margin: 4px 0;
}
.ai-bubble-assistant.ai-result-md h2,
.ai-bubble-assistant.ai-result-md h3,
.ai-bubble-assistant.ai-result-md h4 {
  margin: 8px 0 4px;
  font-size: 0.92rem;
  color: var(--accent);
  border-bottom: none;
  padding-bottom: 0;
}
.ai-bubble-assistant.ai-result-md strong {
  color: var(--accent);
}
.ai-bubble-assistant.ai-result-md ul,
.ai-bubble-assistant.ai-result-md ol {
  margin: 4px 0 6px 1.15em;
  padding-left: 0.25em;
  list-style-position: outside;
}
.ai-bubble-assistant.ai-result-md ul {
  list-style-type: disc;
}
.ai-bubble-assistant.ai-result-md ol {
  list-style-type: decimal;
}
.ai-bubble-assistant.ai-result-md li {
  display: list-item;
}
.ai-ac-table-wrap {
  margin: 8px 0 12px;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: color-mix(in srgb, var(--inset-surface) 88%, transparent);
}
.ai-ac-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  line-height: 1.45;
}
.ai-ac-table th,
.ai-ac-table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border-soft);
}
.ai-ac-table th {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: color-mix(in srgb, var(--inset-surface) 60%, transparent);
  white-space: nowrap;
}
.ai-ac-table tbody tr:last-child td {
  border-bottom: none;
}
.ai-ac-table tbody tr:hover td {
  background: color-mix(in srgb, var(--accent-dim) 35%, transparent);
}
.ai-ac-name {
  min-width: 9rem;
  font-weight: 600;
  color: var(--ai-sum-name);
}
.ai-ac-remark {
  color: var(--muted);
  font-size: 0.74rem;
  max-width: 16rem;
}
.ai-ac-unmon {
  color: var(--muted);
}
.ai-ac-err {
  color: var(--red);
}
.ai-ac-warn {
  color: var(--amber, #d4a017);
}
.ai-ac-table .ai-stat-val.pos {
  color: var(--green);
  font-weight: 600;
}
.ai-ac-table .ai-stat-val.neg {
  color: var(--red);
  font-weight: 600;
}
.ai-placeholder {
  color: var(--muted);
  margin: 0;
}
.ai-chat-panel {
  gap: 8px;
}
.ai-chat-panel .ai-chat-split {
  flex: 1 1 auto;
}
.ai-chat-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ai-chat-topbar .ai-bot-bar {
  flex: 1 1 auto;
  min-width: 0;
}
.ai-chat-new-btn {
  flex-shrink: 0;
  white-space: nowrap;
}
.ai-chat-session-head {
  padding-bottom: 2px;
}
.ai-chat-session-head h2 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-bot-bar {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  padding-bottom: 0;
}
.ai-bot-tab {
  flex: 1;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--inset-surface);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ai-bot-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}
.ai-bot-tab.is-active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: var(--glow);
}
.ai-chat-split {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}
.ai-chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.ai-chat-history-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-left: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--inset-surface) 65%, var(--panel));
}
.ai-chat-history-head {
  flex-shrink: 0;
  padding: 10px 12px 6px;
  border-bottom: 1px solid var(--border-soft);
}
.ai-chat-history-head h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.ai-chat-history-list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-chat-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.ai-chat-history-item:hover {
  border-color: var(--accent);
}
.ai-chat-history-item.is-active {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: var(--glow);
}
.ai-chat-history-item-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ai-chat-history-item-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chat-history-item-preview {
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chat-history-item-meta {
  font-size: 0.68rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.ai-chat-history-badge {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  border: 1px solid var(--border-soft);
  color: var(--muted);
}
.ai-chat-history-badge.trading {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border-soft));
}
.ai-chat-history-badge.supervisor {
  color: #c27803;
  border-color: color-mix(in srgb, #c27803 45%, var(--border-soft));
}
.ai-msg-row-system {
  justify-content: flex-start;
}
.ai-bubble-system {
  background: color-mix(in srgb, var(--surface-2) 88%, #c27803 12%);
  border: 1px solid color-mix(in srgb, var(--border-soft) 70%, #c27803 30%);
  font-size: 0.92rem;
  white-space: pre-wrap;
}
.ai-bubble-warn {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border-soft));
}
.ai-chat-history-panel.hidden {
  display: none !important;
}
.ai-chat-new-btn.hidden {
  display: none !important;
}
.supervisor-settings-grid {
  margin-top: 0.75rem;
  padding-top: 0.25rem;
}
.ai-chat-history-del {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.ai-chat-history-del:hover {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}
.ai-msg-actions {
  display: flex;
  gap: 6px;
  padding: 0 4px;
}
.ai-msg-copy-btn {
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}
.ai-msg-copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.ai-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 4px 4px;
}
.ai-msg-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
}
.ai-msg-row-user {
  align-self: flex-end;
  align-items: flex-end;
  max-width: 88%;
}
.ai-msg-row-coach {
  align-self: flex-start;
  align-items: flex-start;
  max-width: 92%;
}
.ai-msg-role {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0 4px;
}
.ai-msg-row-user .ai-msg-role {
  color: var(--accent);
}
.ai-msg-row-coach .ai-msg-role {
  color: var(--accent);
}
.ai-bubble {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ai-bubble-user {
  background: var(--accent-dim);
  border: 1px solid var(--border);
}
.ai-bubble-assistant {
  background: var(--inset-surface);
  border: 1px solid var(--border-soft);
}
.ai-bubble-thinking {
  color: var(--muted);
  font-style: italic;
  animation: ai-think-pulse 1.2s ease-in-out infinite;
}
.ai-bubble-error {
  border-color: color-mix(in srgb, var(--red) 55%, var(--border-soft));
  color: var(--red);
}
@keyframes ai-think-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}
.ai-closed-trades-wrap {
  margin: 0 0 12px;
}
.ai-closed-trades-title {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ai-sum-heading);
  padding: 4px 0 4px 8px;
  border-left: 2px solid var(--ai-sum-heading-border);
  background: var(--ai-sum-heading-bg);
  border-radius: 0 4px 4px 0;
}
.ai-msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px;
}
.ai-attach-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--inset-surface);
  border: 1px solid var(--border-soft);
}
.ai-chat-form {
  flex-shrink: 0;
  padding-top: 4px;
  border-top: 1px solid var(--border-soft);
}
.ai-chat-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-chat-compose-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.ai-chat-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--inset-surface);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
}
.ai-chat-upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.ai-chat-pending-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ai-chat-pending-list[hidden] {
  display: none;
}
.ai-chat-pending-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 4px 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--text);
  background: var(--inset-surface);
  border: 1px solid var(--border-soft);
}
.ai-chat-pending-kind {
  flex-shrink: 0;
  font-size: 0.65rem;
  color: var(--muted);
}
.ai-chat-pending-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chat-pending-del {
  flex-shrink: 0;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}
.ai-chat-pending-del:hover {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}
.ai-chat-pending-del:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ai-chat-form textarea {
  width: 100%;
  resize: none;
  min-height: 52px;
  max-height: 88px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--inset-surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
}
.ai-chat-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.ai-chat-form textarea:disabled {
  opacity: 0.65;
}

/* —— 资金概况(科技感 HUD)—— */
body.hub-page-funds .app-bg {
  background:
    linear-gradient(rgba(0, 212, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.045) 1px, transparent 1px),
    radial-gradient(ellipse 70% 45% at 12% 0%, rgba(0, 212, 255, 0.16), transparent 58%),
    radial-gradient(ellipse 55% 40% at 92% 18%, rgba(123, 97, 255, 0.14), transparent 55%),
    radial-gradient(ellipse 50% 35% at 50% 100%, rgba(0, 255, 157, 0.06), transparent 60%);
  background-size: 28px 28px, 28px 28px, auto, auto, auto;
}
html[data-theme="light"] body.hub-page-funds .app-bg {
  background:
    linear-gradient(rgba(0, 110, 154, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 110, 154, 0.06) 1px, transparent 1px),
    radial-gradient(ellipse 70% 45% at 12% 0%, rgba(0, 110, 154, 0.1), transparent 58%),
    radial-gradient(ellipse 55% 40% at 92% 18%, rgba(91, 79, 199, 0.08), transparent 55%);
  background-size: 28px 28px, 28px 28px, auto, auto;
}
body.hub-page-funds #page-funds {
  position: relative;
}
.funds-stage {
  position: relative;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border-soft);
  background: linear-gradient(165deg, rgba(12, 20, 32, 0.72), rgba(8, 14, 26, 0.88));
  box-shadow: var(--glow), var(--shadow);
  overflow: hidden;
}
html[data-theme="light"] .funds-stage {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(240, 246, 252, 0.96));
  box-shadow: var(--shadow);
}
.funds-stage-grid,
.funds-stage-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.funds-stage-grid {
  opacity: 0.35;
  background:
    linear-gradient(rgba(0, 212, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, black 0%, transparent 92%);
}
.funds-stage-glow {
  background:
    radial-gradient(circle at 18% 12%, rgba(0, 212, 255, 0.12), transparent 42%),
    radial-gradient(circle at 82% 8%, rgba(123, 97, 255, 0.1), transparent 38%);
}
.funds-stage-inner {
  position: relative;
  z-index: 1;
  padding: 14px 16px 18px;
}
.funds-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px !important;
}
.funds-head h1 {
  font-family: var(--display);
  letter-spacing: 0.06em;
}
.funds-tag {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.22), rgba(123, 97, 255, 0.18));
  border-color: rgba(0, 212, 255, 0.45);
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.2);
}
.funds-desc-fold {
  margin: 4px 0 0;
  max-width: 100%;
}
.funds-desc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  user-select: none;
  letter-spacing: 0.04em;
}
.funds-desc-toggle::-webkit-details-marker {
  display: none;
}
.funds-desc-toggle::before {
  content: "▸";
  font-size: 0.68rem;
  transition: transform 0.15s ease;
}
.funds-desc-fold[open] .funds-desc-toggle::before {
  transform: rotate(90deg);
}
.funds-desc {
  margin: 8px 0 0;
  color: color-mix(in srgb, var(--muted) 88%, var(--accent));
  letter-spacing: 0.02em;
  line-height: 1.45;
  font-size: 0.78rem;
}
.funds-live-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 212, 255, 0.35);
  background: rgba(0, 212, 255, 0.08);
  font-family: var(--display);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.funds-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: funds-pulse 2s ease-in-out infinite;
}
@keyframes funds-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.88); }
}
.funds-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 14px;
}
.funds-btn-refresh {
  font-family: var(--display);
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}
.funds-pnl-banner {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.28);
}
html[data-theme="light"] .funds-pnl-banner {
  background: rgba(255, 255, 255, 0.82);
}
.funds-pnl-banner.is-pos {
  border-color: color-mix(in srgb, var(--green) 45%, var(--border-soft));
  background: color-mix(in srgb, var(--green) 10%, rgba(0, 0, 0, 0.28));
  box-shadow: inset 0 0 28px color-mix(in srgb, var(--green) 8%, transparent);
}
.funds-pnl-banner.is-neg {
  border-color: color-mix(in srgb, var(--red) 45%, var(--border-soft));
  background: color-mix(in srgb, var(--red) 10%, rgba(0, 0, 0, 0.28));
  box-shadow: inset 0 0 28px color-mix(in srgb, var(--red) 8%, transparent);
}
html[data-theme="light"] .funds-pnl-banner.is-pos {
  background: color-mix(in srgb, var(--green) 8%, rgba(255, 255, 255, 0.9));
}
html[data-theme="light"] .funds-pnl-banner.is-neg {
  background: color-mix(in srgb, var(--red) 8%, rgba(255, 255, 255, 0.9));
}
.funds-pnl-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  min-width: 0;
}
.funds-pnl-label {
  font-family: var(--display);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}
.funds-pnl-value {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.funds-pnl-pct {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.92;
}
.funds-pnl-value.pos,
.funds-pnl-pct.pos,
.funds-pnl-side-val.pos {
  color: var(--green);
}
.funds-pnl-value.neg,
.funds-pnl-pct.neg,
.funds-pnl-side-val.neg {
  color: var(--red);
}
.funds-pnl-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-left: 12px;
  border-left: 1px solid var(--border-soft);
}
.funds-pnl-side-label {
  font-family: var(--display);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}
.funds-pnl-side-val {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 600;
}
.funds-status.err {
  color: var(--red);
}
.funds-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.funds-stat-card-pnl .funds-stat-val {
  font-size: 1.35rem;
}
.funds-stat-sub {
  margin-top: 4px;
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
}
.funds-stat-card {
  position: relative;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow: hidden;
}
html[data-theme="light"] .funds-stat-card {
  background: rgba(255, 255, 255, 0.82);
}
.funds-stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0.75;
}
.funds-stat-card-primary {
  border-color: rgba(0, 212, 255, 0.32);
  box-shadow: inset 0 0 24px rgba(0, 212, 255, 0.06);
}
.funds-stat-card-primary .funds-stat-value {
  font-size: 1.6rem;
}
.funds-stat-label {
  font-family: var(--display);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}
.funds-stat-value,
.funds-stat-val,
.funds-ac-total .v,
.funds-ac-stats .v,
.funds-fs-stat .v {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.funds-stat-value {
  font-size: 1.35rem;
  font-weight: 600;
}
.funds-stat-val {
  font-size: 1.15rem;
  font-weight: 600;
}
.funds-stat-val.pos {
  color: var(--green);
}
.funds-stat-val.neg {
  color: var(--red);
}
.funds-dd-pct {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}
.funds-meta {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: color-mix(in srgb, var(--muted) 90%, var(--accent));
  margin: 0 0 14px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed var(--border-soft);
  background: rgba(0, 0, 0, 0.2);
  letter-spacing: 0.03em;
}
html[data-theme="light"] .funds-meta {
  background: rgba(255, 255, 255, 0.65);
}
.funds-chart-panel {
  margin-bottom: 20px;
  border: 1px solid rgba(0, 212, 255, 0.22);
  border-radius: calc(var(--radius) + 2px);
  background: rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 0 32px rgba(0, 212, 255, 0.04), 0 0 24px rgba(0, 212, 255, 0.06);
  overflow: hidden;
}
html[data-theme="light"] .funds-chart-panel {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 20px rgba(0, 110, 154, 0.04);
}
.funds-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.08), transparent);
}
.funds-chart-tag {
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.funds-chart-sub {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.funds-chart-host {
  height: 300px;
  min-height: 240px;
  background: var(--chart-surface, var(--panel));
  overflow: hidden;
}
.funds-section-head {
  margin-bottom: 12px;
}
.funds-section-title {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.funds-section-mark {
  color: var(--accent-2);
  margin-right: 6px;
}
.funds-section-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.funds-accounts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
  padding: 4px 0 12px;
}
.funds-ac-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(0, 0, 0, 0.34), rgba(12, 20, 32, 0.55));
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  position: relative;
  overflow: hidden;
}
html[data-theme="light"] .funds-ac-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(236, 244, 252, 0.9));
}
.funds-ac-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0.55;
}
.funds-ac-card:hover:not(:disabled) {
  border-color: rgba(0, 212, 255, 0.45);
  box-shadow: 0 0 22px rgba(0, 212, 255, 0.12), 0 0 0 1px var(--accent-dim);
  transform: translateY(-2px);
}
.funds-ac-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.funds-ac-card.is-off {
  opacity: 0.68;
  cursor: default;
}
.funds-ac-card.is-off:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-soft);
}
.funds-ac-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.funds-ac-name {
  margin: 0;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
.funds-ac-badge {
  flex-shrink: 0;
  font-size: 0.66rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  color: var(--muted);
  background: var(--inset-surface);
  white-space: nowrap;
}
.funds-ac-badge.is-ok {
  color: var(--green);
  border-color: rgba(0, 255, 157, 0.28);
  background: rgba(0, 255, 157, 0.08);
}
html[data-theme="light"] .funds-ac-badge.is-ok {
  border-color: rgba(10, 143, 92, 0.28);
  background: rgba(10, 143, 92, 0.08);
}
.funds-ac-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--inset-surface);
  border: 1px solid var(--border-soft);
}
.funds-ac-total .k {
  font-size: 0.72rem;
  color: var(--muted);
}
.funds-ac-total .v {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text);
}
.funds-ac-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  font-size: 0.78rem;
}
.funds-ac-stats .k {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  margin-bottom: 2px;
}
.funds-ac-stats .v {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.funds-ac-stats .v.pos {
  color: var(--green);
}
.funds-ac-stats .v.neg {
  color: var(--red);
}
.funds-ac-foot {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}
.funds-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 12px 0;
}

.funds-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: var(--fs-scrim);
  backdrop-filter: blur(6px);
  overflow: auto;
  padding: 16px 20px 24px;
}
.funds-fullscreen.hidden {
  display: none !important;
}
.funds-fs-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.funds-fs-panel {
  position: relative;
  z-index: 1;
  max-width: min(1200px, 96vw);
  margin: 0 auto;
  background: linear-gradient(165deg, rgba(12, 20, 32, 0.95), rgba(6, 10, 18, 0.98));
  border: 1px solid rgba(0, 212, 255, 0.28);
  border-radius: calc(var(--radius) + 2px);
  padding: 16px 18px 20px;
  box-shadow: 0 0 40px rgba(0, 212, 255, 0.12), 0 12px 40px rgba(0, 0, 0, 0.35);
}
html[data-theme="light"] .funds-fs-panel {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(240, 246, 252, 0.98));
  box-shadow: var(--shadow);
}
.funds-fs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.funds-fs-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.funds-fs-sub {
  margin: 4px 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}
.funds-fs-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.funds-fs-stat {
  background: var(--inset-surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.funds-fs-stat .k {
  font-size: 0.72rem;
  color: var(--muted);
}
.funds-fs-stat .v {
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.funds-fs-stat .v.pos {
  color: var(--green);
}
.funds-fs-stat .v.neg {
  color: var(--red);
}
.funds-fs-chart-host {
  height: min(52vh, 420px);
  min-height: 260px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--chart-surface, var(--panel));
  overflow: hidden;
}
body.funds-fullscreen-open {
  overflow: hidden;
}
@media (max-width: 720px) {
  .funds-accounts {
    grid-template-columns: minmax(0, 1fr);
  }
  .funds-head {
    flex-direction: column;
    align-items: stretch;
  }
  .funds-live-pill {
    align-self: flex-start;
  }
  .funds-stage-inner {
    padding: 12px 12px 14px;
  }
  .funds-chart-host {
    height: 240px;
    min-height: 200px;
  }
}

/* —— 内照明心 —— */
.archive-toolbar {
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 10px;
}
.archive-search-field input {
  min-width: 160px;
}
#archive-btn-chart-toggle.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.archive-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}
.archive-field select,
.archive-field input {
  min-width: 120px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--inset-surface);
  color: var(--text);
  font-family: var(--font);
}
#page-archive .archive-toolbar {
  margin-bottom: 12px;
}
.archive-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}
.archive-content-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.archive-content-tab {
  border: 1px solid var(--border-soft);
  background: transparent;
  color: inherit;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.84rem;
}
.archive-content-tab.is-active {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.55);
  color: var(--text);
}
.archive-quotes-panel,
.archive-main-panel,
.archive-viz-panel,
.archive-calendar-panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  min-width: 0;
}
.archive-tab-panel {
  display: none;
}
.archive-tab-panel.is-active {
  display: flex;
  flex-direction: column;
}
.archive-quotes-panel.is-active {
  gap: 10px;
  padding: 12px;
  overflow: visible;
}
.archive-viz-panel.is-active,
.archive-calendar-panel.is-active {
  gap: 10px;
  padding: 12px;
  overflow: visible;
}
.archive-main-panel.is-active {
  gap: 10px;
  padding: 12px;
  min-height: 0;
}
.archive-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.archive-panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
}
.archive-panel-meta {
  font-size: 0.72rem;
  color: var(--muted);
}
.archive-quote-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.archive-quote-form input[type="date"],
.archive-quote-form textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--inset-surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.82rem;
  resize: vertical;
}
.archive-quote-form textarea {
  min-height: 110px;
}
.archive-quote-day-trades {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--inset-surface);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.archive-quote-day-trades-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.archive-quote-day-trades-head h3 {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
}
.archive-quote-day-trades-body {
  overflow: auto;
  max-height: min(280px, 40vh);
}
.archive-quote-day-trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.archive-quote-day-trades-table th,
.archive-quote-day-trades-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  white-space: nowrap;
}
.archive-quote-day-trades-table th {
  color: var(--muted);
  font-weight: 500;
}
.archive-quotes-list {
  flex: 0 1 auto;
  max-height: min(420px, 50vh);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* —— 语录博客流 —— */
#page-quotes .quotes-toolbar {
  margin-bottom: 14px;
  gap: 10px;
  align-items: center;
}
#page-quotes .quotes-link-archive {
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
}
.quotes-feed {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 820px;
}
.quotes-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.quotes-day-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quotes-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}
.quotes-day-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.quotes-day-summary {
  font-size: 0.8rem;
  color: var(--muted);
}
.quotes-day-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quotes-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quotes-card-body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.quotes-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.quotes-ai-btn {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border-soft));
}
@media (max-width: 720px) {
  .quotes-feed {
    max-width: none;
  }
  .quotes-day-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
.archive-quote-block {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--inset-surface);
  overflow: hidden;
}
.archive-quote-block.is-open {
  border-color: var(--accent);
}
.archive-quote-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.archive-quote-item:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.archive-quote-item.is-selected {
  background: color-mix(in srgb, var(--accent) 12%, var(--inset-surface));
}
.archive-quote-open-hint {
  font-size: 0.7rem;
  color: var(--accent);
  white-space: nowrap;
}
.archive-quote-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 10px 10px;
  border-top: 1px solid var(--border-soft);
}
.archive-quote-detail .archive-quote-full {
  min-height: 120px;
  max-height: none;
  overflow: visible;
}
.archive-quote-date {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--accent);
  white-space: nowrap;
}
.archive-quote-preview {
  font-size: 0.74rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-quote-full {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--panel);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: none;
}
.archive-quote-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.archive-quote-ai-btn {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border-soft));
}
.archive-period-bar {
  flex-wrap: wrap;
}
.archive-period-tabs {
  display: inline-flex;
  gap: 4px;
}
.archive-period-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--inset-surface);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8rem;
}
.archive-period-btn.is-active {
  color: var(--text);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.archive-period-range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.archive-period-range.hidden,
.archive-period-day-input.hidden {
  display: none;
}
.archive-period-sep {
  color: var(--muted);
  font-size: 0.82rem;
}
.archive-stats-card {
  margin-bottom: 14px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.archive-stats-card-head h2 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}
.archive-stats-card .archive-stats-bar {
  border: none;
  background: transparent;
  overflow: auto;
}
.archive-overview-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.archive-overview-panel > .archive-panel-head {
  display: none;
}
.archive-stats-bar {
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--inset-surface);
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.45;
  overflow: auto;
}
.archive-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.archive-stats-table th,
.archive-stats-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  white-space: nowrap;
}
.archive-stats-table th {
  color: var(--muted);
  font-weight: 500;
  background: var(--inset-surface);
}
.archive-stats-table tr:last-child td {
  border-bottom: none;
}
.archive-stats-table tr.archive-stats-total td {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.archive-stats-table .pnl-neg {
  color: var(--loss);
}
.archive-stats-viz-section {
  margin-top: 10px;
}
.archive-stats-charts {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}
.archive-viz-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.archive-viz-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 10px;
  background: var(--archive-viz-kpi-bg);
  border: 1px solid var(--archive-viz-kpi-border);
  min-width: 0;
}
.archive-viz-kpi-val {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.archive-viz-kpi--pnl .archive-viz-kpi-val {
  font-size: 1.2rem;
}
.archive-viz-kpi-lbl {
  font-size: 0.66rem;
  color: var(--muted);
  text-align: center;
}
.archive-viz-kpi--win .archive-viz-ring {
  width: 52px;
  height: 52px;
}
.archive-viz-kpi--win .archive-viz-ring::before {
  inset: 6px;
}
.archive-viz-ring {
  --win-pct: 0;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: conic-gradient(
    var(--archive-profit) 0 calc(var(--win-pct) * 1%),
    var(--archive-loss) calc(var(--win-pct) * 1%) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.archive-viz-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--inset-surface);
}
.archive-viz-ring-label {
  position: relative;
  z-index: 1;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.archive-viz-block-title {
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.archive-viz-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border-radius: 10px;
  background: var(--archive-viz-surface);
  border: 1px solid var(--archive-viz-surface-border);
}
.archive-viz-stacked {
  display: flex;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--archive-viz-track-bg);
}
.archive-viz-stacked-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2px;
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
}
.archive-viz-stacked-seg--profit {
  background: linear-gradient(90deg, color-mix(in srgb, var(--archive-profit) 72%, #000), var(--archive-profit));
}
.archive-viz-stacked-seg--loss {
  background: linear-gradient(90deg, color-mix(in srgb, var(--archive-loss) 72%, #000), var(--archive-loss));
}
.archive-viz-stacked-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 0.68rem;
}
.archive-viz-legend::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
.archive-viz-legend--profit::before {
  background: var(--archive-profit);
}
.archive-viz-legend--loss::before {
  background: var(--archive-loss);
}
.archive-viz-legend--net {
  font-weight: 700;
}
.archive-viz-div-row {
  display: grid;
  grid-template-columns: minmax(4.5em, 7.5em) 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 0.72rem;
}
.archive-viz-div-row .k {
  opacity: 0.9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-viz-div-row .v {
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.archive-viz-div-track {
  position: relative;
  height: 12px;
  border-radius: 4px;
  background: var(--archive-viz-track-bg);
  overflow: hidden;
}
.archive-viz-div-mid {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--archive-viz-mid-line);
  transform: translateX(-50%);
  z-index: 1;
}
.archive-viz-div-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 2px;
  border-radius: 2px;
}
.archive-viz-div-fill--profit {
  background: linear-gradient(90deg, color-mix(in srgb, var(--archive-profit) 72%, #000), var(--archive-profit));
}
.archive-viz-div-fill--loss {
  background: linear-gradient(270deg, color-mix(in srgb, var(--archive-loss) 72%, #000), var(--archive-loss));
}
.archive-viz-hold-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.archive-viz-hold-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: 8px;
  background: var(--archive-viz-kpi-bg);
  border: 1px solid var(--archive-viz-kpi-border);
}
.archive-viz-hold-val {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.archive-viz-hold-card--win .archive-viz-hold-val {
  color: var(--archive-profit);
}
.archive-viz-hold-card--loss .archive-viz-hold-val {
  color: var(--archive-loss);
}
.archive-viz-hold-lbl {
  font-size: 0.64rem;
  color: var(--muted);
}
.archive-viz-bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--archive-viz-track-bg);
  overflow: hidden;
}
.archive-viz-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.archive-viz-bar-fill--profit {
  background: linear-gradient(90deg, color-mix(in srgb, var(--archive-profit) 72%, #000), var(--archive-profit));
}
.archive-viz-bar-fill--loss {
  background: linear-gradient(90deg, color-mix(in srgb, var(--archive-loss) 72%, #000), var(--archive-loss));
}
.archive-viz-empty {
  margin: 0;
  font-size: 0.72rem;
}
.archive-cum-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.archive-cum-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.archive-cum-end {
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.archive-cum-body {
  display: grid;
  grid-template-columns: 3.2em 1fr;
  gap: 6px;
  align-items: stretch;
}
.archive-cum-yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.64rem;
  color: var(--archive-axis-fg);
  font-variant-numeric: tabular-nums;
  padding: 2px 0 14px;
  text-align: right;
}
.archive-cum-plot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.archive-cum-chart {
  width: 100%;
  height: 96px;
  display: block;
  border-radius: 8px;
  background: var(--archive-chart-bg);
  border: 1px solid var(--archive-viz-surface-border);
}
.archive-cum-xaxis {
  display: flex;
  justify-content: space-between;
  font-size: 0.64rem;
  color: var(--archive-axis-fg);
  font-variant-numeric: tabular-nums;
  padding: 0 2px;
}
.archive-cum-foot {
  font-size: 0.66rem;
  line-height: 1.35;
  color: var(--archive-axis-fg);
}
.archive-cum-grid {
  stroke: var(--archive-grid-stroke);
  stroke-width: 1;
}
.archive-cum-grid--zero {
  stroke: var(--archive-grid-zero-stroke);
  stroke-dasharray: 4 4;
}
.archive-cum-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.archive-cum-line--up {
  stroke: var(--archive-profit);
}
.archive-cum-line--down {
  stroke: var(--archive-loss);
}
.archive-cum-dot {
  stroke: color-mix(in srgb, var(--text) 22%, transparent);
  stroke-width: 1;
}
.archive-cum-dot--up {
  fill: var(--archive-profit);
}
.archive-cum-dot--down {
  fill: var(--archive-loss);
}
.archive-cum-dot--last {
  stroke: color-mix(in srgb, var(--text) 28%, transparent);
  stroke-width: 1.5;
}
@media (max-width: 520px) {
  .archive-viz-kpis {
    grid-template-columns: 1fr;
  }
  .archive-viz-div-row {
    grid-template-columns: minmax(3.5em, 5em) 1fr auto;
    gap: 4px;
  }
}
.archive-calendar-section {
  margin-bottom: 10px;
}
.archive-calendar-section .trade-cal-wrap {
  margin-top: 8px;
}
.archive-stats-table .pnl-pos {
  color: #22c55e;
}
.archive-stats-table .pnl-neg {
  color: #ef4444;
}
.archive-acc-section {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--inset-surface);
  overflow: hidden;
}
.archive-acc-summary {
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.archive-acc-summary::-webkit-details-marker {
  display: none;
}
.archive-acc-sub {
  font-weight: 400;
  font-size: 0.76rem;
  color: var(--muted);
}
.archive-calendar-day-trades {
  margin-top: 12px;
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.archive-calendar-day-trades .archive-panel-head h3 {
  margin: 0;
  font-size: 0.9rem;
}
.archive-calendar-day-trades-body {
  overflow: auto;
  max-height: min(360px, 45vh);
}
.archive-chart-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--inset-surface);
  margin-bottom: 10px;
}
.archive-chart-section[hidden] {
  display: none !important;
}
.archive-chart-title-row {
  font-size: 0.78rem;
  color: var(--muted);
}
.archive-chart-section > :not(summary) {
  padding: 0;
}
.archive-trades-section {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.archive-trades-section > .archive-trades {
  border: none;
  border-radius: 0;
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
}
#page-archive.is-chart-open .archive-trades-section > .archive-trades {
  flex: 0 0 auto;
}
.archive-chart-toolbar {
  flex-wrap: wrap;
}
.archive-tf-tabs {
  display: inline-flex;
  gap: 4px;
}
.archive-tf-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--inset-surface);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8rem;
}
.archive-tf-btn.is-active {
  color: var(--text);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.archive-chart-wrap {
  position: relative;
}
.archive-chart-host {
  height: 360px;
  min-height: 280px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.archive-mark-auto {
  position: absolute;
  right: 8px;
  bottom: 10px;
  z-index: 5;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-family: var(--font);
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: var(--chart-bar-bg, var(--inset-surface));
  color: var(--muted);
  cursor: pointer;
  line-height: 1.2;
}
.archive-mark-auto:hover {
  border-color: var(--accent);
  color: var(--text);
}
.archive-mark-auto.is-on {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.1);
}
.archive-trades {
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--panel);
  overscroll-behavior: contain;
}
.archive-trades-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.74rem;
  color: var(--muted);
}
.archive-trades-pager[hidden] {
  display: none !important;
}
.archive-trades-pager .ghost {
  font-size: 0.72rem;
  padding: 2px 8px;
}
.archive-trades-pager .ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.archive-trades-table {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.archive-trades-table .archive-dt {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.archive-trades-table .archive-hold {
  white-space: nowrap;
}
.archive-trades-table .archive-symbol {
  white-space: nowrap;
  font-weight: 500;
}
.archive-review-mark {
  display: inline-block;
  margin-right: 4px;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 0.62rem;
  line-height: 1.4;
  color: #6ab88a;
  background: rgba(106, 184, 138, 0.12);
  vertical-align: middle;
}
.archive-trades-table th,
.archive-trades-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}
.archive-trades-table th {
  color: var(--muted);
  font-weight: 500;
  position: sticky;
  top: 0;
  background: var(--panel);
}
.archive-trade-row {
  cursor: default;
}
#page-archive.is-chart-open .archive-trade-row {
  cursor: pointer;
}
.archive-trade-row.is-active {
  background: color-mix(in srgb, var(--accent) 16%, var(--inset-surface));
  box-shadow: inset 3px 0 0 var(--accent);
}
.archive-trade-row.archive-trade-sick td {
  color: var(--red);
}
.archive-trade-row.archive-trade-sick.is-active {
  background: color-mix(in srgb, var(--accent) 12%, color-mix(in srgb, var(--red) 8%, var(--panel)));
  box-shadow: inset 3px 0 0 var(--accent);
}
.archive-trade-row.archive-trade-sick .archive-tag-select,
.archive-trade-row.archive-trade-sick .archive-note-input {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 40%, var(--border-soft));
}
.archive-trade-row.archive-trade-sick td.pos,
.archive-trade-row.archive-trade-sick td.neg {
  color: var(--red);
}
.archive-actions-cell {
  white-space: nowrap;
}
.archive-actions-cell .archive-chart-btn,
.archive-actions-cell .archive-del-btn {
  margin-right: 6px;
}
.archive-chart-btn {
  padding: 3px 8px;
  font-size: 0.72rem;
  border-radius: 6px;
}
.archive-trades-table td.pos {
  color: #22c55e;
}
.archive-trades-table td.neg {
  color: #ef4444;
}
.archive-del-btn {
  padding: 3px 8px;
  font-size: 0.72rem;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  cursor: pointer;
}
.archive-del-btn:hover {
  background: rgba(239, 68, 68, 0.16);
}
.archive-tag-select,
.archive-note-input {
  width: 100%;
  max-width: 140px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: var(--inset-surface);
  color: var(--text);
  font-size: 0.75rem;
}
.archive-tag-fixed {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}
.archive-tag-fixed.is-tag-sick {
  color: var(--red);
  border: 1px solid color-mix(in srgb, var(--red) 45%, var(--border-soft));
  background: color-mix(in srgb, var(--red) 14%, var(--inset-surface));
}
.archive-tag-select.is-tag-sick {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 45%, var(--border-soft));
  background: color-mix(in srgb, var(--red) 14%, var(--inset-surface));
}
.archive-tag-select.is-tag-emotion {
  color: #60a5fa;
  border-color: color-mix(in srgb, #60a5fa 45%, var(--border-soft));
  background: color-mix(in srgb, #60a5fa 14%, var(--inset-surface));
}
.archive-trade-row.archive-trade-sick .archive-tag-select.is-tag-sick {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 50%, var(--border-soft));
  background: color-mix(in srgb, var(--red) 18%, var(--inset-surface));
}
.archive-empty {
  padding: 16px;
  color: var(--muted);
  font-size: 0.85rem;
}
@media (max-width: 900px) {
  #page-archive .page-desc {
    display: none;
  }
  #page-archive .archive-toolbar-desktop,
  #page-archive .archive-panel-desktop {
    display: none !important;
  }
  #page-archive .archive-toolbar {
    margin-bottom: 10px;
  }
  #page-archive .archive-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
  }
  #page-archive .archive-quotes-panel,
  #page-archive .archive-main-panel,
  #page-archive .archive-viz-panel,
  #page-archive .archive-calendar-panel {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }
  #page-archive .archive-stats-card {
    margin-bottom: 10px;
  }
  #page-archive .archive-quotes-list {
    min-height: 120px;
    max-height: 42vh;
  }
  #page-archive .archive-quote-day-trades-body {
    max-height: 32vh;
  }
  #page-archive .archive-stats-table th,
  #page-archive .archive-stats-table td {
    padding: 6px 8px;
    font-size: 0.74rem;
  }
}

/* —— 开仓计划 —— */
#page-plan .plan-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.plan-left-panel,
.plan-right-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.plan-form-section,
.plan-active-section,
.plan-history-section,
.plan-stats-section {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px;
}
.plan-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.plan-panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
}
.plan-panel-meta {
  font-size: 0.72rem;
  color: var(--muted);
}
.plan-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}
.plan-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
}
.plan-field-full {
  grid-column: 1 / -1;
}
.plan-field span {
  color: var(--muted);
}
.plan-field input,
.plan-field select,
.plan-field textarea {
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--inset-surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.82rem;
}
.plan-field-inline {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}
.plan-field-inline span {
  white-space: nowrap;
}
.plan-field-inline input,
.plan-field-inline select {
  width: auto;
  min-width: 88px;
}
.plan-radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.plan-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
}
.plan-submit-btn {
  margin-top: 10px;
  width: 100%;
}
.plan-active-list,
.plan-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 48vh;
  overflow: auto;
}
.plan-empty {
  margin: 0;
  padding: 12px 4px;
  color: var(--muted);
  font-size: 0.82rem;
}
.plan-active-card {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--inset-surface);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plan-active-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.plan-active-title {
  font-size: 0.84rem;
  font-weight: 600;
}
.plan-active-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.plan-active-meta,
.plan-active-levels {
  font-size: 0.74rem;
  color: var(--muted);
}
.plan-active-note {
  font-size: 0.78rem;
  color: var(--text);
  opacity: 0.9;
}
.plan-scheme-row {
  margin-top: 6px;
}
.plan-field-scheme select {
  min-width: 160px;
}
.plan-close-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-soft);
}
.plan-history-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--inset-surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
}
.plan-history-row:hover {
  border-color: var(--accent);
}
.plan-history-date {
  color: var(--muted);
  font-size: 0.74rem;
}
.plan-history-result.plan-res-win {
  color: var(--pos);
}
.plan-history-result.plan-res-loss {
  color: var(--neg);
}
.plan-stats-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.plan-period-tabs,
.plan-dim-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.plan-period-btn,
.plan-dim-btn {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  cursor: pointer;
}
.plan-period-btn.is-active,
.plan-dim-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.plan-stats-range.hidden {
  display: none;
}
.plan-period-sep {
  color: var(--muted);
  font-size: 0.78rem;
}
.plan-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.plan-stats-table th,
.plan-stats-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}
.plan-stats-table th {
  color: var(--muted);
  font-weight: 500;
}
.plan-detail-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 8px;
}
.plan-detail-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  font-size: 0.82rem;
}
.plan-detail-k {
  color: var(--muted);
}
.plan-detail-v {
  color: var(--text);
  word-break: break-word;
}
.plan-detail-card {
  width: min(480px, 94vw);
}
.plan-edit-card {
  width: min(520px, 94vw);
}
@media (max-width: 960px) {
  #page-plan .plan-layout {
    grid-template-columns: 1fr;
  }
  .plan-active-list,
  .plan-history-list {
    max-height: none;
  }
  .plan-history-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ── 策略计算器 ── */
.calc-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.calc-card {
  padding: 16px 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.calc-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.calc-card h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--text);
}

.calc-hint {
  margin: 0 0 14px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

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

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--muted);
}

.calc-field input,
.calc-field select {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-family: var(--mono);
}

.calc-field-span2 {
  grid-column: 1 / -1;
}

.calc-market-info {
  padding: 0.55rem 0.55rem 0.55rem 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted, #9aa4b2);
}

.calc-market-info strong {
  color: var(--text, #e8ecf1);
}

.calc-market-err {
  color: #f87171;
}

.calc-actions {
  margin-top: auto;
  padding-top: 12px;
}

.calc-result {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.calc-result.hidden {
  display: none !important;
}

.calc-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 12px;
  margin-bottom: 12px;
}

.calc-summary div {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 8px 10px;
}

.calc-summary span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.calc-summary strong {
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--text);
}

.calc-pnl-profit {
  color: var(--green) !important;
}

.calc-pnl-loss {
  color: var(--red) !important;
}

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

.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.calc-table th,
.calc-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  white-space: nowrap;
}

.calc-table th {
  color: var(--muted);
  font-weight: 600;
}

.calc-error {
  color: var(--red);
  font-size: 0.82rem;
  margin: 0;
}

.calc-empty {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}

.calc-roll-legs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 8px;
  font-size: 0.82rem;
  color: var(--text);
}

.calc-roll-legs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calc-roll-leg {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--bg-elevated);
}

.calc-roll-leg-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.calc-roll-leg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.calc-roll-leg-remove {
  margin-top: 8px;
  font-size: 0.78rem;
}

.calc-done-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid var(--border-soft);
}

@media (max-width: 960px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }
  .calc-form-grid {
    grid-template-columns: 1fr;
  }
}

/* 电脑端计算器改为单页 Tab；手机继续使用原有紧凑 Tab 样式 */
.calc-tab-label-desktop {
  display: none;
}

body:not(.hub-phone) #page-calculator .calc-workspace {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

body:not(.hub-phone) #page-calculator .calc-mobile-tabs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  max-width: none;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--nav-bg);
}

body:not(.hub-phone) #page-calculator .calc-m-tab {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  padding: 9px 12px;
}

body:not(.hub-phone) #page-calculator .calc-m-tab:hover {
  color: var(--text);
  border-color: var(--border-soft);
}

body:not(.hub-phone) #page-calculator .calc-m-tab.is-active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border-soft));
  background: var(--accent-dim);
  box-shadow: inset 0 0 18px color-mix(in srgb, var(--accent) 8%, transparent);
}

body:not(.hub-phone) #page-calculator .calc-tab-label-mobile {
  display: none;
}

body:not(.hub-phone) #page-calculator .calc-tab-label-desktop {
  display: inline;
}

body:not(.hub-phone) #page-calculator .calc-layout {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

body:not(.hub-phone) #page-calculator .calc-layout[data-calc-tab="trend"] [data-calc-pane="roll"],
body:not(.hub-phone) #page-calculator .calc-layout[data-calc-tab="roll"] [data-calc-pane="trend"] {
  display: none;
}

@media (min-width: 1200px) {
  body:not(.hub-phone) #page-calculator .calc-form-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* --- 策略说明 --- */
.strategy-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.strategy-page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.strategy-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.strategy-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.strategy-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.88rem;
}
.strategy-tab.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}
.strategy-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
  align-items: start;
}
.strategy-doc-card,
.strategy-checklist-card {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.strategy-doc-card {
  overflow: hidden;
}
.strategy-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.strategy-col-head .strategy-col-title {
  margin: 0;
}
.strategy-col-print {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 0.78rem;
}
.strategy-col-title {
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: var(--text-soft);
}
.strategy-doc-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 10px 2px 4px;
  scrollbar-gutter: stable;
}
.strategy-doc-body h2 {
  font-size: 1rem;
  margin: 0.6em 0 0.5em;
  color: var(--text);
}
.strategy-doc-body h2:first-child {
  margin-top: 0;
}
.strategy-doc-body h3 {
  font-size: 0.92rem;
  margin: 1em 0 0.4em;
}
.strategy-doc-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 8px 0;
}
.strategy-doc-body th,
.strategy-doc-body td {
  border: 1px solid var(--border-soft);
  padding: 8px 10px;
  text-align: left;
}
.strategy-doc-body blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
  background: var(--surface-2);
}
.strategy-doc-body pre,
.strategy-doc-body code {
  font-size: 0.8rem;
}
.strategy-doc-source {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border-soft);
  font-size: 0.75rem;
  color: var(--muted);
}
.strategy-checklist-body {
  flex: 0 0 auto;
  overflow: visible;
  padding: 2px 10px 2px 4px;
}
.strategy-checklist-body ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.strategy-check-group {
  margin-bottom: 14px;
}
.strategy-check-group h4 {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--accent);
}
.strategy-check-group li {
  margin: 6px 0;
  font-size: 0.86rem;
  line-height: 1.45;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.strategy-check-box {
  flex: 0 0 auto;
  font-size: 1rem;
  line-height: 1.2;
}
.strategy-checklist-footnotes {
  margin: 14px 0 0;
  padding: 12px 0 0 22px;
  border-top: 1px dashed var(--border-soft);
  font-size: 0.78rem;
  color: var(--muted);
}
.strategy-checklist-footnotes.hidden {
  display: none;
}
.strategy-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 960px) {
  .strategy-layout {
    grid-template-columns: 1fr;
  }
  .strategy-doc-card,
  .strategy-checklist-card {
    align-self: stretch;
  }
  .strategy-doc-body {
    max-height: min(50vh, 520px);
  }
}

/* ── 使用说明 ── */
.help-toolbar {
  margin-bottom: 12px;
  min-height: 1.2em;
}
.help-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.help-toc-card {
  padding: 16px 14px 18px;
  position: sticky;
  top: 72px;
}
.help-toc-title {
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  text-transform: uppercase;
}
.help-toc-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.help-toc-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.help-toc-item:hover {
  background: var(--surface-2, rgba(255, 255, 255, 0.04));
  color: var(--text);
}
.help-toc-item.is-active {
  background: var(--accent-soft, rgba(59, 130, 246, 0.12));
  color: var(--accent, #3b82f6);
  font-weight: 600;
}
.help-doc-card {
  padding: 18px 20px 20px;
  min-width: 0;
}

@media (max-width: 960px) {
  .help-layout {
    grid-template-columns: 1fr;
  }
  .help-toc-card {
    position: static;
  }
  .help-toc-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .help-toc-item {
    width: auto;
    flex: 1 1 auto;
  }
  .help-doc-card .strategy-doc-body {
    max-height: none;
  }
}

/* ── 监控页:永续 / 期权分块 ── */
.hub-monitor-block {
  margin-bottom: 4px;
}

.hub-monitor-block-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  margin: 0 0 8px;
}

.hub-monitor-perp .section-title:first-of-type {
  margin-top: 0;
}

.hub-monitor-options {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-soft);
}

.hub-monitor-options .hub-monitor-block-label {
  color: var(--accent);
}

.hub-monitor-options .section-title.hub-options-title {
  margin-top: 0;
}

html[data-theme="light"] .hub-monitor-block-label {
  color: #142232;
}

html[data-theme="light"] .hub-monitor-options .hub-monitor-block-label {
  color: #006e9a;
}

/* ── 监控页:OKX 期权只读聚合 ── */
.hub-options-title {
  margin-top: 14px;
}

.hub-opt-target-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 10px;
}

.hub-opt-target-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted, #9aa8c7);
}

.hub-opt-target-item code {
  font-size: 11px;
  color: #dbe6ff;
}

.hub-opt-pos-card .opt-target-row--ro {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(67, 82, 118, 0.4);
  font-size: 12px;
}

.hub-options-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.hub-options-summary strong {
  color: var(--text);
  font-weight: 600;
}

.hub-options-table-wrap {
  margin-bottom: 8px;
}

.hub-options-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.hub-options-table th,
.hub-options-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.hub-options-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
}

.hub-options-inst {
  font-size: 0.7rem;
  word-break: break-all;
}

.hub-options-actions {
  margin-top: 6px;
}

.opt-expiry-cd {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.opt-expiry-cd--urgent {
  color: #ffb347;
}

.opt-expiry-cd--expired {
  color: var(--muted);
}

html[data-theme="light"] .hub-options-table th {
  color: #3a5068;
}

html[data-theme="light"] .hub-options-summary {
  color: #3a5068;
}

html[data-theme="light"] .hub-options-summary strong {
  color: #142232;
}

/* ── 系统日志页 ── */
.hub-logs-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hub-logs-page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hub-logs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.hub-logs-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hub-logs-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--inset-surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
}
.hub-logs-tab:hover {
  color: var(--text);
  background: var(--nav-link-hover-bg, var(--panel-hover));
}
.hub-logs-tab.is-active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}
#hub-logs-status.is-err {
  color: var(--danger, #f87171);
}
.hub-logs-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.hub-logs-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 420px;
  max-height: calc(100vh - 220px);
  padding: 16px 18px 18px;
}
.hub-logs-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.hub-logs-card-title {
  margin: 0;
  font-size: 0.95rem;
}
.hub-logs-card-hint {
  font-size: 0.72rem;
  color: var(--muted, #8892b0);
}
.hub-logs-pre {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin: 0;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--log-pre-bg, #0d1018);
  border-radius: 8px;
  border: 1px solid var(--log-pre-border, var(--border-soft));
  color: var(--log-pre-fg, #d8deef);
}
html[data-theme="light"] .hub-logs-pre {
  --log-pre-bg: #f0f4f9;
  --log-pre-border: rgba(0, 75, 115, 0.18);
  --log-pre-fg: #1a2838;
}
html[data-theme="light"] .hub-logs-card-title {
  color: var(--text);
}
html[data-theme="light"] .hub-logs-card-hint {
  color: var(--muted);
}
@media (max-width: 960px) {
  .hub-logs-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .hub-logs-card {
    max-height: none;
    min-height: 280px;
  }
}

/* ── 一屏适配:桌面;手机端 .hub-phone 另走 ── */
@media (min-width: 721px) and (min-height: 650px) {
  /*
   * 监控/行情:壳子拉满视口宽 + 固定 100dvh,滚动条贴窗口右缘。
   * 资金概况单独走 body 滚动(见下),避免内层滚动条缩进。
   */
  body.hub-page-monitor:not(.hub-phone) .app-shell,
  body.hub-page-market:not(.hub-phone) .app-shell {
    max-width: none;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    height: 100dvh;
    max-height: 100dvh;
    padding-top: 0;
    padding-bottom: 8px;
    padding-left: max(48px, env(safe-area-inset-left), calc((100vw - 1680px) / 2));
    padding-right: max(48px, env(safe-area-inset-right), calc((100vw - 1680px) / 2));
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
  }

  /* 资金概况:由 body 滚动,滚动条贴窗口最右边 */
  body.hub-page-funds:not(.hub-phone) {
    height: 100dvh;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.hub-page-funds:not(.hub-phone) .app-shell {
    max-width: none;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    height: auto;
    min-height: 100%;
    max-height: none;
    padding-top: 0;
    padding-bottom: 16px;
    padding-left: max(48px, env(safe-area-inset-left), calc((100vw - 1680px) / 2));
    padding-right: max(48px, env(safe-area-inset-right), calc((100vw - 1680px) / 2));
    display: flex;
    flex-direction: column;
    overflow: visible;
  }
}

@media (min-width: 2001px) and (min-height: 650px) {
  body.hub-page-monitor:not(.hub-phone) .app-shell,
  body.hub-page-market:not(.hub-phone) .app-shell,
  body.hub-page-funds:not(.hub-phone) .app-shell {
    padding-left: max(24px, env(safe-area-inset-left), calc((100vw - 1860px) / 2));
    padding-right: max(24px, env(safe-area-inset-right), calc((100vw - 1860px) / 2));
  }
}

/* 其它桌面页(计算器/设置/内照明心等):壳子同样拉满宽度,页面滚动条贴右缘 */
@media (min-width: 721px) {
  body:not(.hub-phone):not(.hub-page-monitor):not(.hub-page-market):not(.hub-page-funds):not(.hub-page-ai) .app-shell {
    max-width: none;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: max(24px, env(safe-area-inset-left), calc((100vw - 1680px) / 2));
    padding-right: max(24px, env(safe-area-inset-right), calc((100vw - 1680px) / 2));
  }
}

@media (min-width: 721px) and (min-height: 650px) {
  body.hub-page-monitor:not(.hub-phone) .app-header,
  body.hub-page-market:not(.hub-phone) .app-header,
  body.hub-page-funds:not(.hub-phone) .app-header {
    flex: 0 0 auto;
    padding: 10px 0 8px;
    margin-bottom: 0;
  }

  /* —— 监控区 —— */
  body.hub-page-monitor:not(.hub-phone) #page-monitor {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  body.hub-page-monitor:not(.hub-phone) #page-monitor > .page-head {
    flex: 0 0 auto;
    margin: 6px 0 4px;
  }

  body.hub-page-monitor:not(.hub-phone) #page-monitor > .page-head h1 {
    font-size: 16px;
  }

  body.hub-page-monitor:not(.hub-phone) #page-monitor .host-status-panel,
  body.hub-page-monitor:not(.hub-phone) #page-monitor .monitor-macro-banner,
  body.hub-page-monitor:not(.hub-phone) #page-monitor .monitor-alert-summary,
  body.hub-page-monitor:not(.hub-phone) #page-monitor .hub-m-fold {
    flex: 0 0 auto;
    margin-bottom: 6px;
  }

  body.hub-page-monitor:not(.hub-phone) #page-monitor .host-status-summary {
    padding: 6px 10px;
  }

  body.hub-page-monitor:not(.hub-phone) #page-monitor .host-status-bar {
    padding: 8px 10px 10px;
  }

  body.hub-page-monitor:not(.hub-phone) #page-monitor .host-status-metrics {
    gap: 6px;
  }

  body.hub-page-monitor:not(.hub-phone) #page-monitor .host-metric-card {
    padding: 6px 8px;
  }

  body.hub-page-monitor:not(.hub-phone) #page-monitor .grid-monitor {
    flex: 1 1 auto;
    min-height: 0;
    gap: 8px;
    overflow: visible;
  }

  body.hub-page-monitor:not(.hub-phone) .grid-monitor.grid-monitor-options-split {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 8px;
  }

  body.hub-page-monitor:not(.hub-phone) .grid-monitor-options-split .monitor-stats-card {
    flex: 0 0 auto;
    padding: 8px 14px;
  }

  body.hub-page-monitor:not(.hub-phone) .grid-monitor-options-split .monitor-stats-grid {
    gap: 10px;
  }

  body.hub-page-monitor:not(.hub-phone) .grid-monitor-options-split .monitor-stat-cell {
    padding: 10px 8px 8px;
  }

  body.hub-page-monitor:not(.hub-phone) .grid-monitor-options-split .monitor-stat-value {
    font-size: 18px;
  }

  body.hub-page-monitor:not(.hub-phone) .grid-monitor-options-split .monitor-split-body {
    flex: 1 1 auto;
    min-height: 0;
    gap: 8px;
    height: auto;
  }

  body.hub-page-monitor:not(.hub-phone) .monitor-split-body.monitor-split-2x2 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(min-content, 1fr) minmax(min-content, 1fr);
    gap: 8px;
  }

  body.hub-page-monitor:not(.hub-phone) .monitor-split-left,
  body.hub-page-monitor:not(.hub-phone) .monitor-split-right {
    gap: 8px;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    align-content: stretch;
    overflow: hidden;
  }

  body.hub-page-monitor:not(.hub-phone) .monitor-split-left > .card,
  body.hub-page-monitor:not(.hub-phone) .monitor-split-right > .card,
  body.hub-page-monitor:not(.hub-phone) .monitor-split-2x2 > .card {
    height: 100%;
    min-height: 0;
  }

  body.hub-page-monitor:not(.hub-phone) .card-monitor-okx-split,
  body.hub-page-monitor:not(.hub-phone) .card-monitor-split-side {
    overflow: hidden;
  }

  body.hub-page-monitor:not(.hub-phone) .card-monitor-okx-split .card-head,
  body.hub-page-monitor:not(.hub-phone) .card-monitor-split-side .card-head {
    padding: 12px 14px 10px;
  }

  body.hub-page-monitor:not(.hub-phone) .card-monitor-okx-split .card-body,
  body.hub-page-monitor:not(.hub-phone) .card-monitor-split-side .card-body {
    padding: 8px 10px;
    overflow: auto;
  }

  body.hub-page-monitor:not(.hub-phone) .hub-inner-cards {
    gap: 6px;
    grid-template-rows: auto minmax(0, 1fr);
  }

  body.hub-page-monitor:not(.hub-phone) .hub-inner-card {
    overflow: hidden;
  }

  body.hub-page-monitor:not(.hub-phone) .hub-inner-card-head {
    padding: 5px 8px;
    font-size: 10px;
  }

  body.hub-page-monitor:not(.hub-phone) .hub-inner-card-body {
    padding: 6px 8px;
    overflow: auto;
  }

  body.hub-page-monitor:not(.hub-phone) .grid-monitor-options-split .hub-options-table-wrap,
  body.hub-page-monitor:not(.hub-phone) .grid-monitor-options-split .pos-table-wrap,
  body.hub-page-monitor:not(.hub-phone) .grid-monitor-options-split .table-scroll {
    overflow: auto;
    max-height: 100%;
  }

  body.hub-page-monitor:not(.hub-phone) .data-table th,
  body.hub-page-monitor:not(.hub-phone) .data-table td {
    padding: 3px 5px;
    font-size: 11px;
    line-height: 1.25;
  }

  body.hub-page-monitor:not(.hub-phone) .section-title {
    margin: 4px 0 4px;
    font-size: 11px;
  }

  body.hub-page-monitor:not(.hub-phone) .hub-monitor-options {
    margin-top: 6px;
    padding-top: 6px;
  }

  body.hub-page-monitor:not(.hub-phone) .empty-hint {
    padding: 4px 0;
    font-size: 11px;
  }

  /* —— 行情区 —— */
  body.hub-page-market:not(.hub-phone) #page-market {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.hub-page-market:not(.hub-phone) #page-market > .page-head {
    flex: 0 0 auto;
    margin: 6px 0 4px;
  }

  body.hub-page-market:not(.hub-phone) #page-market > .page-head h1 {
    font-size: 16px;
  }

  body.hub-page-market:not(.hub-phone) #page-market .hub-m-fold,
  body.hub-page-market:not(.hub-phone) #page-market .market-vol-rank-anchor,
  body.hub-page-market:not(.hub-phone) #page-market .market-status {
    flex: 0 0 auto;
  }

  body.hub-page-market:not(.hub-phone) #page-market .market-status {
    margin: 2px 0 6px;
  }

  body.hub-page-market:not(.hub-phone) #page-market .market-chart-wrap,
  body.hub-page-market:not(.hub-phone) #page-market .market-chart-wrap.has-pos-panel {
    flex: 1 1 auto;
    height: auto !important;
    min-height: 0;
    max-height: none;
  }

  body.hub-page-market:not(.hub-phone) #page-market .market-ohlcv-bar {
    padding: 6px 10px;
  }

  /* —— 资金概况 —— */
  body.hub-page-funds:not(.hub-phone) #page-funds {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  body.hub-page-funds:not(.hub-phone) .funds-stage {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  /* 不在内层滚动,改由 body 贴边滚动 */
  body.hub-page-funds:not(.hub-phone) .funds-stage-inner {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 8px 12px 16px;
    overflow: visible;
  }

  body.hub-page-funds:not(.hub-phone) .funds-head {
    flex: 0 0 auto;
    margin-bottom: 4px !important;
  }

  body.hub-page-funds:not(.hub-phone) .funds-head h1 {
    font-size: 16px;
  }

  body.hub-page-funds:not(.hub-phone) .funds-toolbar {
    flex: 0 0 auto;
    margin-bottom: 6px;
    gap: 8px;
  }

  body.hub-page-funds:not(.hub-phone) .funds-summary {
    flex: 0 0 auto;
    margin-bottom: 6px;
    gap: 8px;
  }

  body.hub-page-funds:not(.hub-phone) .funds-stat-card {
    padding: 8px 10px;
  }

  body.hub-page-funds:not(.hub-phone) .funds-stat-value {
    font-size: 1.15rem;
  }

  body.hub-page-funds:not(.hub-phone) .funds-meta {
    flex: 0 0 auto;
    margin: 0 0 6px;
    padding: 4px 8px;
  }

  body.hub-page-funds:not(.hub-phone) .funds-chart-panel {
    flex: 0 0 auto;
    height: min(420px, 46vh);
    min-height: 300px;
    max-height: none;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.hub-page-funds:not(.hub-phone) .funds-chart-host {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    /* 给 Lightweight Charts 时间轴留出空间,避免日期被裁切 */
    padding-bottom: 2px;
    box-sizing: border-box;
  }

  body.hub-page-funds:not(.hub-phone) .funds-section-head {
    flex: 0 0 auto;
    margin-bottom: 6px;
  }

  body.hub-page-funds:not(.hub-phone) .funds-accounts {
    flex: 0 0 auto;
    max-height: none;
    overflow: visible;
    gap: 8px;
    padding: 0 0 8px;
  }

  body.hub-page-funds:not(.hub-phone) .funds-ac-card {
    padding: 8px 10px;
    gap: 6px;
  }
}

/* 1920×1080:略压 KPI,曲线固定高度,分户完整可见可滚到底 */
@media (min-width: 1600px) and (min-height: 900px) and (max-height: 1100px) {
  body.hub-page-funds:not(.hub-phone) .funds-head {
    margin-bottom: 2px !important;
  }

  body.hub-page-funds:not(.hub-phone) .funds-toolbar {
    margin-bottom: 4px;
  }

  body.hub-page-funds:not(.hub-phone) .funds-summary {
    margin-bottom: 4px;
    gap: 6px;
  }

  body.hub-page-funds:not(.hub-phone) .funds-stat-card {
    padding: 6px 8px;
  }

  body.hub-page-funds:not(.hub-phone) .funds-meta {
    margin-bottom: 4px;
    padding: 3px 8px;
    font-size: 0.7rem;
  }

  body.hub-page-funds:not(.hub-phone) .funds-chart-panel {
    height: 360px;
    min-height: 360px;
  }
}
