/* === CRYPTO-SIGNAL Design System === */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Typography */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Type scale */
  --text-xs:   clamp(0.7rem,  0.65rem + 0.25vw, 0.8rem);
  --text-sm:   clamp(0.8rem,  0.75rem + 0.25vw, 0.875rem);
  --text-base: clamp(0.875rem, 0.85rem + 0.15vw, 0.9375rem);
  --text-lg:   clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
  --text-xl:   clamp(1.25rem, 1rem + 0.75vw, 1.75rem);

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Transitions */
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Signal colors (constant) */
  --green: #00e676;
  --green-dim: #00c853;
  --green-bg: rgba(0, 230, 118, 0.08);
  --red: #ff5252;
  --red-dim: #ff1744;
  --red-bg: rgba(255, 82, 82, 0.08);
  --amber: #ffc107;
  --amber-dim: #ffab00;
  --amber-bg: rgba(255, 193, 7, 0.08);
  --cyan: #00bcd4;
}

/* ── Dark Theme ── */
:root, [data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --surface: #161616;
  --surface-2: #1c1c1c;
  --surface-3: #222222;
  --border: #2a2a2a;
  --border-subtle: #1e1e1e;
  --text: #e0e0e0;
  --text-secondary: #999999;
  --text-muted: #666666;
  --text-faint: #444444;
  --code-bg: #0d0d0d;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.4);
  --scrollbar-thumb: #333;
  --scrollbar-track: #111;
}

/* ── Light Theme ── */
[data-theme="light"] {
  --bg: #f5f5f5;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f0f0f0;
  --border: #e0e0e0;
  --border-subtle: #eeeeee;
  --text: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --text-faint: #bbbbbb;
  --code-bg: #f8f8f8;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
  --scrollbar-thumb: #ccc;
  --scrollbar-track: #f0f0f0;
  --green: #00a854;
  --green-dim: #00873f;
  --green-bg: rgba(0, 168, 84, 0.08);
  --red: #d32f2f;
  --red-dim: #c62828;
  --red-bg: rgba(211, 47, 47, 0.08);
  --amber: #e69500;
  --amber-dim: #cc8400;
  --amber-bg: rgba(230, 149, 0, 0.08);
}

/* ── Base ── */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* ── Money Market Dashboard ── */
.money-market-metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.money-market-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
  margin: 0.35rem 0 1rem 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.money-market-source-links a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.money-market-source-links a:hover {
  color: var(--text);
  border-bottom-color: var(--cyan);
}

.money-market-data-note {
  margin: -0.45rem 0 1rem 0;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1.55;
}

.money-market-exhibit-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.money-market-target-panel {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  padding: 0;
}

.money-market-target-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  cursor: pointer;
  list-style: none;
  padding: 0.65rem 0.85rem;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

.money-market-target-panel summary::-webkit-details-marker {
  display: none;
}

.money-market-target-panel summary::before {
  content: "+";
  color: var(--text-muted);
  margin-right: 0.15rem;
}

.money-market-target-panel[open] summary::before {
  content: "-";
}

.money-market-target-summary {
  margin-left: auto;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-align: right;
}

.money-market-target-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
}

.money-market-target-form input {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 0.45rem 0.5rem;
}

.money-market-target-form button,
.money-market-target-form input[type="text"] {
  grid-column: span 2;
}

.money-market-liquidity-chart {
  min-height: 320px;
  padding: var(--space-3);
}

.money-market-liquidity-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ── HK Liquidity Dashboard ── */
.hk-liquidity-metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.global-liquidity-metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.hk-liquidity-signal {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: var(--space-4) 0 var(--space-3);
  color: var(--text);
  font-size: var(--text-lg);
  line-height: 1.35;
  flex-wrap: wrap;
}

.hk-liquidity-signal-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.hk-liquidity-change-value {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xl);
}

.hk-liquidity-change-value.ok,
.hk-liquidity-change-status.ok {
  color: var(--green);
}

.hk-liquidity-change-value.warn,
.hk-liquidity-change-status.warn {
  color: var(--amber);
}

.hk-liquidity-change-value.error,
.hk-liquidity-change-status.error {
  color: var(--red);
}

.hk-liquidity-change-status {
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0;
}

.hk-liquidity-regime.ok {
  color: var(--green);
}

.hk-liquidity-regime.warn {
  color: var(--amber);
}

.hk-liquidity-regime.error {
  color: var(--red);
}

.hk-liquidity-method-panel {
  margin-bottom: var(--space-5);
}

.hk-liquidity-plot {
  min-height: 420px;
  width: 100%;
}

.hk-liquidity-chart-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.hk-liquidity-display-label {
  display: grid;
  gap: var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.hk-liquidity-display-label select {
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  padding: 7px 10px;
  font: inherit;
}

.hk-liquidity-change-stats {
  margin: var(--space-2) 0 var(--space-3);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.hk-liquidity-factor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  padding: var(--space-4);
}

.hk-liquidity-factor-card {
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: var(--space-3);
}

.hk-liquidity-factor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.hk-liquidity-factor-top span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hk-liquidity-factor-top strong {
  color: var(--text-secondary);
  font-weight: 700;
}

.hk-liquidity-factor-value {
  margin-top: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.15;
}

.hk-liquidity-factor-value-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.hk-liquidity-factor-move {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  margin-bottom: 1px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.hk-liquidity-factor-move.looser {
  color: var(--green);
}

.hk-liquidity-factor-move.tighter {
  color: var(--red);
}

.hk-liquidity-factor-move.flat {
  color: var(--text-muted);
}

.hk-liquidity-factor-arrow {
  font-size: var(--text-lg);
  line-height: 0.9;
}

.hk-liquidity-factor-tone {
  font-family: var(--font-sans);
  font-weight: 800;
}

.hk-liquidity-factor-meta {
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.hk-liquidity-factor-read {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

/* ── Global Liquidity Dashboard ── */
.global-liquidity-signal {
  align-items: center;
}

.global-liquidity-method-panel {
  margin-bottom: var(--space-5);
}

.global-liquidity-overview-panel {
  margin-bottom: var(--space-5);
}

.global-liquidity-overview-grid,
.global-liquidity-region-grid,
.global-liquidity-transmission-grid {
  display: grid;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-4);
}

.global-liquidity-overview-grid {
  grid-template-columns: minmax(220px, 1.15fr) repeat(3, minmax(150px, 0.65fr));
  padding-top: var(--space-4);
}

.global-liquidity-region-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.global-liquidity-transmission-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.global-liquidity-focus-card,
.global-liquidity-region-card,
.global-liquidity-transmission-card {
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-3);
}

.global-liquidity-focus-card.primary {
  background: var(--surface-2);
  border-color: var(--border);
}

.global-liquidity-card-kicker,
.global-liquidity-card-label,
.global-liquidity-region-meta,
.global-liquidity-transmission-meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: uppercase;
}

.global-liquidity-card-value,
.global-liquidity-region-gap,
.global-liquidity-transmission-value {
  margin-top: var(--space-1);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.22rem;
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.global-liquidity-card-value.positive,
.global-liquidity-region-gap.positive,
.global-liquidity-transmission-value.positive,
.global-liquidity-region-pill.positive,
.global-liquidity-transmission-pill.positive,
.global-liquidity-card-value.ok,
.global-liquidity-region-gap.ok,
.global-liquidity-transmission-value.ok,
.global-liquidity-region-pill.ok,
.global-liquidity-transmission-pill.ok {
  color: var(--green);
}

.global-liquidity-card-value.negative,
.global-liquidity-region-gap.negative,
.global-liquidity-transmission-value.negative,
.global-liquidity-region-pill.negative,
.global-liquidity-transmission-pill.negative,
.global-liquidity-card-value.error,
.global-liquidity-region-gap.error,
.global-liquidity-transmission-value.error,
.global-liquidity-region-pill.error,
.global-liquidity-transmission-pill.error {
  color: var(--red);
}

.global-liquidity-card-value.warn,
.global-liquidity-region-gap.warn,
.global-liquidity-transmission-value.warn,
.global-liquidity-region-pill.warn,
.global-liquidity-transmission-pill.warn {
  color: var(--amber);
}

.global-liquidity-focus-card.primary .global-liquidity-card-value {
  font-size: 1.65rem;
}

.global-liquidity-delta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.25;
}

.global-liquidity-delta-line strong {
  color: var(--text-secondary);
  font-weight: 700;
  white-space: nowrap;
}

.global-liquidity-delta-line.positive strong {
  color: var(--green);
}

.global-liquidity-delta-line.negative strong {
  color: var(--red);
}

.global-liquidity-card-caption,
.global-liquidity-region-detail,
.global-liquidity-transmission-detail {
  margin-top: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.global-liquidity-region-top,
.global-liquidity-transmission-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.global-liquidity-region-top strong,
.global-liquidity-transmission-top strong {
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.global-liquidity-region-pill,
.global-liquidity-transmission-pill {
  flex: 0 0 auto;
  max-width: 112px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 7px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.global-liquidity-diagnostics-details {
  margin-bottom: var(--space-5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.global-liquidity-diagnostics-details summary {
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.global-liquidity-diagnostics-details .global-liquidity-metrics {
  padding: 0 var(--space-4) var(--space-4);
}

.global-liquidity-readout-panel {
  margin-bottom: var(--space-5);
}

.global-liquidity-observation-panel {
  margin-top: var(--space-4);
  margin-bottom: var(--space-5);
}

.global-liquidity-observation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  padding: var(--space-4);
}

.global-liquidity-observation-card {
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-3);
}

.global-liquidity-observation-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.global-liquidity-observation-top strong {
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.global-liquidity-observation-pill {
  flex: 0 0 auto;
  max-width: 132px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.global-liquidity-observation-value {
  margin-top: var(--space-3);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.global-liquidity-observation-read {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.global-liquidity-observation-pill.ok,
.global-liquidity-observation-value.ok {
  color: var(--green);
}

.global-liquidity-observation-pill.warn,
.global-liquidity-observation-value.warn {
  color: var(--amber);
}

.global-liquidity-observation-pill.error,
.global-liquidity-observation-value.error {
  color: var(--red);
}

.global-liquidity-readout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.9fr);
  gap: var(--space-4);
  padding: var(--space-4);
}

.global-liquidity-readout-takeaways ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.global-liquidity-readout-takeaways li + li {
  margin-top: var(--space-2);
}

.global-liquidity-readout-health {
  border-left: 1px solid var(--border-subtle);
  padding-left: var(--space-4);
}

.global-liquidity-health-top {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.global-liquidity-health-top span {
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
}

.global-liquidity-health-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.global-liquidity-health-row strong {
  min-width: 0;
  color: var(--text-secondary);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.global-liquidity-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
  padding: var(--space-4);
}

.global-liquidity-module-card {
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: var(--space-3);
}

.global-liquidity-module-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.global-liquidity-module-top strong {
  min-width: 0;
  color: var(--text-secondary);
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.global-liquidity-module-top span {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.global-liquidity-module-read {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.global-liquidity-plot {
  width: 100%;
  min-height: 430px;
}

.global-liquidity-main-dashboard {
  margin-top: var(--space-4);
}

.global-liquidity-main-dashboard .vix-chart-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.global-liquidity-chart-copy {
  min-width: 0;
}

.global-liquidity-main-dashboard .vix-chart-subtitle {
  line-height: 1.35;
  min-height: 17px;
}

.global-liquidity-chart-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: var(--space-2);
  min-width: max-content;
}

.global-liquidity-series-controls {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.global-liquidity-series-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 30px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.global-liquidity-series-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--green);
}

.global-liquidity-series-toggle:hover,
.global-liquidity-series-toggle:focus-within {
  color: var(--text);
}

.global-liquidity-chart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--surface-2);
}

.global-liquidity-chart-mode-btn {
  min-width: 72px;
  min-height: 30px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.global-liquidity-chart-mode-btn:hover,
.global-liquidity-chart-mode-btn:focus-visible {
  color: var(--text);
  outline: none;
}

.global-liquidity-chart-mode-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--card-shadow);
}

@media (max-width: 760px) {
  .global-liquidity-observation-grid,
  .global-liquidity-overview-grid,
  .global-liquidity-region-grid,
  .global-liquidity-transmission-grid {
    grid-template-columns: 1fr 1fr;
  }

  .global-liquidity-readout-grid {
    grid-template-columns: 1fr;
  }

  .global-liquidity-readout-health {
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
    padding-left: 0;
    padding-top: var(--space-4);
  }

  .global-liquidity-main-dashboard .vix-chart-header {
    grid-template-columns: 1fr;
  }

  .global-liquidity-chart-actions {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .global-liquidity-series-controls {
    width: 100%;
  }

  .global-liquidity-series-toggle {
    flex: 1;
    justify-content: center;
  }

  .global-liquidity-chart-toggle {
    width: 100%;
  }

  .global-liquidity-chart-mode-btn {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .global-liquidity-observation-grid {
    grid-template-columns: 1fr;
  }
}

/* ── US Market Breadth Dashboard ── */
.market-breadth-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.market-breadth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.market-breadth-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.market-breadth-panel-header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.market-breadth-title {
  font-weight: 700;
  font-size: var(--text-lg);
}

.market-breadth-subtitle {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.global-export-panel {
  overflow: hidden;
}

.global-export-panel .market-breadth-panel-header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.global-export-metric-toolbar {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  flex-shrink: 0;
}

.global-export-metric-toolbar .macro-plot-mode {
  min-height: 30px;
  padding: var(--space-1) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.global-export-metric-toolbar .macro-plot-mode:hover {
  color: var(--text);
}

.global-export-metric-toolbar .macro-plot-mode.active {
  background: var(--text);
  color: var(--bg);
}

.global-export-heatmap {
  width: 100%;
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scrollbar-width: thin;
  position: relative;
}

.global-export-freshness-banner {
  margin: var(--space-3) 0;
  padding: var(--space-3);
  border: 1px solid color-mix(in srgb, var(--amber) 52%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--amber) 14%, var(--surface));
  color: var(--text);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.global-export-grid {
  --cell-w: clamp(52px, 4.1vw, 68px);
  display: grid;
  grid-template-columns: minmax(156px, 190px) repeat(var(--month-count), minmax(var(--cell-w), 1fr));
  gap: 3px;
  min-width: calc(190px + var(--month-count) * var(--cell-w));
  align-items: stretch;
}

.global-export-axis-label,
.global-export-month {
  min-height: 28px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.global-export-month {
  justify-content: center;
  white-space: nowrap;
}

.global-export-row-label {
  position: sticky;
  left: 0;
  z-index: 2;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 0 var(--space-2);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: 8px 0 12px rgba(0, 0, 0, 0.08);
}

.global-export-axis-label {
  z-index: 3;
}

.global-export-country {
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
}

.global-export-row-meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.1;
}

.global-export-cell {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.global-export-cell.hot {
  background: color-mix(in srgb, var(--green) 72%, var(--surface));
  color: #04140a;
}

.global-export-cell.positive {
  background: color-mix(in srgb, var(--green) 38%, var(--surface));
}

.global-export-cell.soft {
  background: color-mix(in srgb, var(--amber) 32%, var(--surface));
}

.global-export-cell.negative {
  background: color-mix(in srgb, var(--red) 66%, var(--surface));
  color: #fff7f7;
}

.global-export-cell.missing {
  background: var(--surface-3);
  color: var(--text-faint);
}

.global-export-source-table td:nth-child(7) {
  min-width: 220px;
}

#globalExportsSourceTable {
  max-width: 100%;
  overflow-x: auto;
}

#globalExportsSourceTable .global-export-source-table {
  min-width: 980px;
}

#globalExportsSource {
  font-size: var(--text-base);
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

@media (max-width: 640px) {
  .global-export-panel .market-breadth-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .global-export-metric-toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .global-export-metric-toolbar .macro-plot-mode {
    flex: 0 0 auto;
  }
}

.market-breadth-index {
  text-align: right;
  font-family: var(--font-mono);
}

.market-breadth-index-value {
  font-size: var(--text-lg);
  font-weight: 700;
}

.market-breadth-index-change {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.market-breadth-ratio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  padding: var(--space-4);
}

.market-breadth-ratio-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: var(--space-3);
  min-width: 0;
}

.market-breadth-ratio-label {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

.market-breadth-ratio-value {
  margin-top: var(--space-1);
  font-size: var(--text-xl);
  line-height: 1.15;
  font-weight: 700;
}

.market-breadth-ratio-count {
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.market-breadth-chart {
  min-height: 240px;
  padding: 0 var(--space-4) var(--space-4);
}

.market-breadth-plot {
  display: none;
  width: 100%;
  height: 360px;
  min-height: 320px;
}

.market-breadth-chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.market-breadth-reset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 0.25rem 0.45rem;
  cursor: pointer;
}

.market-breadth-reset:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.market-breadth-chart canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  touch-action: none;
}

.market-breadth-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.market-breadth-axis {
  stroke: var(--border);
  stroke-width: 1;
}

.market-breadth-gridline {
  stroke: var(--border-subtle);
  stroke-width: 1;
}

.market-breadth-line-index {
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
}

.market-breadth-line-ma20 {
  fill: none;
  stroke: var(--green);
  stroke-width: 1.8;
}

.market-breadth-line-ma50 {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.8;
}

.market-breadth-line-ma200 {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.8;
}

.market-breadth-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-4);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.market-breadth-panel.is-plotly .market-breadth-legend {
  display: none;
}

.market-breadth-legend span::before {
  content: "";
  display: inline-block;
  width: 0.75rem;
  height: 0.15rem;
  margin-right: 0.35rem;
  vertical-align: middle;
  background: currentColor;
}

@media (max-width: 640px) {
  .market-breadth-plot {
    height: 340px;
    min-height: 310px;
  }
}

/* ── Macro Risk Structure Panel ── */
.macro-risk-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.macro-risk-module {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--card-shadow);
  padding: var(--space-4);
  min-width: 0;
}

.macro-risk-header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-2);
}

.macro-risk-title {
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.macro-risk-subtitle {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.35;
}

.macro-risk-source-inline {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.35;
}

.macro-risk-source-inline a,
.macro-risk-note a,
.macro-risk-component-label a {
  color: var(--accent);
  text-decoration: none;
}

.macro-risk-source-inline a:hover,
.macro-risk-note a:hover,
.macro-risk-component-label a:hover {
  text-decoration: underline;
}

.macro-risk-pill {
  margin-top: var(--space-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  text-align: center;
}

/* Role-model 3-zone row: gauge | time series | interpretation */
.macro-risk-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.78fr) minmax(280px, 1.9fr) minmax(190px, 0.92fr);
  gap: var(--space-4);
  align-items: stretch;
}

.macro-risk-gauge-zone {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.macro-risk-sublabel {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.macro-risk-chart-zone {
  min-width: 0;
}

.macro-risk-gauge,
.macro-risk-chart {
  width: 100%;
  min-width: 0;
}

.macro-risk-gauge {
  height: 180px;
  margin-top: auto;
}

.macro-risk-chart {
  height: 250px;
}

/* Interpretation (现况判读) sidebar */
.macro-risk-interp {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-left: 1px solid var(--border-subtle);
  padding-left: var(--space-3);
  min-width: 0;
}

.macro-risk-role {
  font-weight: 700;
  color: var(--text);
  font-size: var(--text-sm);
  line-height: 1.3;
}

.macro-risk-meaning {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.macro-risk-reading-block {
  margin-top: auto;
}

.macro-risk-reading-head {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.macro-risk-reading {
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
}

.macro-risk-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.macro-risk-stat {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: var(--space-2);
  min-width: 0;
}

.macro-risk-stat-label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.macro-risk-stat-value {
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.macro-risk-components {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.macro-risk-component {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  background: var(--surface);
  min-width: 0;
}

.macro-risk-component-label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.macro-risk-component-value {
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
}

.macro-risk-note {
  margin-top: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.macro-indicators-panel {
  margin-bottom: var(--space-4);
}

.macro-indicators-plot {
  width: 100%;
  min-height: 460px;
  padding: var(--space-2);
}

@media (max-width: 980px) {
  .macro-risk-row {
    grid-template-columns: 1fr;
  }

  .macro-risk-interp {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    padding-left: 0;
    padding-top: var(--space-3);
  }

  .macro-risk-reading-block,
  .macro-risk-gauge {
    margin-top: var(--space-2);
  }
}

/* ── CTA Treasury Dashboard ── */
.ust-yield-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.ust-tenor-select-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.ust-tenor-select-label select {
  min-width: 150px;
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.ust10y-plot {
  min-height: 420px;
  width: 100%;
}

.cta-treasury-summary {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.cta-treasury-panel {
  margin-bottom: var(--space-5);
}

.cta-treasury-method-note {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
}

.cta-treasury-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.cta-treasury-controls input[type="range"] {
  width: min(280px, 100%);
  accent-color: var(--cyan);
}

.cta-treasury-controls input[type="number"] {
  width: 92px;
  min-height: 34px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.cta-treasury-plot-stack {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.cta-treasury-plot {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  overflow: hidden;
}

#ctaTreasuryBetaPlot {
  min-height: 620px;
}

.cta-treasury-source-note {
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.55;
}

.mm-fit-grid {
  stroke: var(--border-subtle);
  stroke-width: 1;
}

.mm-fit-zero {
  stroke: var(--text-faint);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.mm-fit-dot {
  fill: var(--cyan);
  opacity: 0.58;
}

.mm-fit-latest-ring {
  fill: none;
  stroke: var(--red);
  stroke-width: 2;
}

.mm-fit-latest-dot {
  fill: var(--red);
  stroke: var(--bg);
  stroke-width: 1.5;
}

.mm-fit-line {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2;
}

.mm-fit-label,
.mm-fit-axis-label,
.mm-fit-latest-label {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.mm-fit-latest-label {
  fill: var(--red);
  font-weight: 600;
}

#moneyMarketChart {
  display: block;
  width: 100%;
  height: 430px;
}

.vix-cboe-plot {
  min-height: 400px;
  width: 100%;
}

.vix-spot-plot {
  min-height: 430px;
  width: 100%;
}

.money-market-plot {
  min-height: 430px;
  width: 100%;
}

.ois-plot {
  min-height: 360px;
  width: 100%;
}

@media (max-width: 860px) {
  .money-market-exhibit-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .vix-spot-plot {
    min-height: 360px;
  }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* ── Layout ── */
.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100dvh;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex: 0 0 276px;
  flex-direction: column;
  width: 276px;
  height: 100dvh;
  padding: var(--space-4);
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow: auto;
  transition: width var(--transition), flex-basis var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.logo {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0;
  white-space: nowrap;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: transform var(--transition), color var(--transition), border-color var(--transition);
}

.sidebar-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.sidebar-nav {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
  margin-top: auto;
  margin-bottom: auto;
}

.sidebar-section {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.sidebar-section-title {
  padding: 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar-section-list {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sidebar-link {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 42px;
  gap: var(--space-2);
  padding: var(--space-2);
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.sidebar-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--text);
  color: var(--bg);
}

.sidebar-link-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.sidebar-link.active .sidebar-link-kicker {
  border-color: transparent;
  background: var(--bg);
  color: var(--text);
}

.sidebar-link-label {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-guide-panel {
  display: grid;
  gap: var(--space-2);
  margin-top: 0;
  padding-top: var(--space-5);
}

.sidebar-guide-title {
  padding: 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar-guide-grid {
  display: grid;
  gap: 2px;
}

.sidebar-guide-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 34px;
  padding: var(--space-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-align: left;
  cursor: not-allowed;
}

.sidebar-guide-link-primary {
  border-style: solid;
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
}

.sidebar-guide-link-primary:hover {
  background: var(--text-secondary);
  border-color: var(--text-secondary);
}

.sidebar-guide-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
}

.sidebar-guide-collapsed {
  display: none;
}

body.sidebar-collapsed .app-sidebar {
  flex-basis: 76px;
  width: 76px;
  padding-right: var(--space-3);
  padding-left: var(--space-3);
  overflow: visible;
}

body.sidebar-collapsed .sidebar-nav {
  margin-top: auto;
  margin-bottom: auto;
}

body.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

body.sidebar-collapsed .logo,
body.sidebar-collapsed .sidebar-section-title,
body.sidebar-collapsed .sidebar-link-label,
body.sidebar-collapsed .sidebar-guide-panel {
  display: none;
}

body.sidebar-collapsed .sidebar-brand {
  position: absolute;
  top: var(--space-4);
  right: var(--space-3);
  left: var(--space-3);
  justify-content: center;
  margin-bottom: 0;
}

body.sidebar-collapsed .sidebar-link {
  grid-template-columns: 1fr;
  justify-items: center;
  padding-right: var(--space-1);
  padding-left: var(--space-1);
}

body.sidebar-collapsed .sidebar-link::before,
body.sidebar-collapsed .sidebar-link::after {
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity var(--transition), transform var(--transition);
}

body.sidebar-collapsed .sidebar-link::before {
  content: "";
  left: calc(100% + 5px);
  border-top: 5px solid transparent;
  border-right: 5px solid var(--text);
  border-bottom: 5px solid transparent;
}

body.sidebar-collapsed .sidebar-link::after {
  content: attr(data-tooltip);
  min-width: max-content;
  max-width: 220px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--card-shadow);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

body.sidebar-collapsed .sidebar-link:hover::before,
body.sidebar-collapsed .sidebar-link:hover::after,
body.sidebar-collapsed .sidebar-link:focus::before,
body.sidebar-collapsed .sidebar-link:focus::after,
body.sidebar-collapsed .sidebar-link:focus-visible::before,
body.sidebar-collapsed .sidebar-link:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (min-width: 981px) {
  .app-sidebar {
    justify-content: center;
    overflow: hidden;
  }

  .sidebar-brand {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
    margin-bottom: 0;
  }

  .sidebar-nav {
    width: 100%;
    max-height: calc(100dvh - 154px);
    margin-top: 0;
    margin-bottom: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
    scrollbar-width: thin;
  }

  .sidebar-guide-panel {
    position: absolute;
    right: var(--space-4);
    bottom: var(--space-4);
    left: var(--space-4);
    margin-top: 0;
    padding-top: 0;
  }

  body.sidebar-collapsed .sidebar-brand {
    right: var(--space-3);
    left: var(--space-3);
  }

  body.sidebar-collapsed .app-sidebar {
    overflow: visible;
  }

  body.sidebar-collapsed .sidebar-guide-collapsed {
    position: absolute;
    right: var(--space-3);
    bottom: var(--space-4);
    left: var(--space-3);
    display: grid;
    justify-items: center;
    gap: 3px;
    min-height: 46px;
    padding: var(--space-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--text);
    color: var(--bg);
    cursor: pointer;
    box-shadow: var(--card-shadow);
  }

  body.sidebar-collapsed .sidebar-guide-collapsed span {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
  }

  body.sidebar-collapsed .sidebar-guide-collapsed strong {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    line-height: 1;
    letter-spacing: 0;
    text-transform: uppercase;
  }
}

/* ── Indicator Guide Modal ── */
.indicator-guide-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: var(--space-4);
}

.indicator-guide-modal.hidden {
  display: none;
}

.indicator-guide-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 18, 0.58);
}

.indicator-guide-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: var(--space-4);
  width: min(760px, 100%);
  max-height: min(88dvh, 880px);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
  overflow: auto;
}

.indicator-guide-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.indicator-guide-hero {
  display: grid;
  min-height: 96px;
  align-content: end;
  padding: var(--space-3);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(20, 24, 33, 0.92), rgba(20, 24, 33, 0.5)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 0 2px, transparent 2px 20px),
    var(--surface-2);
  color: #fff;
}

.indicator-guide-kicker {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.74;
}

.indicator-guide-hero h2 {
  margin: 3px 0 1px;
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  line-height: 1;
  letter-spacing: 0;
}

.indicator-guide-hero p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  line-height: 1.3;
}

.indicator-guide-note {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: 18px;
  background: var(--surface-2);
}

.indicator-guide-note-title,
.indicator-guide-section-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: uppercase;
}

.indicator-guide-note-body {
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.65;
  white-space: pre-line;
}

.indicator-guide-dynamic-block {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: var(--surface);
}

.indicator-guide-dynamic-block[hidden] {
  display: none;
}

.indicator-guide-readout-meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.35;
}

.indicator-guide-readout-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.indicator-guide-readout-list li + li {
  margin-top: var(--space-2);
}

.indicator-guide-readout-health {
  display: grid;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.4;
}

.indicator-guide-readout-health .ok { color: var(--green); }
.indicator-guide-readout-health .warn { color: var(--amber); }
.indicator-guide-readout-health .error { color: var(--red); }

.indicator-guide-lens-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.indicator-guide-lens-card {
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: var(--space-3);
}

.indicator-guide-lens-top {
  display: grid;
  gap: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.35;
}

.indicator-guide-lens-top strong {
  color: var(--text);
}

.indicator-guide-lens-top span {
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
}

.indicator-guide-lens-text {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.indicator-guide-resources-block {
  display: grid;
  gap: var(--space-2);
}

.indicator-guide-resources-block[hidden] {
  display: none;
}

.indicator-guide-resources {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.indicator-guide-resource {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 58px;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.indicator-guide-resource:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
}

.indicator-guide-resource-title {
  display: block;
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.indicator-guide-resource-desc {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.indicator-guide-resource-arrow {
  color: var(--text-muted);
  font-size: 1.25rem;
}

.indicator-guide-done {
  min-height: 46px;
  border: 1px solid var(--text);
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
  flex: 1 1 auto;
}

.header-page {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.header-page-kicker {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0;
}

.header-page h1 {
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
}

.header-page p {
  max-width: 760px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}


/* ── Header Badge ── */
.header-badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  letter-spacing: 0.04em;
}

.btn-settings {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-3);
}

/* ── Settings Panel ── */
.settings-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  overflow: hidden;
  animation: slideDown 200ms ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.settings-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-base);
  padding: var(--space-1);
  line-height: 1;
}

.settings-close:hover { color: var(--text); }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
}

.settings-group {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}

.settings-group legend {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 var(--space-2);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.setting-row label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
}

.setting-row input {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  width: 72px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  text-align: right;
}

.setting-row input:focus {
  outline: none;
  border-color: var(--cyan);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-subtle);
}

/* ── Theme Toggle ── */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.theme-toggle:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ── Summary Banner ── */
.summary-banner {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.summary-banner .signal-buy { color: var(--green); font-weight: 700; }
.summary-banner .signal-sell { color: var(--red); font-weight: 700; }
.summary-banner .signal-hold { color: var(--amber); font-weight: 700; }
.summary-banner .score-val { font-weight: 700; }
.summary-banner .fallbacks { color: var(--text-muted); }

/* ── Action Buttons ── */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.btn {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--surface);
}

.btn.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-muted);
}

.momentum-view-btn.active {
  background: rgba(0, 230, 118, 0.12);
  color: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(0, 230, 118, 0.2);
}

.momentum-rules-panel {
  margin: 0 0 var(--space-5) 0;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.momentum-rule-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-3);
}

.momentum-rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.momentum-rule-grid div {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.momentum-rule-grid strong {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--cyan);
}

.momentum-rule-grid span {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.55;
  color: var(--text-secondary);
}

.btn-primary {
  border-color: var(--red);
  color: var(--red);
}

.btn-primary:hover {
  background: var(--red-bg);
  border-color: var(--red-dim);
  color: var(--red-dim);
}

.btn-primary.loading {
  pointer-events: none;
  opacity: 0.6;
}

/* ── Output Section ── */
.output-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.output-header {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.output-body {
  padding: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  min-height: 120px;
}

.output-body .line-pass { color: var(--green); }
.output-body .line-info { color: var(--text-muted); }
.output-body .line-fail { color: var(--text-muted); }
.output-body .line-warn { color: var(--amber); }
.output-body .signal-buy { color: var(--green); font-weight: 700; }
.output-body .signal-sell { color: var(--red); font-weight: 700; }
.output-body .signal-hold { color: var(--amber); font-weight: 700; }

/* Loading spinner */
.loading-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-8) 0;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Dimension Cards ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  transition: border-color var(--transition);
}

.card:hover {
  border-color: var(--text-faint);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

.card-asof {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

.card-score {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
}

.card-score.full { background: var(--green-bg); color: var(--green); }
.card-score.partial { background: var(--amber-bg); color: var(--amber); }
.card-score.zero { background: var(--red-bg); color: var(--red); }

.card-metrics {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
}

.metric-label {
  color: var(--text-secondary);
  font-family: var(--font-body);
}

.metric-value {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
}

.metric-value.positive { color: var(--green); }
.metric-value.negative { color: var(--red); }

/* Status indicators */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: var(--space-1);
}

.status-dot.ok { background: var(--green); }
.status-dot.warn { background: var(--amber); }
.status-dot.error { background: var(--red); }

/* ── Sparkline ── */
.sparkline-container {
  margin-top: var(--space-3);
  height: 40px;
  width: 100%;
}

.sparkline-container svg {
  width: 100%;
  height: 100%;
}

.sparkline-line {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.5;
}

.sparkline-area {
  fill: rgba(0, 188, 212, 0.08);
}

/* ── BTC Signal Chart ── */
.btc-chart-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.btc-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.btc-chart-header h3 {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.btc-chart-header p {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.btc-chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.btc-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}

.legend-line,
.legend-dash,
.legend-turn {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 2px solid var(--cyan);
}

.legend-line.score { border-color: var(--amber); }
.legend-dash {
  border-color: var(--text-muted);
  border-top-style: dashed;
}

.legend-turn {
  width: 0;
  height: 0;
  border-top: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid var(--green);
}

.legend-turn.sell {
  border-bottom: 0;
  border-top: 9px solid var(--red);
}

.legend-turn.hold {
  width: 9px;
  height: 9px;
  border: 0;
  background: var(--amber);
  transform: rotate(45deg);
}

.btc-chart-body {
  min-height: 430px;
  padding: var(--space-4) var(--space-5) var(--space-5);
  overflow: hidden;
}

.btc-chart-body > svg {
  width: 100%;
  min-width: 720px;
  height: 360px;
  display: block;
  font-family: var(--font-mono);
}

.btc-chart-plot .modebar-btn svg {
  width: 1em;
  min-width: 0;
  height: 1em;
  display: inline-block;
  font-family: inherit;
}

.btc-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.btc-chart-reset {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btc-chart-reset:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--surface-2);
}

.btc-chart-canvas-wrap {
  width: 100%;
  height: 390px;
}

.btc-chart-canvas-wrap.is-plotly {
  height: auto;
}

.btc-chart-plot {
  display: none;
  width: 100%;
  height: 430px;
  min-height: 390px;
}

.btc-chart-canvas-wrap canvas {
  width: 100%;
  height: 390px;
  display: block;
  cursor: crosshair;
}

.btc-chart-grid {
  stroke: var(--border-subtle);
  stroke-width: 1;
}

.btc-chart-axis {
  stroke: var(--border);
  stroke-width: 1;
}

.btc-chart-label {
  fill: var(--text-muted);
  font-size: 10px;
}

.btc-chart-title {
  fill: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.btc-chart-price-line {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2.4;
}

.btc-chart-price-area {
  fill: rgba(0, 188, 212, 0.08);
}

.btc-chart-score-line {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2.4;
}

.btc-signal-turn line {
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-dasharray: 2 3;
}

.btc-signal-turn polygon {
  fill: currentColor;
  stroke: var(--surface);
  stroke-width: 1.4;
}

.btc-signal-turn text {
  fill: currentColor;
  font-size: 9px;
  font-weight: 800;
}

.btc-signal-turn-buy { color: var(--green); }
.btc-signal-turn-sell { color: var(--red); }
.btc-signal-turn-hold { color: var(--amber); }

.btc-chart-threshold {
  stroke: var(--text-muted);
  stroke-width: 1.2;
  stroke-dasharray: 5 5;
}

.btc-zone-buy { fill: var(--green-bg); }
.btc-zone-hold { fill: var(--amber-bg); }
.btc-zone-sell { fill: var(--red-bg); }

.btc-chart-note {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Data Source Status Bar ── */
.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ── History Table ── */
.history-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.history-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 1px 0 var(--border);
  backdrop-filter: blur(8px);
}

.history-table th[data-sortable="1"] {
  cursor: pointer;
  user-select: none;
}

.history-table th[data-sortable="1"]:hover {
  color: var(--text);
}

.history-table .sort-indicator {
  display: inline-block;
  margin-left: 0.35rem;
  color: var(--text-muted);
  font-size: 0.8em;
}

.history-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
  white-space: nowrap;
}

.history-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.015);
}

.history-table tr:hover td {
  background: var(--surface-2);
}

.data-table-section {
  min-width: 720px;
  margin: 0 0 var(--space-5) 0;
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.012);
}

.data-table-section:last-child {
  margin-bottom: 0;
}

.data-table-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3) 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.data-table-section-title::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}

.data-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: 0 0 var(--space-2) 0;
}

.data-table-toolbar-left,
.data-table-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.data-table-toolbar-simple {
  justify-content: flex-end;
}

.data-table-search {
  width: min(280px, 100%);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.38rem 0.5rem;
}

.data-table-filter {
  max-width: 220px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.38rem 1.8rem 0.38rem 0.5rem;
}

.data-table-reset,
.data-table-export {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  padding: 0.38rem 0.65rem;
  cursor: pointer;
}

.data-table-reset {
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
}

.data-table-reset:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface-2);
}

.data-table-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.data-table-export {
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.35);
}

.data-table-export:hover {
  background: rgba(0, 229, 255, 0.12);
  border-color: var(--cyan);
}

.data-table-export-muted {
  color: var(--text-secondary);
  background: transparent;
  border-color: var(--border);
}

.data-table-export-muted:hover {
  color: var(--cyan);
  border-color: rgba(0, 229, 255, 0.35);
}

.data-table-search:focus,
.data-table-filter:focus {
  outline: none;
  border-color: var(--cyan);
}

/* ── Rules Table ── */
.rules-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.rules-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rules-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.rules-table .cat-header td {
  font-weight: 600;
  color: var(--text);
  padding-top: var(--space-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

/* ── Manual Input ── */
.manual-input-section {
  background: var(--surface-2);
  border: 1px dashed var(--amber);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-top: var(--space-3);
}

.manual-input-section h4 {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--amber);
  margin-bottom: var(--space-3);
}

.manual-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}

.manual-input-row label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  min-width: 140px;
}

.manual-input-row input {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  width: 180px;
}

.manual-input-row input:focus {
  outline: none;
  border-color: var(--amber);
}

.manual-submit {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--amber);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--amber);
  cursor: pointer;
  transition: all var(--transition);
}

.manual-submit:hover {
  background: var(--amber-bg);
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: var(--space-6) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--space-8);
}

.footer a {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-decoration: none;
}

.footer a:hover {
  color: var(--text-secondary);
}

/* ── Responsive ── */
@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .app-sidebar,
  body.sidebar-collapsed .app-sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: block;
    width: 100%;
    height: auto;
    padding: var(--space-3) var(--space-4);
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .sidebar-brand {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    min-width: max-content;
    margin-top: 0;
    margin-bottom: 0;
  }

  .sidebar-section,
  .sidebar-section-list {
    display: flex;
    align-items: center;
    min-width: max-content;
  }

  .sidebar-section {
    gap: var(--space-2);
  }

  .sidebar-section-list {
    gap: var(--space-1);
  }

  .sidebar-section-title,
  body.sidebar-collapsed .sidebar-section-title {
    display: block;
    padding: 0;
    font-size: 0.68rem;
    white-space: nowrap;
  }

  .sidebar-link,
  body.sidebar-collapsed .sidebar-link {
    display: inline-grid;
    grid-template-columns: auto;
    justify-items: start;
    width: auto;
    min-width: 104px;
    min-height: 36px;
    padding: var(--space-2) var(--space-3);
  }

  .sidebar-link-kicker {
    display: none;
  }

  .sidebar-link-label,
  body.sidebar-collapsed .sidebar-link-label {
    display: block;
    max-width: 128px;
    font-size: var(--text-xs);
  }

  .sidebar-guide-panel {
    display: none;
  }

  .sidebar-guide-collapsed {
    display: none;
  }

  .indicator-guide-card {
    max-height: 92dvh;
    padding: var(--space-3);
    border-radius: 18px;
  }

  .indicator-guide-hero {
    min-height: 88px;
    padding: var(--space-3);
  }

  .indicator-guide-lens-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .indicator-guide-resource {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .container {
    max-width: none;
  }
}

@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .btc-chart-header,
  .btc-chart-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .btc-chart-body {
    padding: var(--space-3);
  }

  .btc-chart-plot {
    height: 420px;
    min-height: 390px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-left {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .summary-banner {
    font-size: var(--text-xs);
    padding: var(--space-3);
  }

  .output-body {
    font-size: var(--text-xs);
    padding: var(--space-3);
  }

  .actions {
    gap: var(--space-1);
  }

  .btn {
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-3);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-3);
  }

  .card {
    padding: var(--space-3);
  }
}

.china-rates-signal-board {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.china-core-rates-section {
  margin-bottom: var(--space-5);
}

.china-backtest-section {
  margin-top: var(--space-3);
}

.china-core-rates-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.china-core-rates-toggle:hover {
  border-color: var(--text-muted);
}

.china-core-rates-toggle-main {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.china-core-rates-toggle .output-header {
  margin: 0;
}

.china-core-rates-toggle-icon {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  transition: transform var(--transition);
}

.china-core-rates-toggle[aria-expanded="true"] .china-core-rates-toggle-icon {
  transform: rotate(90deg);
}

.china-core-rates-toggle-summary {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-align: right;
}

.china-core-rates-panel {
  padding-top: var(--space-3);
}

.china-core-rates-window-strip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.china-core-rates-window-label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
}

.china-core-rates-window-btn {
  min-width: 42px;
  height: 30px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
}

.china-core-rates-window-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.china-core-rates-window-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.chart-backtest-panel {
  padding-top: var(--space-3);
}

.china-core-rates-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.china-core-rate-card {
  min-height: 128px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.china-core-rate-top,
.china-core-rate-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.china-core-rate-label {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 800;
}

.china-core-rate-source {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.china-core-rate-value {
  margin: var(--space-3) 0 var(--space-2);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.china-core-rate-meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.china-core-rate-delta.up {
  color: var(--red);
}

.china-core-rate-delta.down {
  color: var(--green);
}

.china-core-rate-delta.flat {
  color: var(--text-secondary);
}

.china-core-rate-note {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.4;
}

.china-core-rates-chart-wrap {
  min-height: 420px;
  margin-bottom: var(--space-2);
}

.china-core-rates-plot {
  display: none;
  width: 100%;
  height: 440px;
  min-height: 400px;
}

.china-core-rates-chart-wrap canvas {
  height: 400px;
}

.china-core-rates-source {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.china-core-rates-source a {
  color: var(--cyan);
  text-decoration: none;
}

.china-core-rates-source a:hover {
  text-decoration: underline;
}

.china-macro-framework-board,
.china-macro-chart-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.china-macro-page {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.china-macro-page > * {
  min-width: 0;
}

.china-macro-framework-board {
  min-width: 0;
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}

.china-macro-page .china-macro-framework-board {
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0;
  background: transparent;
}

.china-macro-coverage {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  min-width: 0;
  width: 100%;
  margin-bottom: var(--space-4);
}

.china-macro-coverage > div {
  min-height: 76px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  background: var(--bg-elevated);
}

.china-macro-coverage span {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.china-macro-coverage strong {
  display: block;
  margin-top: var(--space-2);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xl);
}

.china-macro-theme-card span {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.china-macro-theme-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  min-width: 0;
}

.china-macro-theme-card {
  min-width: 0;
  min-height: 132px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  text-align: left;
  background: var(--surface);
  cursor: pointer;
}

.china-macro-theme-card:hover {
  border-color: var(--text-muted);
  background: var(--bg-elevated);
}

.china-macro-theme-card.ok {
  border-color: rgba(77, 211, 156, 0.32);
}

.china-macro-theme-card.partial {
  border-color: rgba(245, 158, 11, 0.34);
}

.china-macro-theme-card.missing {
  border-color: rgba(220, 38, 38, 0.28);
}

.china-macro-theme-card.no-chart {
  cursor: default;
  opacity: 0.72;
}

.china-macro-theme-card.no-chart:hover {
  border-color: var(--border-subtle);
  background: var(--surface);
}

.china-macro-theme-card strong {
  display: block;
  margin-top: var(--space-2);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: 800;
}

.china-macro-theme-card em {
  display: block;
  margin-top: 5px;
  min-height: 30px;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-style: normal;
  line-height: 1.35;
}

.china-macro-theme-card b {
  display: block;
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
}

.china-macro-source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-2);
}

.china-macro-source-btn {
  min-height: 26px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
}

.china-macro-source-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.china-macro-source-btn.compact {
  min-height: 23px;
  padding: 0 7px;
}

.china-macro-chart-panel {
  padding: var(--space-3);
}

.china-macro-chart-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.china-macro-chart-tab-group {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.china-macro-chart-tab-group > span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.china-macro-chart-tab-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.china-macro-chart-tab {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-2);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}

.china-macro-chart-tab:hover:not(.disabled) {
  color: var(--text);
  border-color: var(--text-muted);
}

.china-macro-chart-tab.active {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

.china-macro-chart-tab.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.china-macro-chart-meta {
  margin-bottom: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.china-macro-chart-wrap {
  min-height: 430px;
}

.china-macro-framework-plot {
  width: 100%;
  height: 430px;
  min-height: 380px;
}

.china-macro-framework-plot.is-policy-nlp {
  height: auto;
  min-height: 0;
}

.china-macro-policy-nlp {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
}

.china-macro-policy-header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
  min-width: 0;
}

.china-macro-policy-header > div:first-child {
  min-width: 0;
}

.china-macro-policy-header span,
.china-macro-policy-toolbar span,
.china-macro-policy-section-head span {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.china-macro-policy-header strong {
  display: block;
  margin-top: 5px;
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: 800;
  line-height: 1.35;
}

.china-macro-policy-header em {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-style: normal;
}

.china-macro-policy-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.china-macro-policy-source-links a {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 9px;
  color: var(--text-secondary);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 10px;
  text-decoration: none;
}

.china-macro-policy-source-links a:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.china-macro-policy-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.9fr);
  gap: var(--space-3);
  min-width: 0;
}

.china-macro-policy-toolbar > div {
  min-width: 0;
}

.china-macro-policy-toolbar > div > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.china-macro-policy-chip,
.china-macro-policy-report-link {
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 9px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
}

.china-macro-policy-chip:hover,
.china-macro-policy-report-link:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.china-macro-policy-chip.active {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.china-macro-policy-main {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: var(--space-3);
  min-width: 0;
}

.china-macro-policy-cloud-section,
.china-macro-policy-stance-section,
.china-macro-policy-trend-section,
.china-macro-policy-semantics section {
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  background: var(--bg-elevated);
}

.china-macro-policy-section-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  align-items: baseline;
  margin-bottom: var(--space-2);
}

.china-macro-policy-section-head h4,
.china-macro-policy-semantics h4 {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
}

.china-macro-policy-word-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  min-height: 360px;
  padding: var(--space-2);
  overflow: hidden;
}

.china-macro-policy-word {
  max-width: 100%;
  color: var(--word-color);
  opacity: var(--word-opacity);
  font-size: var(--word-size);
  font-weight: var(--word-weight);
  line-height: 1.05;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  text-rendering: geometricPrecision;
}

.china-macro-policy-stance {
  display: grid;
  gap: var(--space-2);
}

.china-macro-policy-stance-summary {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  align-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  background: var(--surface);
}

.china-macro-policy-stance-summary strong {
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.china-macro-policy-stance-summary span {
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-align: right;
}

.china-macro-policy-meter {
  display: grid;
  gap: 5px;
}

.china-macro-policy-meter-top,
.china-macro-policy-meter-labels {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.china-macro-policy-meter-top strong {
  color: var(--text-secondary);
}

.china-macro-policy-meter-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.25), rgba(148, 163, 184, 0.22), rgba(220, 38, 38, 0.25));
}

.china-macro-policy-meter.policy-stance .china-macro-policy-meter-track {
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.25), rgba(148, 163, 184, 0.22), rgba(37, 99, 235, 0.25));
}

.china-macro-policy-meter-track i {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 18px;
  border: 2px solid var(--text);
  border-radius: 999px;
  background: var(--surface);
  transform: translate(-50%, -50%);
}

.china-macro-policy-stance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.china-macro-policy-stance-box {
  min-width: 0;
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  background: var(--surface);
}

.china-macro-policy-stance-box.dovish { border-left-color: #2563eb; }
.china-macro-policy-stance-box.hawkish { border-left-color: #dc2626; }
.china-macro-policy-stance-box.risk { border-left-color: #ea580c; }
.china-macro-policy-stance-box.confidence { border-left-color: #16a34a; }

.china-macro-policy-stance-box span,
.china-macro-policy-stance-box em {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-style: normal;
}

.china-macro-policy-stance-box strong {
  display: block;
  margin: 4px 0;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 18px;
}

.china-macro-policy-semantics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  min-width: 0;
}

.china-macro-policy-semantic-row,
.china-macro-policy-cluster-row {
  display: grid;
  gap: 5px;
  padding: 8px 0;
  border-top: 1px solid var(--border-subtle);
}

.china-macro-policy-semantic-row:first-of-type,
.china-macro-policy-cluster-row:first-of-type {
  border-top: 0;
}

.china-macro-policy-semantic-row > div,
.china-macro-policy-cluster-row > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}

.china-macro-policy-semantic-row strong,
.china-macro-policy-cluster-row strong {
  color: var(--text-primary);
  font-size: var(--text-xs);
}

.china-macro-policy-semantic-row span,
.china-macro-policy-cluster-row span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: right;
}

.china-macro-policy-semantic-row p,
.china-macro-policy-cluster-row p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.china-macro-policy-cluster-row p {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.china-macro-policy-cluster-row p b {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px 5px;
  color: var(--text-secondary);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

.china-macro-policy-trend-plot {
  width: 100%;
  height: 310px;
  min-height: 270px;
}

.china-macro-policy-report-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.china-macro-policy-report-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.china-macro-policy-report-table th,
.china-macro-policy-report-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-align: left;
  vertical-align: top;
}

.china-macro-policy-report-table th {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.china-macro-policy-report-table tbody tr:last-child td {
  border-bottom: 0;
}

.china-macro-policy-report-link {
  color: var(--text-secondary);
}

.china-macro-policy-empty {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.china-macro-source-modal-panel {
  max-width: 760px;
}

.china-macro-source-modal-body {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.china-macro-source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.china-macro-source-grid > div {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  background: var(--bg-elevated);
}

.china-macro-source-grid span {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.china-macro-source-grid strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: var(--text-primary);
  font-size: var(--text-xs);
}

.china-macro-source-open {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--text);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-3);
  color: var(--bg);
  background: var(--text);
  font-size: var(--text-xs);
  font-weight: 800;
  text-decoration: none;
}

.china-macro-source-deploy-note {
  margin-top: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  color: var(--text-muted);
  background: var(--bg-elevated);
  font-size: var(--text-xs);
}

@media (max-width: 900px) {
  .china-core-rates-toggle {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-2);
  }

  .china-core-rates-toggle-summary {
    text-align: left;
  }

  .china-core-rates-grid {
    grid-template-columns: 1fr;
  }

  .china-core-rates-window-strip {
    align-items: flex-start;
  }

  .china-core-rates-plot {
    height: 390px;
    min-height: 360px;
  }

  .china-macro-coverage,
  .china-macro-theme-rail,
  .china-macro-source-grid,
  .china-macro-policy-toolbar,
  .china-macro-policy-main,
  .china-macro-policy-semantics {
    grid-template-columns: 1fr;
  }

  .china-macro-policy-header {
    flex-direction: column;
  }

  .china-macro-policy-source-links {
    justify-content: flex-start;
  }

  .china-macro-chart-wrap,
  .china-macro-framework-plot {
    min-height: 360px;
    height: 380px;
  }

  .china-macro-framework-plot.is-policy-nlp {
    height: auto;
    min-height: 0;
  }

  .china-macro-policy-word-cloud {
    min-height: 300px;
  }

  .china-macro-policy-word {
    font-size: min(var(--word-size), 32px);
  }

  .china-macro-policy-trend-plot {
    height: 270px;
  }
}

#pageOis .vix-chart-wrapper {
  min-height: 360px;
}

#pageOis .vix-chart-wrapper canvas {
  height: 360px;
}

#pageUst10y .ust-curve-chart-wrap {
  min-height: 420px;
}

#pageUst10y .ust-curve-plot {
  width: 100%;
  min-height: 420px;
}

.ust-curve-plot-empty {
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.ust-curve-panel {
  margin-top: var(--space-5);
}

.ust-curve-toggles {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-3);
}

.ust-curve-value-up {
  color: var(--green);
}

.ust-curve-value-down {
  color: var(--red);
}

.ust-curve-muted {
  color: var(--text-muted);
  font-size: 0.9em;
}

.ois-range-strip {
  display: block;
  min-height: 30px;
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.018);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}

.ois-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.ois-export-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  margin-bottom: var(--space-5);
  overflow: hidden;
}

.ois-export-controls {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(280px, 2fr) minmax(140px, auto);
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-4) var(--space-5);
}

.ois-accrual-controls {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(160px, 0.8fr) minmax(160px, auto);
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-4) var(--space-5);
}

.ois-accrual-controls.compact {
  grid-template-columns: minmax(160px, max-content);
}

.ois-export-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ois-export-field label,
.ois-export-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0;
}

.ois-export-field select,
.ois-export-field input,
.ois-export-custom-dates input {
  height: 34px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 0 var(--space-2);
}

.ois-export-custom-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.ois-export-columns {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.ois-export-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
  user-select: none;
}

.ois-export-toggle input {
  width: 13px;
  height: 13px;
  accent-color: var(--cyan);
}

.ois-export-toggle.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ois-export-action {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
}

.ois-export-status {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.ois-export-status.negative {
  color: var(--red);
}

.ois-accrual-formula {
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.45;
  overflow-wrap: anywhere;
  padding: var(--space-3) var(--space-5);
}

.ois-control-group,
.ois-series-toggles {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.ois-control-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0;
}

.ois-range-btn {
  min-width: 42px;
  height: 30px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
}

.ois-range-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.ois-range-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.ois-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.ois-panel {
  margin-bottom: 0;
}

.ois-series-toggles {
  padding: var(--space-3) var(--space-5) 0;
}

.ois-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
  user-select: none;
}

.ois-toggle input {
  width: 13px;
  height: 13px;
  accent-color: var(--cyan);
}

.ois-swatch {
  width: 10px;
  height: 3px;
  border-radius: 999px;
}

.ois-chart-wrap {
  position: relative;
}

.ois-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 160px;
  max-width: 240px;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(12, 18, 28, 0.96);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.ois-tooltip strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.ois-formula-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.ois-formula-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.014);
}

.ois-formula-title {
  margin-bottom: var(--space-1);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.ois-formula-text {
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.55;
}

.china-rates-category {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.china-rates-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.china-rates-category-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.china-rates-category-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}

.china-rates-category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.china-rates-mini-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
}

.china-rates-mini-card.risk-on {
  border-color: rgba(77, 211, 156, 0.42);
}

.china-rates-mini-card.risk-off {
  border-color: rgba(255, 142, 142, 0.46);
}

.china-rates-mini-card.is-deferred {
  opacity: 0.82;
}

.china-rates-mini-layout {
  display: grid;
  grid-template-columns: minmax(190px, 0.78fr) minmax(360px, 1.9fr) minmax(220px, 0.92fr);
  gap: var(--space-4);
  padding: var(--space-3);
  align-items: stretch;
}

.china-rates-mini-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.china-rates-mini-title {
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.35;
}

.china-rates-mini-subtitle {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.35;
}

.china-rates-mini-status {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
}

.china-rates-mini-gauge-zone,
.china-rates-mini-chart-zone,
.china-rates-mini-interpretation {
  min-width: 0;
}

.china-rates-mini-gauge-zone {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.china-rates-mini-reading {
  margin-top: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.45;
  padding: var(--space-2);
}

.china-rates-mini-chart-zone {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.china-rates-inline-chart-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: 0;
  min-height: 250px;
  min-width: 0;
  overflow: hidden;
}

.china-rates-inline-chart {
  width: 100%;
  height: 250px;
  display: block;
}

.china-rates-inline-plot {
  min-height: 250px;
}

.china-rates-inline-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.china-rates-inline-chart .grid {
  fill: none;
  stroke: rgba(148, 163, 184, 0.22);
  stroke-width: 1;
}

.china-rates-inline-chart .zero-line {
  fill: none;
  stroke: rgba(148, 163, 184, 0.40);
  stroke-dasharray: 4 4;
  stroke-width: 1;
}

.china-rates-inline-chart .area {
  fill: rgba(148, 163, 184, 0.14);
}

.china-rates-inline-chart .line {
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.china-rates-inline-chart .latest-dot {
  fill: var(--text-secondary);
  stroke: var(--surface);
  stroke-width: 2;
}

.china-rates-inline-chart .latest-label {
  fill: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}

.china-rates-inline-chart .axis-label,
.china-rates-inline-chart .empty {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.china-rates-inline-chart.risk-on .line,
.china-rates-inline-chart.risk-on .latest-dot {
  stroke: #3cc78f;
  fill: #3cc78f;
}

.china-rates-inline-chart.risk-on .area {
  fill: rgba(60, 199, 143, 0.18);
}

.china-rates-inline-chart.risk-off .line,
.china-rates-inline-chart.risk-off .latest-dot {
  stroke: #ff8e8e;
  fill: #ff8e8e;
}

.china-rates-inline-chart.risk-off .area {
  fill: rgba(255, 142, 142, 0.18);
}

.china-rates-inline-chart-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 6px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.25;
}

.china-rates-inline-chart-stats span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.china-rates-mini-kpis {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--space-2);
}

.china-rates-mini-kpi-group {
  display: grid;
  gap: var(--space-2);
}

.china-rates-mini-kpi-group.signal {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.china-rates-mini-kpi-group.latest {
  grid-template-columns: minmax(0, 1fr);
}

.china-rates-mini-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.china-rates-mini-kpi-label {
  font-size: 10px;
  color: var(--text-muted);
}

.china-rates-mini-kpi-value {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text);
  overflow-wrap: anywhere;
}

.china-rates-mini-kpi-value.delta.up { color: var(--red); }
.china-rates-mini-kpi-value.delta.down { color: var(--green); }
.china-rates-mini-kpi-value.delta.flat { color: var(--text-secondary); }
.china-rates-mini-kpi-value.live.up { color: var(--red); }
.china-rates-mini-kpi-value.live.down { color: var(--green); }
.china-rates-mini-kpi-value.live.flat { color: var(--text); }

.china-rates-mini-sparkline-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: 6px 8px;
}

.china-rates-mini-expand-btn {
  align-self: flex-start;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  border-radius: 999px;
  padding: 3px 8px;
  cursor: pointer;
}

.china-rates-mini-expand-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.china-rates-mini-sparkline {
  width: 100%;
  height: 44px;
  display: block;
}

.china-rates-mini-sparkline .track {
  stroke: var(--border);
  stroke-width: 1;
  fill: none;
}

.china-rates-mini-sparkline .area {
  fill: rgba(148, 163, 184, 0.16);
}

.china-rates-mini-sparkline .line {
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.china-rates-mini-sparkline .dot {
  fill: var(--text-secondary);
}

.china-rates-mini-sparkline.risk-on .line,
.china-rates-mini-sparkline.risk-on .dot {
  stroke: #3cc78f;
  fill: #3cc78f;
}

.china-rates-mini-sparkline.risk-on .area {
  fill: rgba(60, 199, 143, 0.20);
}

.china-rates-mini-sparkline.risk-off .line,
.china-rates-mini-sparkline.risk-off .dot {
  stroke: #ff8e8e;
  fill: #ff8e8e;
}

.china-rates-mini-sparkline.risk-off .area {
  fill: rgba(255, 142, 142, 0.20);
}

.china-rates-mini-sparkline-stats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.2;
}

.china-rates-mini-sparkline-stats .stat-item {
  white-space: nowrap;
}

.china-rates-mini-interpretation {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-left: 1px solid var(--border-subtle);
  padding-left: var(--space-3);
}

.china-rates-mini-interpretation-head {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
}

.china-rates-mini-driver {
  color: var(--text-primary);
  font-weight: 800;
  line-height: 1.45;
}

.china-rates-mini-diagnostic,
.china-rates-mini-hint {
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.china-rates-mini-hint {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.china-rates-delta-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.china-rates-cell-hint {
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-muted);
}

.china-rates-table-legend {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-size: 11px;
  color: var(--text-secondary);
}

.china-rates-table-legend strong {
  color: var(--text-primary);
}

.china-rates-table-group-row td {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.china-rates-table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.china-rates-history-toggle,
.china-rates-history-chart-btn {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}

.china-rates-history-toggle:hover,
.china-rates-history-chart-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.china-rates-history-row td {
  background: rgba(255, 255, 255, 0.018) !important;
  white-space: normal;
}

.china-rates-history-panel {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.china-rates-history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.china-rates-history-title {
  color: var(--text-primary);
  font-weight: 800;
}

.china-rates-history-meta,
.china-rates-history-empty {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.china-rates-history-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.china-rates-history-table-wrap {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.china-rates-history-table th,
.china-rates-history-table td {
  padding: 6px 8px;
}

.china-rates-history-delta.up {
  color: var(--red);
}

.china-rates-history-delta.down {
  color: var(--green);
}

.china-rates-history-delta.flat {
  color: var(--text-muted);
}

@media (max-width: 980px) {
  .china-rates-mini-layout {
    grid-template-columns: 1fr;
  }

  .china-rates-mini-interpretation {
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
    padding-left: 0;
    padding-top: var(--space-3);
  }
}

@media (max-width: 640px) {
  .china-rates-mini-kpis {
    grid-template-columns: 1fr;
  }

  .china-rates-mini-kpi-group.signal {
    grid-template-columns: 1fr;
  }

  .china-rates-mini-title {
    font-size: 11px;
  }

  .china-rates-category {
    padding: var(--space-3);
  }
}

.china-rates-signal-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: var(--space-2);
}

.china-rates-signal-badge.risk-on {
  color: #00190f;
  background: #4dd39c;
}

.china-rates-signal-badge.neutral {
  color: #1f2937;
  background: #cbd5e1;
}

.china-rates-signal-badge.risk-off {
  color: #2a0a0a;
  background: #ff8e8e;
}

/* ── CHaRT Index ── */
.chart-index-section {
  margin-bottom: var(--space-5);
}

.chart-index-board {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--surface);
}

.chart-backtest-board {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--surface);
}

.chart-diagnostic-board {
  margin-top: var(--space-3);
}

.chart-diagnostic-title {
  margin-bottom: var(--space-2);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-backtest-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.chart-backtest-tab {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  color: var(--text-secondary);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.75), rgba(255,255,255,0.28)),
    var(--bg-elevated);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.chart-backtest-tab:hover:not(.disabled) {
  transform: translateY(-1px);
  border-color: rgba(44, 90, 160, 0.42);
  box-shadow: var(--shadow-subtle);
}

.chart-backtest-tab.active {
  color: var(--text-primary);
  border-color: rgba(44, 90, 160, 0.68);
  box-shadow: inset 0 0 0 1px rgba(44, 90, 160, 0.18), var(--shadow-subtle);
}

.chart-backtest-tab.disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.chart-backtest-tab-label {
  font-weight: 800;
  letter-spacing: -0.01em;
}

.chart-backtest-tab-meta {
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-backtest-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.chart-backtest-summary-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  background: var(--bg-elevated);
}

.chart-backtest-summary-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.chart-backtest-summary-value {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
}

.chart-backtest-summary-meta,
.chart-backtest-note {
  font-size: 11px;
  color: var(--text-muted);
}

.chart-backtest-note {
  margin-bottom: var(--space-3);
}

.chart-backtest-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}

.chart-backtest-table-wrap,
.chart-diagnostic-table-wrap,
.chart-correlation-table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, rgba(44, 90, 160, 0.18), rgba(77, 211, 156, 0.16)) border-box;
}

.chart-correlation-table-wrap {
  max-height: 360px;
}

.chart-backtest-table-wrap::-webkit-scrollbar,
.chart-diagnostic-table-wrap::-webkit-scrollbar,
.chart-correlation-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.chart-backtest-table-wrap::-webkit-scrollbar-track,
.chart-diagnostic-table-wrap::-webkit-scrollbar-track,
.chart-correlation-table-wrap::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.05);
  border-radius: 999px;
}

.chart-backtest-table-wrap::-webkit-scrollbar-thumb,
.chart-diagnostic-table-wrap::-webkit-scrollbar-thumb,
.chart-correlation-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(44, 90, 160, 0.35);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.chart-backtest-table-wrap::-webkit-scrollbar-thumb:hover,
.chart-diagnostic-table-wrap::-webkit-scrollbar-thumb:hover,
.chart-correlation-table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(44, 90, 160, 0.5);
  background-clip: padding-box;
}

.chart-backtest-table th,
.chart-backtest-table td,
.chart-diagnostic-table th,
.chart-diagnostic-table td,
.chart-correlation-table th,
.chart-correlation-table td {
  border-bottom: 1px solid var(--border-subtle);
  padding: 7px 8px;
  text-align: left;
  vertical-align: middle;
}

.chart-backtest-table th,
.chart-diagnostic-table th,
.chart-correlation-table th {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.chart-diagnostic-table,
.chart-correlation-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}

.chart-diagnostic-table {
  min-width: 680px;
}

.chart-correlation-table {
  min-width: 980px;
  font-family: var(--font-mono);
}

.chart-correlation-table th:first-child {
  left: 0;
  z-index: 2;
}

.chart-correlation-table td {
  text-align: right;
}

.chart-correlation-table td.positive {
  color: #2a0a0a;
  background: rgba(255, 142, 142, 0.28);
}

.chart-correlation-table td.mild-positive {
  color: #552222;
  background: rgba(255, 142, 142, 0.14);
}

.chart-correlation-table td.negative {
  color: #00190f;
  background: rgba(77, 211, 156, 0.28);
}

.chart-correlation-table td.mild-negative {
  color: #0d3a26;
  background: rgba(77, 211, 156, 0.14);
}

.chart-backtest-bucket {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 76px;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 3px 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

.chart-backtest-bucket.risk-off {
  color: #2a0a0a;
  background: rgba(255, 142, 142, 0.22);
  border-color: rgba(255, 142, 142, 0.45);
}

.chart-backtest-bucket.risk-on {
  color: #00190f;
  background: rgba(77, 211, 156, 0.22);
  border-color: rgba(77, 211, 156, 0.45);
}

.chart-backtest-bucket.neutral,
.chart-backtest-bucket.pending {
  color: var(--text-muted);
  background: var(--surface);
}

.chart-backtest-bucket.hit {
  box-shadow: inset 0 0 0 1px currentColor;
}

.chart-backtest-bucket.miss {
  opacity: 0.72;
}

.chart-backtest-arrow {
  font-weight: 900;
}

.chart-backtest-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

@media (max-width: 760px) {
  .chart-backtest-tabs {
    grid-template-columns: 1fr;
  }

  .chart-backtest-summary {
    grid-template-columns: 1fr;
  }

  .chart-backtest-table {
    min-width: 640px;
  }

  .chart-backtest-table-wrap {
    max-height: 360px;
  }
}

.chart-model-board {
  display: grid;
  gap: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--card-shadow);
  padding: var(--space-4);
  overflow: hidden;
}

.chart-model-hero {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(320px, 1fr);
  gap: var(--space-4);
  align-items: stretch;
}

.chart-model-hero-main {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: var(--space-4);
  min-width: 0;
}

.chart-model-eyebrow {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.chart-model-headline {
  margin-top: var(--space-2);
  color: var(--text-primary);
  font-size: 34px;
  font-weight: 900;
  line-height: 1.08;
}

.chart-model-hero.risk-on .chart-model-headline {
  color: #4dd39c;
}

.chart-model-hero.risk-off .chart-model-headline {
  color: #ff8e8e;
}

.chart-model-summary {
  margin-top: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.chart-model-hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  min-width: 0;
}

.chart-model-stat {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: var(--space-3);
  min-width: 0;
}

.chart-model-stat span {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.3;
}

.chart-model-stat strong {
  display: block;
  margin-top: var(--space-1);
  color: var(--text-primary);
  font-size: var(--text-sm);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chart-model-scale {
  display: grid;
  gap: var(--space-2);
}

.chart-model-scale-labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.chart-model-scale-labels span:nth-child(2) {
  text-align: center;
}

.chart-model-scale-labels span:nth-child(3) {
  text-align: right;
}

.chart-model-scale-track {
  position: relative;
  height: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(77, 211, 156, 0.38), rgba(148, 163, 184, 0.20) 50%, rgba(255, 142, 142, 0.42));
}

.chart-model-scale-mid {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 50%;
  width: 1px;
  background: var(--border);
}

.chart-model-scale-marker {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--text-secondary);
  box-shadow: 0 0 0 1px var(--border), 0 6px 18px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
}

.chart-model-scale-marker.risk-on {
  background: #4dd39c;
}

.chart-model-scale-marker.risk-off {
  background: #ff8e8e;
}

.chart-model-panels {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--space-3);
}

.chart-model-panel {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: var(--space-3);
  min-width: 0;
}

.chart-model-panel-title {
  margin-bottom: var(--space-2);
  color: var(--text-primary);
  font-weight: 800;
}

.chart-model-driver-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-2);
}

.chart-model-driver-card,
.chart-model-theme-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: var(--space-2);
  min-width: 0;
}

.chart-model-driver-card.risk-on {
  border-color: rgba(77, 211, 156, 0.38);
}

.chart-model-driver-card.risk-off {
  border-color: rgba(255, 142, 142, 0.42);
}

.chart-model-driver-label,
.chart-model-theme-meta,
.chart-model-theme-counts {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.35;
}

.chart-model-driver-value {
  margin-top: var(--space-1);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 900;
}

.chart-model-driver-signal {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 700;
}

.chart-model-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-2);
}

.chart-model-theme-title {
  margin-top: var(--space-1);
  color: var(--text-primary);
  font-weight: 800;
}

.chart-model-theme-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.chart-model-theme-index {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 900;
}

.chart-model-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.chart-model-table th,
.chart-model-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  text-align: left;
  vertical-align: middle;
}

.chart-model-table th {
  background: rgba(255, 255, 255, 0.028);
  color: var(--text-muted);
  font-weight: 700;
}

.chart-model-label {
  color: var(--text-primary) !important;
  font-weight: 800;
}

.chart-model-index {
  color: var(--text-primary) !important;
  font-weight: 800;
  text-align: center !important;
}

.chart-model-signal {
  font-weight: 800;
}

.chart-model-signal.risk-on {
  color: #4dd39c;
}

.chart-model-signal.risk-off {
  color: #ff8e8e;
}

.chart-model-signal.neutral {
  color: var(--text-secondary);
}

.chart-model-footnote {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

@media (max-width: 920px) {
  .chart-model-hero,
  .chart-model-panels {
    grid-template-columns: 1fr;
  }

  .chart-model-hero-stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .chart-model-board {
    padding: var(--space-3);
  }

  .chart-model-hero-stats {
    grid-template-columns: 1fr;
  }

  .chart-model-scale-labels {
    font-size: 10px;
  }

  .chart-model-headline {
    font-size: 24px;
  }
}

.chart-model-subbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  padding: 6px var(--space-3);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.chart-index-explain {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
  line-height: 1.5;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.chart-index-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.chart-index-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
}

.chart-index-value.risk-on { color: #16a34a; }
.chart-index-value.neutral { color: var(--text-secondary); }
.chart-index-value.risk-off { color: #dc2626; }

.chart-index-direction {
  font-size: var(--text-lg);
  font-weight: 600;
}

.chart-index-direction.risk-on { color: #16a34a; }
.chart-index-direction.neutral { color: var(--text-secondary); }
.chart-index-direction.risk-off { color: #dc2626; }

.chart-index-counts {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.chart-factor-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-2);
}

.chart-factor-group {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  background: var(--bg-elevated);
}

.chart-factor-group-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.chart-factor-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.chart-factor-name {
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
}

.chart-factor-signal {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
}

.chart-factor-signal.risk-on { color: #00190f; background: #4dd39c; }
.chart-factor-signal.neutral { color: #1f2937; background: #cbd5e1; }
.chart-factor-signal.risk-off { color: #2a0a0a; background: #ff8e8e; }

.chart-factor-mode {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* ── China Rates Indicator Modal ── */
.china-rates-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.china-rates-modal.hidden {
  display: none;
}

.china-rates-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 30, 0.58);
}

.china-rates-modal-panel {
  position: relative;
  width: min(940px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-4);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.25);
}

.china-rates-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.china-rates-modal-close:hover {
  color: var(--text-primary);
}

.china-rates-modal-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  line-height: 1.45;
  padding-right: 34px;
}

.china-rates-modal-chart-container {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: var(--space-2);
}

.china-rates-modal-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.china-rates-modal-reset-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
}

.china-rates-modal-reset-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.china-rates-modal-window-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.china-rates-modal-chart-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.china-rates-modal-chart {
  width: 100%;
  height: auto;
  display: block;
}

.china-rates-modal-canvas-wrap {
  padding: 0;
}

.china-rates-modal-canvas-wrap.is-plotly {
  min-height: 320px;
}

.china-rates-modal-plot {
  display: none;
  width: 100%;
  height: 360px;
  min-height: 320px;
}

.china-rates-modal-canvas-wrap canvas {
  width: 100%;
  height: 340px;
  display: block;
}

.china-rates-modal-chart .axis {
  stroke: var(--border);
  stroke-width: 1;
}

.china-rates-modal-chart .guide {
  stroke: var(--border-subtle);
  stroke-width: 1;
}

.china-rates-modal-chart .line {
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.china-rates-modal-chart .dot {
  fill: var(--text-secondary);
}

.china-rates-modal-chart .axis-label {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.china-rates-modal-chart .axis-label-left {
  text-anchor: end;
}

.china-rates-modal-chart .axis-label-end {
  text-anchor: end;
}

.china-rates-modal-chart .point-label {
  fill: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
}

.china-rates-modal-chart.risk-on .line,
.china-rates-modal-chart.risk-on .dot {
  stroke: #3cc78f;
  fill: #3cc78f;
}

.china-rates-modal-chart.risk-off .line,
.china-rates-modal-chart.risk-off .dot {
  stroke: #ff8e8e;
  fill: #ff8e8e;
}

/* ── VIX Spread Page ── */
.vix-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.vix-metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
}

.vix-metric-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

.vix-metric-value {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}

.vix-metric-value.positive { color: var(--green); }
.vix-metric-value.negative { color: var(--red); }

.vix-spot-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.vix-read-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.vix-read-item {
  min-width: 0;
  border-left: 3px solid var(--cyan);
  padding-left: var(--space-3);
}

.vix-read-item span {
  display: block;
  margin-bottom: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
}

.vix-read-item strong {
  display: block;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.45;
}

.vix-spot-chart-container {
  margin-bottom: var(--space-3);
}

.vix-spot-chart-wrapper canvas {
  height: 430px;
}

.ust-backtest-metrics {
  margin-top: 0.75rem;
  margin-bottom: 0.9rem;
}

.ust-backtest-metrics .vix-metric-label {
  font-size: 10px;
}

.ust-backtest-metrics .vix-metric-value {
  font-size: var(--text-md);
}

.vix-metric-value.ust-best-combo {
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
  text-transform: none;
}

.ust-backtest-panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  margin-top: 1rem;
}

.ust-backtest-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem 0.3rem 1.1rem;
}

.ust-backtest-control {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 180px;
}

.ust-backtest-control label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ust-backtest-control select,
.ust-backtest-control input {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}

.ust-backtest-range {
  min-width: 280px;
}

.ust-backtest-range-inputs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ust-backtest-range-inputs span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.ust-backtest-range-inputs input {
  flex: 1;
  min-width: 118px;
}

.ust-backtest-explain {
  margin: 0.35rem 1.1rem 0.55rem 1.1rem;
  padding: 0.55rem 0.65rem;
  border-left: 3px solid var(--amber);
  background: var(--code-bg);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.bt-matrix-wrap {
  width: 100%;
}

.bt-matrix-table th,
.bt-matrix-table td {
  text-align: center;
  vertical-align: middle;
  font-size: 12px;
}

.bt-matrix-table td:first-child,
.bt-matrix-table th:first-child {
  text-align: left;
  min-width: 196px;
}

.bt-cell {
  min-width: 110px;
  padding: 0.3rem 0.22rem !important;
  border-radius: 4px;
}

.bt-cell-avg {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
}

.bt-axis-meta {
  margin-top: 0.15rem;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 450;
  color: var(--text-muted);
  line-height: 1.2;
  white-space: nowrap;
}

.bt-cell-win,
.bt-cell-n {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.bt-cell-empty {
  color: var(--text-muted);
}

.bt-cell-pos-1 { background: rgba(0, 230, 118, 0.08); }
.bt-cell-pos-2 { background: rgba(0, 230, 118, 0.15); }
.bt-cell-pos-3 { background: rgba(0, 230, 118, 0.22); }
.bt-cell-neg-1 { background: rgba(255, 82, 82, 0.08); }
.bt-cell-neg-2 { background: rgba(255, 82, 82, 0.15); }
.bt-cell-neg-3 { background: rgba(255, 82, 82, 0.22); }

.bt-legend {
  margin-top: 0.5rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* VIX Error Banner */
.vix-error-banner {
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid var(--red);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.vix-error-message {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--red);
}

.vix-refresh-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.spinner-inline {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* VIX Last Updated */
.vix-last-updated {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: right;
  padding: var(--space-2) var(--space-1);
  margin-bottom: var(--space-3);
}

.vix-last-updated a {
  color: var(--cyan);
  text-decoration: none;
}

.vix-last-updated a:hover {
  text-decoration: underline;
}

.vix-chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  overflow: hidden;
}

.vix-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.vix-chart-title {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

.vix-chart-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.vix-period-buttons {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.vix-period-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.vix-period-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.vix-period-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.vix-chart-wrapper {
  padding: var(--space-4) var(--space-5);
  position: relative;
}

.vix-chart-wrapper canvas {
  width: 100%;
  height: 400px;
  display: block;
}

.taco-plot {
  display: none;
  width: 100%;
  height: 440px;
  min-height: 360px;
}

.taco-view-card {
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.taco-view-card:hover {
  border-color: rgba(249, 168, 37, 0.55);
  transform: translateY(-1px);
}

.taco-view-card.active {
  border-color: rgba(249, 168, 37, 0.85);
  box-shadow: 0 0 0 1px rgba(249, 168, 37, 0.14), 0 0 24px rgba(249, 168, 37, 0.08);
}

.vix-chart-loading {
  display: flex;
  justify-content: center;
  padding: var(--space-8);
}

.taco-controls-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  padding: var(--space-4) var(--space-5);
}

.taco-slider-control {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr 72px;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.taco-slider-control input[type="range"] {
  width: 100%;
  accent-color: var(--amber);
}

.taco-slider-control strong {
  color: var(--amber);
  text-align: right;
}

.taco-control-note {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.taco-events-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  overflow: hidden;
}

.taco-events-panel.is-collapsed .taco-events-inner {
  display: none;
}

.taco-events-inner {
  padding: var(--space-4) var(--space-5);
}

.taco-event-form {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.taco-event-grid {
  display: grid;
  grid-template-columns: 0.8fr 0.9fr 1.4fr 1.8fr;
  gap: var(--space-3);
}

.taco-event-form label {
  display: grid;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.taco-event-form input,
.taco-event-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
}

.taco-event-form textarea {
  resize: vertical;
  min-height: 64px;
}

.taco-event-actions,
.taco-event-row-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.taco-events-list {
  max-height: 320px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.taco-events-table th,
.taco-events-table td {
  vertical-align: top;
}

.taco-event-label {
  color: var(--amber);
  font-weight: 700;
}

.btn-small {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
}

@media (max-width: 768px) {
  .hk-liquidity-factor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .global-liquidity-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hk-liquidity-chart-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .hk-liquidity-display-label,
  .hk-liquidity-display-label select {
    width: 100%;
  }

  .vix-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .vix-spot-metrics,
  .vix-read-panel {
    grid-template-columns: 1fr 1fr;
  }

  .ois-dashboard-grid,
  .ois-formula-grid {
    grid-template-columns: 1fr;
  }

  .ois-toolbar {
    align-items: stretch;
  }

  .ois-export-controls {
    grid-template-columns: 1fr;
  }

  .ois-accrual-controls {
    grid-template-columns: 1fr;
  }

  .ois-control-group {
    width: 100%;
  }

  .china-rates-modal-panel {
    padding: var(--space-3);
  }

  .china-rates-modal-chart-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .china-rates-modal-chart-meta {
    gap: var(--space-2);
  }

  .china-rates-modal-plot {
    height: 320px;
    min-height: 300px;
  }

  .vix-metrics .vix-metric-card:last-child {
    grid-column: span 2;
  }

  .vix-chart-wrapper canvas {
    height: 300px;
  }

  .taco-plot {
    height: 390px;
    min-height: 330px;
  }

  .global-liquidity-plot {
    min-height: 360px;
  }

  .vix-chart-header {
    flex-direction: column;
  }

  .taco-event-grid {
    grid-template-columns: 1fr 1fr;
  }

  .taco-slider-control {
    grid-template-columns: 1fr;
  }

  .momentum-rule-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .hk-liquidity-factor-grid,
  .global-liquidity-module-grid,
  .global-liquidity-overview-grid,
  .global-liquidity-region-grid,
  .global-liquidity-transmission-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hk-liquidity-factor-grid,
  .global-liquidity-module-grid,
  .global-liquidity-overview-grid,
  .global-liquidity-region-grid,
  .global-liquidity-transmission-grid {
    grid-template-columns: 1fr;
  }

  .vix-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .vix-read-panel {
    grid-template-columns: 1fr;
  }

  .vix-chart-wrapper canvas {
    height: 250px;
  }

  .taco-plot {
    height: 350px;
    min-height: 310px;
  }

  .taco-event-grid {
    grid-template-columns: 1fr;
  }
}

/* ── BTC Last Updated ── */
.btc-last-updated {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: right;
  padding: var(--space-1) var(--space-1);
  margin-bottom: var(--space-3);
}

/* ── VIX CBOE Table ── */
.vix-cboe-table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  overflow: hidden;
}

.vix-cboe-table-wrapper {
  padding: var(--space-4) var(--space-5);
  max-height: 400px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* ── Utility ── */
.hidden { display: none !important; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: var(--font-mono); }
