:root {
  /* Chart chrome & ink — light theme, deliberately a shade darker than the
     dataviz skill's stock reference surface (#fcfcfb): --surface-1 is the
     skill's own light-mode diverging-midpoint gray (references/palette.md),
     reused here as a slightly recessed card surface. Every mark color below
     was re-checked with validate_palette.js against this exact surface. */
  --page-plane: #e9e8e4;
  --surface-1: #f0efec;
  --border: rgba(11, 11, 11, 0.10);
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;       /* axis/tick — also used for BB bands, see below */

  /* Categorical series colors (dataviz reference palette, light steps),
     validated against --surface-1 with validate_palette.js: worst adjacent
     CVD dE 24.2, all inside the lightness band and chroma floor. Aqua/
     magenta fall below 3:1 contrast on this light surface by design (see
     palette.md) — mitigated here by each single-series panel already
     carrying a static text label (STRATEGY LOAD / RSI). */
  --series-macd: #2a78d6;        /* blue    — categorical slot 1 */
  --series-macd-signal: #e34948; /* red     — categorical slot 6 */
  --series-strategy-load: #1baf7a; /* aqua  — categorical slot 2 */
  --series-rs: #4a3aa7;           /* violet — categorical slot 5 */
  --series-rsi: #e87ba4;          /* magenta — categorical slot 7 */
  --series-equity-curve: #eb6834; /* orange  — categorical slot 8 */

  /* Status colors (fixed, reserved meaning) for candle up/down, institutional
     bias fills, and safety-block state. */
  --status-good: #0ca30c;
  --status-critical: #d03b3b;
  --status-neutral: #898781;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

#hud {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}

#hud-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

#hud-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow-x: auto;
  min-width: 0; /* let this shrink/scroll before it pushes hud-latest-bar off */
}

#hud-latest-bar {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* Dropdown menu, replaces the old standalone Logout button — same
   Home/About/Documentation/Profile/Log Out set as the landing/about/
   documentation/profile pages' .site-menu, just laid out inline at the
   end of #hud-title-row instead of position:fixed (this page already has
   a fixed-position element, #hud-telemetry-window, docked lower-left —
   keeping this one inline avoids any risk of the two overlapping). */
.hud-menu {
  position: relative;
  flex-shrink: 0;
}

.hud-menu-trigger {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 8px;
  cursor: pointer;
}

.hud-menu-trigger:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.hud-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 140px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(11, 11, 11, 0.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  z-index: 30; /* above the telemetry window's z-index:20 in case they ever overlap */
}

.hud-menu-panel[hidden] { display: none; }

.hud-menu-panel a {
  display: block;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 3px;
  white-space: nowrap;
  text-align: left;
}

.hud-menu-panel a:hover { background: var(--page-plane); }

#hud-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}

#hud-welcome {
  font-size: 11px;
  color: var(--text-secondary);
  display: none;
}

#hud-welcome.visible {
  display: block;
}

#charts {
  display: flex;
  flex-direction: column;
  gap: 2px; /* dataviz: 2px surface gap between stacked chart segments */
  padding: 2px 16px 16px;
}

.chart-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.chart-empty-state {
  display: none;
  position: absolute;
  inset: 24px 8px 8px;
  z-index: 5; /* Lightweight Charts' internal canvases otherwise paint over this */
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
}

.chart-empty-state.visible {
  display: flex;
}

.chart-card .chart-label {
  font-size: 10px;
  color: var(--text-secondary);
  padding: 4px 8px 0;
}

.chart-sublabel {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 6px;
}

.chart-price {
  height: 340px;
}

.chart-sub {
  height: 120px;
}

#hint {
  padding: 6px 16px 14px;
  font-size: 10px;
  color: var(--text-muted);
}

/* Floating HUD telemetry window — detached from the chart flow (fixed,
   not inside #charts), draggable by its titlebar. Ported from
   hud_telemetry.py's render_telemetry_matrix(), which drew this as a
   translucent box overlaid directly on the price chart's Matplotlib
   figure; a floating window is the DOM equivalent of "detached" that a
   fixed overlay div inside the price chart-card wouldn't give. */
#hud-telemetry-window {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 260px;
  z-index: 20;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(11, 11, 11, 0.18);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 10.5px;
}

#hud-telemetry-titlebar {
  padding: 6px 8px;
  background: var(--page-plane);
  border-bottom: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.02em;
  cursor: move;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

#hud-telemetry-body {
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-line {
  display: flex;
  flex-direction: column;
  padding: 1px 0;
}

.hud-line-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.hud-line-label {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.hud-line-state {
  font-weight: 700;
  flex-shrink: 0;
}

.hud-line-detail {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9.5px;
}
