/* ============================================================
   WHITE LEDGER · 白纸红章
   设计层：纯白纸面 + 墨色信息 + 单一朱红强调。
   加载顺序：styles.css → terminal.css → ledger.css
   ============================================================ */

:root {
  /* 纸与墨 */
  --paper: #ffffff;
  --paper-muted: #f7f6f3;
  --ink: #141414;
  --ink-soft: #4a4640;
  --muted: #6f6a62;
  --muted-soft: #938d84;
  --rule: #e4e0d8;
  --rule-strong: #c9c4ba;
  --rule-ink: #141414;

  /* 语义色：A 股习惯，红涨绿跌 */
  --accent: #b3271e;
  --accent-dark: #8e1c15;
  --accent-soft: rgba(179, 39, 30, 0.08);
  --positive: #b3271e;
  --positive-soft: rgba(179, 39, 30, 0.08);
  --negative: #1d6a4b;
  --negative-soft: rgba(29, 106, 75, 0.08);
  --warning: #9a6a00;
  --warning-soft: rgba(154, 106, 0, 0.09);
  --blue: #3b5c74;
  --gold: #9a6a00;
  --green: #1d6a4b;

  /* 字体 */
  --font-serif: "Songti SC", "Noto Serif SC", "Noto Serif CJK SC",
    "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --font-sans: "PingFang SC", "Noto Sans SC", "Noto Sans CJK SC",
    "Source Han Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", "SFMono-Regular", Menlo,
    Consolas, monospace;
  /* 原有变量名继续沿用：display 仍给数字 */
  --font-display: var(--font-mono);

  /* 形状 */
  --radius: 0px;
  --radius-small: 0px;
  --shadow: none;
  --shadow-small: none;
  --shadow-card: none;

  /* 旧终端变量映射 */
  --canvas: #ffffff;
  --canvas-deep: #ffffff;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #f7f6f3;
  --nav: #ffffff;
  --nav-soft: #f7f6f3;
  --nav-text: #141414;
  --nav-muted: #6f6a62;
  --line: #e4e0d8;
  --line-strong: #c9c4ba;
  --accent-ink: #141414;
  --terminal-bg: #ffffff;
  --terminal-panel: #ffffff;
  --terminal-ink: #141414;
  --page-min-font: 15px;
  --account-min-font: 15px;
}

/* ---------------- 基础 ---------------- */

html,
body {
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.62;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline-color: var(--accent);
}

#pageRoot:focus,
#pageRoot:focus-visible,
.terminal-stage:focus,
.terminal-stage:focus-visible {
  outline: 0;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) #ffffff;
}

:where(h1, h2, h3, h4, h5, h6) {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  color: var(--ink);
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

strong,
b {
  font-weight: 600;
}

:where(code, kbd, pre, samp) {
  font-family: var(--font-mono);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #fff;
}

::-webkit-scrollbar-thumb {
  background: var(--rule-strong);
  border: 3px solid #fff;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-soft);
}

/* ---------------- 壳层 ---------------- */

.terminal-shell {
  background: var(--paper);
}

.terminal-shell::before,
.terminal-shell::after {
  display: none;
}

.terminal-bar {
  min-height: 64px;
  padding: 0 24px;
  gap: 18px;
  border-bottom: 1px solid var(--rule-ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
}

.terminal-brand {
  font-family: var(--font-serif);
  color: var(--ink);
}

.terminal-brand-mark {
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0;
  box-shadow: none;
}

.terminal-brand-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.terminal-brand-path {
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.terminal-context {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.terminal-context #topbarSection {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
}

.terminal-status-light {
  width: 6px;
  height: 6px;
  border-radius: 0;
  background: var(--accent);
  box-shadow: none;
}

.status-dot {
  border-radius: 0;
  background: var(--accent);
  box-shadow: none;
}

.status-dot.is-stale {
  background: var(--warning);
}

.terminal-bar :where(button, .terminal-feed-chip, .data-chip, .terminal-text-button) {
  border-radius: 0;
  border-color: var(--rule);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  box-shadow: none;
}

.terminal-bar .auto-refresh-toggle,
.terminal-bar .auto-refresh-toggle[aria-pressed="true"],
.terminal-bar .command-trigger,
.terminal-bar .terminal-feed-chip,
.terminal-bar .data-chip,
.terminal-bar .terminal-text-button {
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--paper) !important;
  color: var(--muted) !important;
  box-shadow: none !important;
}

.terminal-bar .auto-refresh-toggle[aria-pressed="true"] {
  border-color: rgba(179, 39, 30, 0.4);
  color: var(--accent) !important;
}

.terminal-bar .auto-refresh-toggle[aria-pressed="true"] i {
  background: var(--accent);
  box-shadow: none;
}

.terminal-bar .auto-refresh-toggle i {
  border-radius: 0;
}

.terminal-bar .command-trigger span:first-child {
  color: var(--accent);
}

.terminal-bar .terminal-icon-button {
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--paper) !important;
  color: var(--muted) !important;
}

.terminal-bar .terminal-icon-button:hover {
  border-color: var(--ink);
  color: var(--ink) !important;
}

.terminal-bar :where(button, .terminal-feed-chip, .data-chip, .terminal-text-button):hover {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

.terminal-telemetry {
  min-height: 28px;
  padding: 0 24px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.terminal-telemetry span:nth-child(4) {
  color: var(--muted);
}

.terminal-telemetry-line {
  background: linear-gradient(90deg, var(--rule-strong), transparent);
  opacity: 0.7;
}

.terminal-stage {
  padding: 26px 28px 34px;
  background: var(--paper);
}

.terminal-console {
  border-top: 1px solid var(--rule-ink);
  background: var(--paper);
  box-shadow: none;
}

.command-form {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
}

.command-form :where(input, .command-input) {
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  border: 0;
  box-shadow: none;
}

.terminal-statusline {
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

/* 移动端底栏 */
.mobile-app-nav {
  border-top: 1px solid var(--rule-ink);
  background: var(--paper);
  box-shadow: none;
}

.mobile-app-nav a {
  border-radius: 0;
  color: var(--muted);
}

.mobile-app-nav a:where(.is-active, [aria-current="page"]) {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 2px 0 var(--accent);
}

/* ---------------- 页眉 ---------------- */

.terminal-stage .page-header {
  position: relative;
  align-items: flex-end;
  padding: 6px 0 18px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--rule-ink);
}

.terminal-stage .page-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: var(--rule);
}

.page-header h1,
.ops-market-title h1 {
  margin: 6px 0 8px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(32px, 2.6vw, 44px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.eyebrow {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-subtitle {
  max-width: 62ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.page-stamp {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
  padding: 8px 12px;
  border: 1px solid rgba(179, 39, 30, 0.32);
  border-radius: 0;
  background: var(--paper);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  box-shadow: none;
}

.page-stamp strong {
  color: var(--ink);
}

.page-stamp .status-dot {
  background: var(--accent);
}

/* ---------------- 通用卡片与分区 ---------------- */

.card,
.ops-market-panel,
.ops-rail-panel,
.login-panel,
.modal-card,
.modal-panel,
.cycle-workbench,
.intel-content > section,
.alert-overview,
.connection-card,
.rules-list,
.push-panel {
  border-radius: 0;
  background: var(--paper);
  box-shadow: none;
}

.card {
  border: 1px solid var(--rule);
  padding: 22px 24px;
}

.card-head {
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}

.card-title,
.intel-content h2,
.alert-overview h2,
.cycle-workbench h2 {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-kicker,
.card-subtitle {
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-rule,
.section-rule {
  border-color: var(--rule);
}

/* 卡片内表格统一账本线 */
.card table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 15px;
}

.card table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule-ink);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}

.card table td {
  padding: 12px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  vertical-align: top;
}

.card table td:where([data-tone], .num, .tone-up, .tone-down),
.card table th.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---------------- 按钮 / 输入 / 标签 ---------------- */

.button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  box-shadow: none;
  transform: none;
}

.button:hover {
  border-color: var(--ink);
  background: var(--paper);
  color: var(--accent);
  transform: none;
  box-shadow: none;
}

.button-primary,
.button--primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.button-primary:hover,
.button--primary:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button-accent {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button-ghost:hover {
  color: var(--ink);
  text-decoration: underline;
}

button:not(.button):not(.board-tab):not(.page-hub-tabs button):focus-visible,
.button:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  box-shadow: none;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  border-color: var(--ink);
  outline: 0;
  box-shadow: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-soft);
}

label,
.form-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------------- 页内分组标签 ---------------- */

.page-hub-tabs,
.intel-tabs,
.board-tabs,
.segment-tabs,
.filter-tabs,
.news-filters {
  gap: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
}

.page-hub-tabs button,
.intel-tabs button,
.segment-tab,
.filter-tab {
  padding: 11px 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 15px;
  box-shadow: none;
}

.intel-tabs button {
  min-height: 44px;
}

.page-hub-tabs button:hover,
.intel-tabs button:hover,
.segment-tab:hover,
.filter-tab:hover {
  background: transparent;
  color: var(--ink);
}

.page-hub-tabs button.is-active,
.intel-tabs button.is-active,
.segment-tab.is-active,
.filter-tab.is-active {
  border: 0;
  border-bottom: 2px solid var(--accent);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  box-shadow: none;
}

.filter-tab.is-active {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.filter-tabs {
  gap: 8px;
  border-bottom: 0;
  margin-bottom: 16px;
}

.filter-tab {
  padding: 7px 12px;
  border: 1px solid var(--rule);
}

.segment-tabs {
  border-bottom: 0;
}

.journal-status {
  border-radius: 0;
  background: var(--paper-muted);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.journal-status.is-reviewed {
  background: var(--accent-soft);
  color: var(--accent);
}

body.terminal-mode .intel-tabs,
body.terminal-mode .segment-tabs,
body.terminal-mode .filter-tabs {
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
}

body.terminal-mode .intel-tabs button,
body.terminal-mode .segment-tab,
body.terminal-mode .filter-tab {
  border-radius: 0;
  color: var(--muted);
  background: transparent;
}

body.terminal-mode .intel-tabs button.is-active,
body.terminal-mode .segment-tab.is-active,
body.terminal-mode .filter-tab.is-active {
  border: 0;
  border-bottom: 2px solid var(--accent);
  color: var(--ink);
  background: transparent;
  font-weight: 600;
}

body.terminal-mode .filter-tab {
  border: 1px solid var(--rule);
}

body.terminal-mode .filter-tab.is-active {
  border-color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ---------------- 终端模式的旧覆盖修正 ---------------- */

body.terminal-mode .card,
body.terminal-mode .metric-strip,
body.terminal-mode .risk-metric,
body.terminal-mode .journal-entry,
body.terminal-mode .rules-card,
body.terminal-mode .asset-table-card,
body.terminal-mode .journal-stats,
body.terminal-mode .intel-toolbar,
body.terminal-mode .review-report,
body.terminal-mode .news-card,
body.terminal-mode .anomaly-card,
body.terminal-mode .connection-card,
body.terminal-mode .rules-list,
body.terminal-mode .push-panel {
  border-color: var(--rule);
  border-radius: 0;
  background: var(--paper);
  box-shadow: none;
}

body.terminal-mode .card-dark,
body.terminal-mode .portfolio-hero {
  border-color: var(--rule);
  background: var(--paper);
}

body.terminal-mode .metric-item,
body.terminal-mode .macro-item,
body.terminal-mode .journal-stat,
body.terminal-mode .risk-metric {
  background: var(--paper);
}

body.terminal-mode .card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

body.terminal-mode .card-kicker {
  color: var(--accent);
}

body.terminal-mode .insight-item,
body.terminal-mode .journal-thesis,
body.terminal-mode .journal-detail div,
body.terminal-mode .fund-check,
body.terminal-mode .rules-footer,
body.terminal-mode .section-footer {
  border-color: var(--rule);
  background: var(--paper);
}

body.terminal-mode .journal-thesis {
  border-left: 2px solid var(--accent);
}

body.terminal-mode .journal-guide {
  border-color: var(--rule);
  border-radius: 0;
  background: var(--paper);
  background-image: none;
}

body.terminal-mode .empty-state {
  border-color: var(--rule);
  background: var(--paper);
}

body.terminal-mode .button {
  border-color: var(--rule-strong);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
}

body.terminal-mode .button:hover {
  border-color: var(--ink);
  background: var(--paper);
  color: var(--accent);
}

body.terminal-mode .button-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

body.terminal-mode .button-primary:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

body.terminal-mode .button-accent {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

body.terminal-mode .threshold-input,
body.terminal-mode .field input,
body.terminal-mode .field select,
body.terminal-mode .field textarea,
body.terminal-mode .weight-row input {
  border-color: var(--rule-strong);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
}

body.terminal-mode .status-badge,
body.terminal-mode .proxy-badge,
body.terminal-mode .type-badge,
body.terminal-mode .rule-state,
body.terminal-mode .relevance-badge {
  border-radius: 0;
  border-color: var(--rule);
  background: var(--paper);
  color: var(--muted);
}

/* ---------------- 空状态 ---------------- */

.empty-state {
  border: 0;
  border-top: 1px solid var(--rule-ink);
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: var(--paper);
  padding: 56px 24px;
  box-shadow: none;
}

.empty-state-mark,
.empty-state-icon {
  width: 52px;
  height: 52px;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: transparent;
  color: var(--accent);
}

.empty-state h2,
.empty-state h3 {
  margin-top: 18px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
}

.empty-state p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.empty-state .button {
  margin-top: 18px;
}

/* ---------------- 账户驾驶舱 ---------------- */

.account-ops-stage {
  gap: 0;
  background: var(--paper);
}

.account-ops-stage > .ops-market-panel {
  border: 0;
  border-right: 1px solid var(--rule);
  background: var(--paper);
}

.ops-market-panel,
.ops-side-rail,
.ops-bottom-deck {
  background: var(--paper);
  box-shadow: none;
}

.ops-market-head {
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--rule);
}

.ops-market-title .eyebrow {
  margin-bottom: 2px;
}

.ops-market-title h1 {
  font-size: clamp(28px, 2.3vw, 38px);
}

.ops-market-title > p:last-child {
  color: var(--muted);
  line-height: 1.6;
}

.ops-headline-summary {
  min-width: 220px;
  padding-left: 24px;
  border-left: 1px solid var(--rule);
}

.ops-headline-summary > strong,
.ops-headline-amount-row > strong,
.ops-now-value {
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.ops-headline-amount-row > strong {
  font-size: clamp(34px, 3vw, 50px);
  line-height: 1;
}

.ops-headline-summary > em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.account-live-pulse {
  width: 6px;
  height: 6px;
  border-radius: 0;
  background: var(--accent);
  box-shadow: none;
  animation: none;
}

.ops-total-toggle {
  border: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.ops-total-toggle:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.ops-market-toolbar {
  padding: 10px 24px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.account-range-tab {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.account-range-tab.is-active {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.ops-market-actions button,
.ops-focus-button,
.ops-market-actions .button {
  border-radius: 0;
  border-color: var(--rule);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.ops-market-actions button:hover,
.ops-focus-button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.ops-market-chart {
  background: var(--paper);
}

.ops-series-dock {
  border-top: 1px solid var(--rule);
  background: var(--paper);
}

.ops-series-row {
  border-bottom: 1px solid var(--rule);
}

.ops-series-row button {
  border: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.ops-series-row button.is-active {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

.ops-bond-reference {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.ops-side-rail {
  border: 0;
  background: var(--paper);
}

.ops-rail-panel {
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  box-shadow: none;
}

.ops-rail-panel:last-child {
  border-bottom: 0;
}

.ops-rail-head {
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.ops-rail-head strong {
  color: var(--ink);
}

.ops-now-value {
  font-size: clamp(26px, 2.4vw, 36px);
  line-height: 1.05;
}

.ops-weather-grid {
  border-top: 1px solid var(--rule);
}

.ops-weather-cell {
  border-right: 1px solid var(--rule);
}

.ops-weather-cell:last-child {
  border-right: 0;
}

.ops-signal-row {
  border-bottom: 1px solid var(--rule);
}

.ops-signal-row:last-child {
  border-bottom: 0;
}

.ops-signal-subhead {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.ops-bottom-deck {
  border-top: 1px solid var(--rule-ink);
  gap: 0;
}

.ops-bottom-module {
  border: 0;
  border-right: 1px solid var(--rule);
  background: var(--paper);
}

.ops-bottom-module:last-child {
  border-right: 0;
}

.ops-module-head {
  border-bottom: 1px solid var(--rule);
}

.ops-module-head strong {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 16px;
  letter-spacing: 0.01em;
}

.ops-module-head small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.ops-book-row,
.ops-dca-row,
.ops-contribution-row {
  border-bottom: 1px solid var(--rule);
}

.ops-book-row:last-child,
.ops-dca-row:last-child,
.ops-contribution-row:last-child {
  border-bottom: 0;
}

.ops-book-value,
.ops-dca-value,
.ops-contribution-value,
.ops-rebalance-days {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 风险 / 再平衡 ---------------- */

.risk-metrics {
  gap: 0;
  border-top: 1px solid var(--rule-ink);
  border-bottom: 1px solid var(--rule-ink);
  background: transparent;
}

.risk-metric {
  border: 0;
  border-right: 1px solid var(--rule);
  border-radius: 0;
  background: var(--paper);
  padding: 18px 22px;
  box-shadow: none;
}

.risk-metric:last-child {
  border-right: 0;
}

.risk-metric span,
.risk-metric small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.risk-metric strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(28px, 2.2vw, 38px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.risk-grid,
.exposure-grid {
  gap: 1px;
  background: var(--rule);
}

.risk-grid > .card,
.exposure-grid > .card {
  border: 0;
  box-shadow: none;
}

.risk-track {
  height: 6px;
  background: var(--paper-muted);
}

.risk-fill {
  border-radius: 0;
}

.corr-table {
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
}

.corr-table th {
  border-bottom: 1px solid var(--rule-ink);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.corr-table th:first-child {
  width: 76px;
}

.corr-table td {
  border: 1px solid rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 14px;
  text-align: center;
  white-space: nowrap;
}

.corr-table td[data-strong="true"] {
  color: #ffffff;
  font-weight: 600;
}

.corr-scale-bar {
  border-radius: 0;
  background: linear-gradient(
    90deg,
    #3b5c74 0%,
    #ffffff 50%,
    #b3271e 100%
  );
}

.portfolio-config-grid input {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  background: transparent;
}

.portfolio-config-grid input:focus {
  border-bottom-color: var(--ink);
}

.portfolio-config-grid {
  gap: 1px;
  border: 1px solid var(--rule);
  background: var(--rule);
}

.portfolio-config-field {
  gap: 10px;
  padding: 14px 16px;
  border: 0;
  background: var(--paper);
}

.portfolio-config-field > span {
  color: var(--muted);
  font-family: var(--font-sans);
}

.portfolio-config-field input {
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--ink);
  font: 500 28px/1 var(--font-mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.portfolio-config-field input:focus {
  border-bottom-color: var(--ink);
  background: transparent;
}

.portfolio-config-foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.risk-basis-banner {
  border: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  padding: 11px 0;
  margin: 16px 0 0;
}

.risk-basis-banner.is-actual {
  border-left: 0;
}

.risk-basis-banner strong {
  color: var(--ink);
  font-weight: 600;
}

.risk-basis-banner p {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* 计划单印章 */
.rebalance-stamp,
.plan-stamp {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: rotate(-1.2deg);
}

/* ---------------- 告警 / 情报 / 决策 ---------------- */

.alert-overview,
.connection-card,
.rules-list,
.push-panel {
  border: 1px solid var(--rule);
}

.alert-hero strong,
.alert-hero-number {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.connection-card dl,
.connection-list {
  border-top: 1px solid var(--rule);
}

.connection-card dl > div,
.connection-list > div {
  border-bottom: 1px solid var(--rule);
}

.intel-content > section {
  border: 1px solid var(--rule);
  padding: 24px;
}

.intel-content > section > header {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 12px;
}

.journal-entry,
.decision-entry,
.timeline-row,
.flight-row {
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.journal-entry:last-child,
.decision-entry:last-child,
.timeline-row:last-child,
.flight-row:last-child {
  border-bottom: 0;
}

.journal-entry h3,
.decision-entry h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
}

/* ---------------- 打板情绪 ---------------- */

.board-page {
  --bd-bg: #ffffff;
  --bd-panel: #ffffff;
  --bd-panel-2: #ffffff;
  --bd-line: #e4e0d8;
  --bd-line-2: #c9c4ba;
  --bd-text: #141414;
  --bd-muted: #6f6a62;
  --bd-dim: #938d84;
  --bd-up: #b3271e;
  --bd-up-2: #c9503f;
  --bd-down: #1d6a4b;
  --bd-down-2: #3f7f67;
  --bd-amber: #9a6a00;
  --bd-amber-2: #c0a46a;
  --bd-cyan: #3b5c74;
  background: var(--bd-bg);
}

.board-page .board-tabs {
  border-bottom: 1px solid var(--rule);
}

.board-page .board-tab {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--bd-muted);
  box-shadow: none;
}

.board-page .board-tab.is-on {
  background: transparent;
  color: var(--bd-text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.board-page .board-card {
  border: 1px solid var(--bd-line);
  background: var(--bd-panel);
  box-shadow: none;
}

.board-page .board-card::before {
  background: var(--accent);
  opacity: 0.25;
}

.board-page .board-card-head {
  background: var(--bd-panel);
  border-bottom: 1px solid var(--bd-line);
}

.board-page .board-card-head h2 {
  color: var(--bd-muted);
  font-family: var(--font-mono);
}

.board-page :where(.board-hero-num, .board-kpi-num, .board-verdict-win strong) {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.board-page .board-verdict {
  border: 1px solid var(--bd-line);
  background: var(--bd-panel);
  box-shadow: none;
}

.board-page .board-live.is-live i {
  border-radius: 0;
  box-shadow: none;
  animation: none;
}

.board-page .board-degraded {
  border-radius: 0;
  background: rgba(154, 106, 0, 0.06);
}

/* ---------------- 图表 ---------------- */

.chart-host {
  background: var(--paper);
}

.chart-grid-line {
  stroke: #efede8;
}

.chart-axis-line {
  stroke: #c9c4ba;
}

.chart-crosshair {
  stroke: #c9c4ba;
  stroke-dasharray: 3 4;
}

.chart-tooltip,
.chart-readout {
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 18px 44px rgba(20, 20, 20, 0.12);
  font-family: var(--font-mono);
}

.chart-tooltip small,
.chart-readout small {
  color: var(--muted);
}

.chart-legend {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.chart-legend i {
  border-radius: 0;
}

.chart-marker,
.chart-point {
  stroke: #ffffff;
}

.account-market-chart .drawdown-zone {
  fill: rgba(179, 39, 30, 0.06);
}

.account-market-chart .drawdown-boundary {
  stroke: rgba(179, 39, 30, 0.45);
}

.account-market-chart .drawdown-marker {
  fill: var(--accent);
  stroke: #ffffff;
}

.account-market-chart .drawdown-label-panel {
  fill: #ffffff;
  stroke: var(--ink);
  stroke-width: 1;
  rx: 0;
}

.account-market-chart .drawdown-label,
.account-market-chart .drawdown-label-dates {
  font-family: var(--font-mono);
}

.account-market-chart .drawdown-label {
  fill: var(--ink);
}

.account-market-chart .drawdown-label-value {
  fill: var(--accent);
}

.account-market-chart .drawdown-label-dates {
  fill: var(--muted);
}

.account-market-chart .chart-y-axis-marker rect {
  fill: #ffffff;
  stroke: var(--rule-strong);
}

/* ---------------- 启动页 ---------------- */

.boot-screen {
  background: var(--paper);
  color: var(--ink);
}

.boot-frame {
  border: 1px solid var(--rule-ink);
  border-radius: 0;
  background: var(--paper);
  box-shadow: none;
}

.boot-frame::after,
.terminal-loader-frame::after {
  display: none;
}

.boot-frame-head {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
}

.boot-frame-head span:last-child {
  color: var(--accent);
}

.boot-mark span {
  border-radius: 0;
  background: var(--ink);
}

.boot-mark span:nth-child(2) {
  background: var(--accent);
}

.boot-mark span:nth-child(3) {
  background: var(--rule-strong);
}

.boot-kicker {
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
}

.boot-title {
  font-family: var(--font-serif);
  letter-spacing: 0.04em;
}

.boot-title span {
  color: var(--accent);
}

.boot-log {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--font-mono);
}

.boot-log span:nth-child(1),
.boot-log span:nth-child(4) {
  color: var(--ink);
}

.boot-track,
.boot-progress {
  background: var(--paper-muted);
}

.boot-track span,
.boot-progress span {
  background: var(--accent);
}

/* ---------------- 登录页 ---------------- */

.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: stretch;
  padding: 0;
  background: var(--paper);
}

.login-visual {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 48px 56px;
  border-right: 1px solid var(--rule-ink);
  background: var(--paper);
}

.login-grid {
  opacity: 0.55;
  background-image:
    linear-gradient(rgba(20, 20, 20, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 20, 20, 0.05) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px;
  mask-image: radial-gradient(circle at 30% 40%, #000 20%, transparent 72%);
}

.login-brand {
  color: var(--ink);
}

.login-brand .brand-mark {
  border: 1px solid var(--rule-ink);
  border-radius: 0;
  background: var(--paper);
  box-shadow: none;
}

.login-brand .brand-mark span:nth-child(2) {
  background: var(--accent);
}

.login-brand .brand-mark span:nth-child(3) {
  background: var(--rule-strong);
}

.login-statement h1 {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(40px, 4.8vw, 64px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.login-statement h1 em {
  color: var(--accent);
  font-style: normal;
}

.login-copy,
.login-statement p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.login-visual-foot {
  border-top: 1px solid var(--rule);
}

.login-metric {
  border-top: 1px solid var(--rule);
}

.login-metric strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.login-panel {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 48px;
  border: 0;
  background: var(--paper);
  box-shadow: none;
}

.login-form {
  width: min(100%, 380px);
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  font-family: var(--font-sans);
}

.login-form::before {
  content: "REDARM / PRIVATE RESEARCH DESK";
  display: block;
  margin-bottom: 18px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.login-form h2 {
  margin-bottom: 8px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-form > p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.login-form fieldset,
.login-fields {
  border: 0;
  padding: 0;
}

.login-form label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.login-form input {
  min-height: 44px;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  background: var(--paper);
  font-family: var(--font-mono);
}

.login-form input:focus {
  border-color: var(--ink);
  box-shadow: none;
}

.login-form .button,
.login-submit {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-sans);
  letter-spacing: 0.04em;
}

.login-form .button:hover,
.login-submit:hover {
  border-color: var(--accent);
  background: var(--accent);
}

.login-form .cursor,
.login-cursor {
  display: none;
}

.login-footnote,
.login-form small {
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

/* ---------------- 手机账户看板 ---------------- */

.mobile-account-readout {
  grid-template-columns: minmax(0, 1fr);
  border: 0;
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
}

.mobile-account-readout > * {
  min-width: 0;
}

.mobile-readout-meta {
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--font-mono);
}

.mobile-readout-meta > * {
  min-width: 0;
}

.mobile-readout-meta span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.mobile-readout-extreme,
.mobile-readout-asset,
.mobile-readout-profit {
  background: var(--paper);
}

.mobile-readout-total > strong,
.mobile-readout-total-change > strong,
.mobile-readout-extreme > strong,
.mobile-readout-profit-head > strong {
  font-family: var(--font-mono) !important;
  font-variant-numeric: tabular-nums;
}

.mobile-readout-profit {
  border: 0;
  border-top: 1px solid var(--rule-ink);
  border-bottom: 1px solid var(--rule);
  background: transparent;
}

.mobile-readout-profit.is-positive {
  background: var(--accent-soft);
}

.mobile-readout-profit.is-negative {
  background: var(--negative-soft);
}

.mobile-readout-profit-zero {
  background: var(--rule-strong);
}

/* ---------------- 动效 ---------------- */

.page,
.page-header {
  animation-duration: 240ms;
}

.page-header::after {
  transform-origin: left center;
  animation: ledger-rule 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes ledger-rule {
  from {
    transform: scaleX(0);
    opacity: 0;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 1180px) {
  .ops-headline-amount-row > strong {
    font-size: clamp(30px, 4.2vw, 42px);
  }

  .terminal-stage {
    padding: 22px 20px 30px;
  }
}

@media (max-width: 1024px) {
  .account-ops-stage > .ops-market-panel {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .ops-headline-summary {
    border-left: 0;
    padding-left: 0;
  }
}

@media (max-width: 900px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

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

  .terminal-bar {
    padding: 0 16px;
  }

  .terminal-telemetry {
    padding: 0 16px;
    overflow: hidden;
  }
}

@media (max-width: 760px) {
  .terminal-stage {
    padding: 18px 16px 26px;
  }

  .page-header h1,
  .ops-market-title h1 {
    font-size: clamp(26px, 8vw, 32px);
  }

  .page-stamp {
    justify-content: flex-start;
  }

  .risk-metric {
    padding: 14px 16px;
  }

  .risk-metric strong {
    font-size: 26px;
  }

  .card {
    padding: 16px;
  }

  .empty-state {
    padding: 40px 16px;
  }

  .board-page .board-card {
    border-left: 0;
    border-right: 0;
  }
}

@media (max-width: 420px) {
  .ops-headline-amount-row > strong {
    font-size: clamp(28px, 10vw, 38px);
  }

  .page-header .eyebrow {
    letter-spacing: 0.1em;
  }
}
