/* === Overlays ===
   What floats over real content is opaque enough to read and frosts what is under
   it. Cards never take this: a blur over the smooth mesh shows nothing and costs
   scrolling. The chart and the paywall skip the blur too: a veil already covers
   the page behind them. A white lift cannot show on an opaque surface, so hovers
   inside one are the ink wash.

   A backdrop-filter captures position:fixed children. The symbol suggestions are
   the one such child and mount inside whichever dialog holds their field, so the
   Journal's trade dialog and the chart's are left off the blur. */
.header-account-menu,
.app-dropdown-surface,
.ck-mv-asof-menu,
.app-modal-shell,
.feedback-modal,
.ck-note-drawer,
.ck-rot-panel,
.mac-activation-guide {
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
}

.header-account-menu,
.app-dropdown-surface,
.ck-mv-asof-menu,
.app-modal-shell,
.feedback-modal,
.journal-trade-dialog,
.ck-note-drawer,
.ck-rot-panel,
.mac-activation-guide,
.is-chart-expanded,
.mac-paywall-shell,
.tv-chart-modal-dialog {
  --hover-bg: var(--hover-ink);
  --ck-hover: var(--hover-ink);
  --wash: var(--hover-ink);
}

/* === Primary button: chartreuse fill and ink text. === */
.mac-btn--primary {
  --button-bg: var(--interactive-primary-bg);
  --button-text: var(--interactive-primary-text);
  --button-border: var(--interactive-primary-border);
  --button-shadow: var(--shadow-btn-primary);
  --button-hover-shadow: var(--shadow-btn-primary);
}

.mac-btn--primary:hover {
  --button-bg: var(--accent-hover);
}

.chart-timeframe-toggle {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius:var(--radius-pill);
  background: var(--toggle-track);
}

.chart-tool-toggle {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius:var(--radius-pill);
  background: var(--toggle-track);
}

/* Embedded chart structure belongs to the chart stylesheet, not the renderer.
   Keeping these classes as the single layout owner makes the phone overrides
   below predictable without adding a second chart or Cockpit boot path. */
.embedded-chart-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
}

.embedded-chart-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 8px 14px 7px;
  flex-shrink: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.embedded-chart-symbol-form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 6px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-input);
  color: var(--text-muted);
  transition: border-color 150ms var(--ease);
}

.embedded-chart-symbol-form:focus-within {
  border-color: var(--border-focus);
  color: var(--text-secondary);
}

/* Named for screen readers; the icon and placeholder say it on screen. */
.embedded-chart-symbol-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.embedded-chart-search-icon {
  flex: none;
}

.embedded-chart-symbol-input {
  width: 168px;
  min-height: 34px;
  padding: 0 6px 0 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.embedded-chart-symbol-input::placeholder {
  color: var(--text-faint);
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.embedded-chart-timeframes {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  margin-left: auto;
  flex-shrink: 0;
}

.embedded-trade-panel {
  padding: 8px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.embedded-chart-area {
  position: relative;
  min-height: 300px;
  padding: 6px 8px 8px;
  flex: 1;
}

.chart-timeframe-btn {
  position: relative;
  isolation: isolate;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius:var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  transition:
    transform 180ms var(--ease),
    background 180ms var(--ease),
    color 180ms var(--ease),
    border-color 180ms var(--ease),
    box-shadow 180ms var(--ease);
}

.chart-tool-btn {
  position: relative;
  isolation: isolate;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius:var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  overflow: hidden;
  transition:
    transform var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.tv-chart-modal-close {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
}

.tv-chart-modal-close:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: -3px;
}

/* Mobile chart controls and the fallback chart dialog. Keep this block after
   the compact desktop button rules so the 44px target cannot be overwritten
   later in the cascade. */
@media (max-width: 768px) {
  .embedded-chart-layout > .embedded-chart-controls { order: 0; }
  .embedded-chart-layout > .embedded-chart-area { order: 1; }
  .embedded-chart-layout > .embedded-trade-panel { order: 2; }

  .embedded-chart-symbol-form {
    width: 100%;
    flex-wrap: nowrap;
  }

  .embedded-chart-symbol-form #embedded-chart-symbol {
    width: auto !important;
    min-width: 0;
    flex: 1;
  }

  .embedded-chart-timeframes {
    min-width: 0;
    margin-left: 0;
    flex: 1 1 0;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .embedded-chart-timeframes::-webkit-scrollbar { display: none; }

  .chart-timeframe-toggle {
    width: max-content;
    gap: 4px;
  }

  .chart-timeframe-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .chart-tool-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 12px;
  }

  #embedded-chart-symbol {
    min-height: 44px;
  }

  .tv-chart-modal-overlay {
    align-items: stretch !important;
    padding: 0 !important;
  }

  .tv-chart-modal-dialog {
    width: 100% !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  .tv-chart-modal-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "heading actions"
      "timeframes timeframes";
    gap: 8px !important;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px !important;
  }

  .tv-chart-modal-heading {
    grid-area: heading;
    min-width: 0;
  }

  .tv-chart-modal-heading > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tv-chart-modal-actions {
    grid-area: actions;
    justify-self: end;
    gap: 6px !important;
  }

  .tv-chart-modal-delay {
    display: none;
  }

  .tv-chart-modal-timeframes {
    grid-area: timeframes;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .tv-chart-modal-timeframes::-webkit-scrollbar {
    display: none;
  }

  .tv-chart-modal-chart {
    min-height: 260px !important;
  }

  .tv-chart-modal-data {
    max-height: 34dvh;
    padding: 12px !important;
    padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
  }

}

.chart-tool-btn:hover,
.chart-tool-btn:focus-visible {
  color: var(--text-primary);
  border-color: var(--interactive-primary-border);
  background: var(--hover-bg);
}

html.mac-chart-expanded-open body {
  overflow: hidden !important;
}

html.mac-chart-expanded-open body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9996;
  pointer-events: none;
  background: var(--paper-veil);
}

.is-chart-expanded {
  position: fixed !important;
  inset: 14px !important;
  z-index: 9997 !important;
  width: auto !important;
  height: calc(100dvh - 28px) !important;
  max-width: none !important;
  max-height: none !important;
  min-height: 0 !important;
  border: 1px solid var(--glass-edge);
  border-radius:var(--radius-lg);
  overflow: hidden;
  background: var(--surface-solid);
  box-shadow: var(--shadow-pop);
}

.is-chart-expanded .embedded-trade-panel {
  flex-shrink: 0;
}

/* The chart's header strip: who the company is and its facts on one line,
   then the plan on one more line when a setup is loaded. It replaces a
   Guardrails block that took a third of the chart panel (founder, 2026-09-29:
   "it's not the highlight, it's just a feature"). */
.embedded-trade-panel-layout {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.chart-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 18px;
  min-width: 0;
}

.chart-company {
  display: grid;
  gap: 2px;
  flex: 1 1 300px;
  min-width: 0;
}

.chart-company-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.chart-company-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-company-meta {
  flex: none;
  color: var(--text-muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.chart-company-about {
  margin: 0;
  min-width: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.chart-company-about summary {
  display: flex;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
  list-style: none;
}

.chart-company-about summary::-webkit-details-marker {
  display: none;
}

.chart-company-about summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-company-about summary::after {
  content: "More";
  flex: none;
  color: var(--text-primary);
  font-weight: 600;
}

.chart-company-about[open] summary span {
  display: none;
}

.chart-company-about[open] summary::after {
  content: "Less";
}

.chart-company-about p {
  max-height: 132px;
  margin: 2px 0 0;
  overflow-y: auto;
  color: var(--text-secondary);
}

.chart-company-about summary:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.chart-plan {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  min-width: 0;
  padding-top: 6px;
  border-top: 1px solid var(--border-soft);
}

.chart-plan-source {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--chip-grad);
  color: var(--chip-ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.chart-plan.is-no-plan .chart-plan-source {
  padding: 0;
  background: none;
  color: var(--text-muted);
  letter-spacing: .06em;
}

.chart-plan-metrics {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
  min-width: 0;
}

.chart-plan-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.chart-plan-metric em {
  color: var(--text-muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.chart-plan-metric b {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chart-plan-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.chart-plan .ck-strat-action {
  white-space: nowrap;
}

.chart-plan .ck-strat-action[disabled],
.chart-plan .ck-strat-action[aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
}

/* The exit an opening-range plan carries, and its stop in ADR. */
.chart-plan-exit,
.chart-plan-adr,
.chart-plan-chase {
  flex-basis: 100%;
  font-size: 11.5px;
  line-height: 1.45;
}

.chart-plan-exit {
  color: var(--text-secondary);
}

.chart-plan-exit em {
  margin-right: 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.chart-plan-adr {
  color: var(--text-muted);
}

.chart-plan-chase.is-wide {
  color: var(--amber);
}

.chart-plan-chase.is-past {
  color: var(--red);
  font-weight: 700;
}

/* Where the name stands against its averages, and the size its stop allows. */
.chart-plan-stage,
.chart-plan-size {
  flex-basis: 100%;
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.45;
}

.chart-plan-stage em,
.chart-plan-size em {
  margin-right: 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.chart-plan-stage.is-near em,
.chart-plan-size.is-full em {
  color: var(--green);
}

.chart-plan-stage.is-extended em,
.chart-plan-stage.is-trim em,
.chart-plan-size.is-starter em {
  color: var(--amber);
}

.chart-plan-stage.is-broken em {
  color: var(--red);
}

/* The SEC earnings-date estimate: a line under the company name, and a
   warning in the plan row (and on Guardrails' selected plan) when the window
   overlaps the next 10 sessions. Every date is an estimate from SEC filings. */
.chart-earnings {
  margin: 0;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.chart-earnings::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  vertical-align: 1px;
}

.chart-earnings.is-estimate::before,
.chart-earnings.is-window::before,
.chart-earnings.is-due::before {
  background: var(--amber);
}

.chart-earnings.is-due {
  color: var(--amber);
}

.chart-plan-earnings {
  flex-basis: 100%;
  color: var(--amber);
  font-size: 11.5px;
  line-height: 1.45;
}

.gr-plan-earnings {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--amber-border);
  border-radius: 10px;
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 13px;
  line-height: 1.5;
}

.chart-plan-exit-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.5;
}

/* Set levels: the side, the controls, and the hint for the next click. */
.chart-plan-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.chart-plan-side {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.chart-plan-side button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.chart-plan-side button.is-on {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.chart-plan-side button:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 1px;
}

.chart-plan-hint {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
}

.chart-plan-note,
.chart-plan-notice {
  font-size: 11.5px;
  line-height: 1.4;
}

.chart-plan-note {
  color: var(--text-muted);
}

.chart-plan-notice {
  flex-basis: 100%;
  color: var(--amber);
}

.chart-plan--modal {
  margin: 0 0 10px;
}

/* Clicking levels onto the price pane. */
.is-setting-levels,
.is-setting-levels .lw-price-pane,
.is-setting-levels .lw-price-pane * {
  cursor: crosshair !important;
}

.chart-plan-warning {
  font-size: 11.5px;
  line-height: 1.4;
}

.chart-instrument-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  margin: 0;
}

.chart-instrument-stat {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--wash);
}

.chart-instrument-stat dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.chart-instrument-stat dd {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Embedded facts read as one line of label-value pairs, not boxes. */
.chart-instrument-summary.is-embedded {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
}

.chart-instrument-summary.is-embedded .chart-instrument-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
}

.chart-instrument-summary.is-embedded .chart-instrument-stat dd {
  margin: 0;
  font-weight: 700;
}

.chart-info-row {
  display: grid;
  gap: 10px;
  width: 100%;
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 640px) {
  .embedded-trade-panel-layout.is-configured,
  .embedded-trade-panel-layout.is-needs-setup {
    grid-template-columns: minmax(0, 1fr);
  }

  .chart-plan .ck-strat-action,
  .chart-plan-side button {
    min-height: 44px;
  }

  .chart-plan-actions {
    margin-left: 0;
  }

  .chart-company-about summary {
    min-height: 32px;
    align-items: center;
  }
}

.is-chart-expanded .chart-tool-btn[aria-pressed="true"] {
  color: var(--chip-ink);
  border-color: transparent;
  background: var(--chip-grad);
}

/* Expand fix: the expanded chart lives inside #ck-root, which is
   position:relative; z-index:1 — a stacking context that trapped the
   chart's z-index:9997 BENEATH the body::before dim overlay (z-index
   9996), so "Expand" just dimmed the whole screen. Drop #ck-root's
   z-index while a chart is expanded (it's the only context creator in
   the ancestor chain) so the chart rises above its own dimmer. */
html.mac-chart-expanded-open #ck-root {
  z-index: auto !important;
}

/* Discipline chip in the app header — daily loss budget + trades today.
   Replaced the standalone 28px ambient strip (2026-07-02). Understated pill
   so it reads as reference, not chrome; tints amber/red as guardrails bite. */
.header-guardrail-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  height: 30px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius:var(--radius-pill);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}

.header-guardrail-chip:hover {
  background: var(--pill-bg);
  border-color: var(--glass-edge);
}

.header-guardrail-chip:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.header-guardrail-chip .gr-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.header-guardrail-chip .gr-val {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.header-guardrail-chip .gr-hint {
  color: var(--text-secondary);
}

.header-guardrail-chip .gr-sep {
  width: 1px;
  height: 13px;
  background: var(--border);
  flex-shrink: 0;
}

.header-guardrail-chip.mode-reduced {
  background: var(--amber-bg);
  border-color: var(--amber-border);
}

.header-guardrail-chip.mode-done {
  background: var(--red-bg);
  border-color: var(--red-border);
}

/* On a phone the header is tight — hide the chip; the Guardrails tab still
   carries the same numbers. */
@media (max-width: 640px) {
  .header-guardrail-chip { display: none !important; }
}

.lw-chart-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: inherit;
  overflow: hidden;
  background: var(--chart-bg);
  transition: opacity 120ms ease-out, box-shadow 160ms ease-out;
}

/* Dim — never vanish. opacity:0 here made a slow symbol swap look like a
   dead click (the chart disappeared with no feedback for the whole fetch). */
.lw-chart-shell.is-swapping {
  opacity: 0.35;
}

/* "Loading TICKER…" pill the swap shows once a fetch outlives 250ms. */
.lw-swap-pill {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  padding: 6px 14px;
  border-radius:var(--radius-pill);
  border: 1px solid var(--border2);
  background: var(--paper-veil);
  box-shadow: var(--shadow-sm);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  pointer-events: none;
}

.lw-chart-readout {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--chart-bg);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.lw-chart-readout::-webkit-scrollbar {
  display: none;
}

.lw-chart-readout b {
  color: var(--text-primary);
  font-weight: 800;
}

.lw-chart-readout .is-up b {
  color: var(--green);
}

.lw-chart-readout .is-down b {
  color: var(--red);
}

.lw-readout-symbol {
  color: var(--text-primary);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.lw-readout-time {
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 700;
}

/* "Onto Innovation Inc. · 1D · NYSE" beside the symbol, as a chart legend
   reads. Body type so a company name never looks like a number. */
.lw-readout-name {
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.lw-price-pane {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  /* Lightweight Charts owns horizontal drag and pinch. Keep vertical swipes
     available to the page so a phone user never gets trapped on the chart. */
  touch-action: pan-y;
}

/* The chips stop short of the Entry, Last and Stop labels on the price axis and
   wrap there, so none runs over a price in a narrow chart. The quarter is for the
   smallest charts, where the full reserve would stack every chip on its own line. */
.lw-ma-legend {
  position: absolute;
  top: 10px;
  left: 12px;
  right: min(104px, 25%);
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  pointer-events: none;
}

.lw-ma-legend-item {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius:var(--radius-pill);
  background: var(--paper-veil);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.lw-ma-legend-item i {
  width: 12px;
  height: 2px;
  border-radius:var(--radius-pill);
}

/* The legend's line break: the data state takes the line under the chips. */
.lw-ma-legend::after {
  content: '';
  order: 1;
  flex-basis: 100%;
}

.lw-chart-data-state {
  order: 2;
  max-width: calc(100% - 24px);
  padding: 5px 9px;
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-pill);
  background: var(--paper-veil);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
  pointer-events: none;
}

.lw-chart-data-state[hidden] { display: none; }
.lw-chart-data-state[data-tone="error"] {
  border-color: var(--red-border);
  color: var(--red);
}
.lw-chart-data-state[data-tone="ready"] {
  border-color: var(--green-border);
  color: var(--green);
}

@media (max-width: 480px) {
  .lw-chart-data-state {
    max-width: calc(100% - 16px);
    font-size: 9.5px;
  }
}

.lw-volume-pane {
  flex: 0 0 auto;
  min-height: 108px;
  border-top: 1px solid var(--border);
  background: var(--chart-bg);
  touch-action: pan-y;
}

.chart-timeframe-btn.is-active {
  background: var(--chip-grad);
  border-color: transparent;
  color: var(--chip-ink);
}

.mac-btn:not(:disabled):not([aria-disabled="true"]),
.refresh-btn:not(:disabled),
.app-nav-btn {
  position: relative;
}

/* === Premium Tabular Numbers — Global === */
.fey-metric-value,
.fey-metric-change,
.ov-snap-price,
.ov-snap-change,
.cc-pulse-value,
.badge-up,
.badge-down {
  font-variant-numeric: tabular-nums;
}

/* === Micro-Animation — Number change highlight === */
@keyframes fey-number-flash {
  0% { background: var(--accent-bg); }
  100% { background: transparent; }
}
/* === Card Error State === */
.card-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-align: center;
  min-height: 80px;
  font-family: var(--font-body);
}
/* External (Parqet) logos arrive on mixed backgrounds, so each sits on its own
   white plate. */
.symbol-badge--ext .symbol-badge__asset-wrap {
  background: var(--surface-elevated);
}

/* === Subscription Access Gate === */
.mac-paywall-screen {
  position: fixed;
  inset: calc(var(--mac-header-h) + env(safe-area-inset-top)) 0 0;
  z-index: 90;
  box-sizing: border-box;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background: var(--paper-veil);
}

.mac-paywall-screen.is-visible {
  display: flex;
}

html.mac-paywall-active body {
  overflow: hidden;
}

/* The member header remains the single owner of account actions while the
   conversion surface gates the workspace below it. Avoid a duplicate trial
   CTA beside the profile control. */
html.mac-paywall-active #pro-header-btn,
html.mac-paywall-active #header-guardrail-chip {
  display: none !important;
}

.mac-paywall-shell {
  box-sizing: border-box;
  width: min(660px, 100%);
  border: 1px solid var(--glass-edge);
  border-radius: 18px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-pop);
  padding: clamp(24px, 5vw, 42px);
}

.mac-paywall-kicker {
  margin-top: 0;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mac-paywall-shell h1 {
  margin: 10px 0 0;
  max-width: 620px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(38px, 7vw, 70px);
  line-height: 0.94;
  letter-spacing: 0;
}

.mac-paywall-shell h1:focus {
  outline: none;
  box-shadow: none;
}

.mac-paywall-copy {
  max-width: 580px;
  margin: 18px 0 0;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.65;
}

/* Deliberately quiet: an escape hatch for someone on the wrong account, not a
   competing call to action next to Continue to checkout. Still a real 44px
   target so it is usable on a phone. */
.mac-paywall-switch {
  margin: 18px 0 0;
}
.mac-paywall-switch button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.mac-paywall-switch button:hover,
.mac-paywall-switch button:focus-visible {
  color: var(--text-secondary);
}
.mac-paywall-switch button[disabled] {
  opacity: .5;
  cursor: default;
}

.mac-paywall-actions {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-top: 26px;
}

.mac-paywall-actions .mac-btn {
  min-height: 48px;
}

.mac-paywall-plan-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  min-width: min(360px, 100%);
  border: 1px solid var(--border);
  border-radius:var(--radius-pill);
  background: var(--bg-secondary);
}

.mac-paywall-plan-toggle--single {
  grid-template-columns: minmax(0, 1fr);
}

.mac-paywall-plan-toggle button {
  appearance: none;
  min-height: 52px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius:var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: 800 12px/1.1 var(--font-body);
  text-align: left;
}

.mac-paywall-plan-toggle button[aria-pressed="true"] {
  color: var(--chip-ink);
  border-color: transparent;
  background: var(--chip-grad);
  box-shadow: var(--shadow-chip);
}

.mac-paywall-plan-toggle span,
.mac-paywall-plan-toggle strong,
.mac-paywall-plan-toggle em {
  display: block;
}

.mac-paywall-plan-toggle span {
  color: inherit;
  font-size: 11px;
}

.mac-paywall-plan-toggle strong {
  margin-top: 4px;
  color: inherit;
  font-size: 13px;
}

.mac-paywall-plan-toggle em {
  width: fit-content;
  margin-top: 3px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  color: var(--chip-ink);
  font-style: normal;
  font-size: 10px;
}

.mac-paywall-plan-toggle button:focus-visible,
.mac-paywall-actions .mac-btn:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 3px;
}

.mac-paywall-actions button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .mac-paywall-screen {
    align-items: flex-start;
  }

  .mac-paywall-actions {
    flex-direction: column;
  }

  .mac-paywall-actions .mac-btn,
  .mac-paywall-plan-toggle {
    width: 100%;
  }
}

/* Scanner Strategy Leaderboard R-visual cells (scanner-cards.js).
   Hidden below 1150px where the flex row runs out of room —
   the numbers remain; the shape charts are a wide-screen bonus. */
.bt-viz {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 1150px) {
  .bt-viz,
  .bt-viz-head {
    display: none;
  }
}

/* Leaderboard header + rows scroll as one unit on narrow screens
   (results-table idiom): 560px floor covers every stat cell with the
   viz columns hidden, so nothing spills invisibly past the card. */
.bt-lb-scroll {
  overflow-x: auto;
}

.bt-lb-scroll > div {
  min-width: 560px;
}

/* The no-card trial's countdown in the header pill: quieter than the plan
   call-to-action an expired account sees. */
/* layout-header.css styles the pill with !important, so this does too. */
.header-upgrade-pill.is-trial-countdown,
.header-upgrade-pill.is-trial-countdown:hover {
  background: transparent !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border2) !important;
  box-shadow: none !important;
}
