/* =============================================================================
   Graphs Page Styles
   ============================================================================= */

/* Graph Panel Container */
.graph-panel {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: var(--space-md);
  overflow: clip; /* contain rules panel within bounds */
  position: relative; /* stacking context for rules panel */
}

/* Constrain chart area scroll without clipping sibling overlays */
.graph-chart-area {
  overflow: hidden;
  position: relative; /* anchor for chart-range-overlay absolute positioning */
}

/* Default chart min-height (replaces inline style="height:300px") */
#symbol-chart {
  position: relative; /* for drawing toolbar positioning */
  min-height: 300px;
}


/* =============================================================================
   Compact Symbol Header (inside graph-panel)
   ============================================================================= */

.graph-symbol-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.graph-symbol-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.graph-symbol-title-row h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

[data-news-link] {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  background: transparent;
  border: 1px solid var(--border-color, #2a2a4a);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-decoration: none;
  transition: all 0.15s ease;
}

[data-news-link]:hover {
  background: var(--hover-bg, rgba(255, 255, 255, 0.05));
  border-color: var(--accent-secondary);
  color: var(--text-primary);
}

[data-news-link] svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.graph-symbol-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.graph-symbol-meta:empty {
  display: none;
}

/* Market Status Badge */
.graph-market-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.graph-market-status:empty {
  display: none;
}

.market-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.market-dot.open {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.market-dot.closed {
  background: var(--danger);
}

/* =============================================================================
   Compact Toolbar (inside graph-panel)
   ============================================================================= */

.graph-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
}

.graph-toolbar-group {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Symbol Picker group should fill available space */
.graph-toolbar-group:first-child {
  flex: 1;
  min-width: 200px;
}

.symbol-panel-host {
  width: 100%;
}

/* Symbol Panel - uses symbol-picker component
   Note: .symbol-panel, .symbol-chip-list, .symbol-chip, .symbol-dropdown are defined in component CSS */

.symbol-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 28px;
}

.symbol-chip {
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0.25rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.symbol-chip:hover {
  border-color: rgba(60, 194, 255, 0.4);
}

.symbol-chip.placeholder {
  border-style: dashed;
  background: transparent;
  color: var(--text-dim);
  cursor: default;
}

.symbol-chip.more {
  cursor: default;
  background: transparent;
  border-style: dashed;
}

.symbol-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.45rem);
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 0.35rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 6;
}

.symbol-dropdown.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.symbol-option {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem var(--space-sm);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.symbol-option:hover {
  background: rgba(255, 255, 255, 0.04);
}

.symbol-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
}

.symbol-option > div {
  flex: 1;
  min-width: 0;
}

.symbol-option[data-selected="true"] {
  border-color: rgba(60, 194, 255, 0.35);
  background: rgba(60, 194, 255, 0.08);
}

.symbol-option small {
  display: block;
  color: var(--text-dim);
}

.symbol-option.empty {
  cursor: default;
  color: var(--text-dim);
}

.signal-alert {
  margin-top: var(--space-md);
  padding: 0.75rem var(--space-md);
  border-radius: 12px;
  border: 1px solid rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.08);
  color: var(--warning);
  font-size: 0.9rem;
}

.signal-alert[hidden] {
  display: none;
}

.signal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: var(--space-md);
}

.signal-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.72rem;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.signal-legend-item .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
  flex-shrink: 0;
}

.signal-legend-item.muted {
  color: var(--text-dim);
  border-style: dashed;
}

.signal-legend-item.clickable {
  cursor: pointer;
}

.signal-legend-item.clickable:hover {
  background: rgba(255, 255, 255, 0.06);
}

.signal-legend-item.is-unselected {
  opacity: 0.45;
  border-style: dashed;
}

.signal-legend-item.is-unselected .swatch {
  box-shadow: none;
}

.signal-legend-item.is-unselected:hover {
  opacity: 0.7;
}

.signal-legend-item.is-hidden {
  opacity: 0.35;
}

.signal-legend-item .legend-value {
  margin-left: 0.3rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  min-width: 3ch;
}

.chart-empty {
  min-height: 320px;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  /* Center the message and lift it below the absolutely-positioned chart
     toolbar (range picker + drawing/fullscreen buttons sit at the top of
     the chart container). Without padding-top, the no-data message renders
     behind the toolbar and looks overlapped. The placeholder must remain
     full-width inside the chart area — earlier PR #689 self-review applied
     `max-width: 60ch; margin: 0 auto` directly to the container, which
     shrunk the dashed-border box itself; the text-width constraint lives
     on the inner wrapper (`.chart-empty__message`) emitted by
     `renderEmptyState()` (Copilot finding on PR #689). */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 24px;
  text-align: center;
  color: var(--text-dim, rgba(255, 255, 255, 0.65));
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Inner wrapper — emitted by `renderEmptyState()` so only the message
   text width is constrained while the dashed-border container fills the
   chart area. */
.chart-empty__message {
  max-width: 60ch;
}

/* Graph Panel Header */
.graph-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  min-height: 32px;
  gap: var(--space-md);
}

/* Last Price Display */
.last-price-display {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.last-price-display__value {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--text);
  letter-spacing: -0.02em;
}

.last-price-display__change {
  font-size: 0.8rem;
  font-weight: 600;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

.last-price-display__change.positive {
  color: var(--success);
  background: rgba(96, 247, 168, 0.12);
}

.last-price-display__change.negative {
  /* WCAG AA: #ef4444 on the price-pill background failed contrast (4.39:1).
     #f87171 lifts to ~4.7:1 against the pill bg. */
  color: var(--rating-sell);
  background: rgba(255, 107, 107, 0.12);
}

.last-price-display__change.neutral {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
}

/* Live Tick Indicator */
.live-tick-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.live-tick-indicator__label {
  color: var(--text-dim);
}

.live-tick-indicator__value {
  color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

/* Reset Zoom Button */
.reset-zoom-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.reset-zoom-button:hover {
  background: rgba(60, 194, 255, 0.12);
  border-color: rgba(60, 194, 255, 0.35);
}

.reset-zoom-button[hidden] {
  display: none;
}

.reset-zoom-button svg {
  flex-shrink: 0;
}

/* Rules Indicator */
.rules-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.rules-indicator:hover {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.4);
}

.rules-indicator[hidden] {
  display: none;
}

.rules-indicator svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.rules-indicator[data-disabled="true"] {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.rules-indicator[data-disabled="true"]:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* =============================================================================
   AI Analysis Button & Panel
   ============================================================================= */

/* AI Analysis Button in Toolbar - uses .sync-button base class with purple accent */
.ai-analysis-group {
  flex-shrink: 0;
}

.ai-analysis-button.sync-button {
  background: color-mix(in srgb, var(--accent-primary) 15%, transparent);
  border-color: color-mix(in srgb, var(--accent-primary) 50%, transparent);
  /* PR fix/post-deploy-bundle (a11y): #8b5cf6 on dark surface measured 3.96
     contrast — below WCAG AA. Lighten the AI accent to #b794f6 (Tailwind
     purple-300) to clear 4.5:1 against #1d1939 / #0d101a. */
  color: #b794f6;
}

.ai-analysis-button.sync-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent-primary) 25%, transparent);
}

.ai-analysis-button.sync-button.analyzing {
  background: color-mix(in srgb, var(--accent-primary) 10%, transparent);
}

/* AI Analysis Panel */
.ai-analysis-panel {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 20%, transparent);
  margin-top: var(--space-lg);
  animation: slideDown 0.3s ease;
}

.ai-analysis-panel[hidden] {
  display: none !important;
}

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

.ai-analysis-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-analysis-panel__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ai-analysis-panel__title h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.ai-analysis-panel__title .ai-icon {
  color: var(--accent-primary);
}

.ai-analysis-panel__symbol {
  padding: 0.25rem 0.75rem;
  background: color-mix(in srgb, var(--accent-primary) 15%, transparent);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.ai-analysis-panel__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ai-analysis-panel__checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  cursor: pointer;
}

.ai-analysis-panel__checkbox input {
  accent-color: var(--accent-primary);
}

.ai-analysis-panel__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-analysis-panel__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.ai-analysis-panel__content {
  position: relative;
  min-height: 100px;
}

.ai-analysis-panel__status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: var(--space-md);
  background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.ai-analysis-panel__status[hidden] {
  display: none;
}

.ai-analysis-panel__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, var(--accent-primary) 30%, transparent);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.ai-analysis-panel__text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 500px;
  overflow-y: auto;
}

.ai-analysis-panel__text h1,
.ai-analysis-panel__text h2,
.ai-analysis-panel__text h3 {
  color: var(--text);
  margin: 1.5rem 0 0.75rem;
}

.ai-analysis-panel__text h3 {
  font-size: 1rem;
  color: var(--accent-primary);
}

.ai-analysis-panel__text ul,
.ai-analysis-panel__text ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.ai-analysis-panel__text li {
  margin: 0.3rem 0;
}

.ai-analysis-panel__text strong {
  color: var(--text);
  font-weight: 600;
}

/* AI Score Cards (KPI-style, above analysis text) */
.ai-analysis-panel__scores {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.ai-analysis-panel__scores[hidden] {
  display: none;
}

.ai-score-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  text-align: center;
}

.ai-score-card--rating {
  background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 25%, transparent);
}

.ai-score-card--confidence {
  background: color-mix(in srgb, var(--accent-secondary) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-secondary) 25%, transparent);
}

.ai-score-card__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.ai-score-card__value {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.ai-score-card--rating .ai-score-card__value {
  color: var(--accent-primary);
}

.ai-score-card--rating .ai-score-card__value[data-rating="STRONG_BUY"] { color: var(--rating-strong-buy); }
.ai-score-card--rating .ai-score-card__value[data-rating="BUY"] { color: var(--rating-buy); }
.ai-score-card--rating .ai-score-card__value[data-rating="HOLD"] { color: var(--rating-hold); }
.ai-score-card--rating .ai-score-card__value[data-rating="SELL"] { color: var(--rating-sell); }
.ai-score-card--rating .ai-score-card__value[data-rating="STRONG_SELL"] { color: var(--rating-strong-sell); }

.ai-score-card--confidence .ai-score-card__value {
  color: var(--accent-secondary);
}

.ai-analysis-panel__error {
  padding: var(--space-md);
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 0.9rem;
}

.ai-analysis-panel__error[hidden] {
  display: none;
}

/* =============================================================================
   Rules Group in Toolbar (Grafana-inspired)
   ============================================================================= */

.rules-group {
  flex-shrink: 0;
}

.rules-group .sync-button {
  position: relative;
}

.rules-group .sync-button.active {
  background: rgba(60, 194, 255, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* Rules badge in toolbar button */
.rules-group .rules-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 0.25rem;
  background: var(--accent);
  border-radius: 9px;
  color: #000;
  font-size: 0.7rem;
  font-weight: 600;
}


/* News/Social sections removed — replaced by chart markers */

/* =============================================================================
   Event Marker Popup (News/Social)
   ============================================================================= */

.event-marker-popup {
  position: fixed;
  z-index: 9999;
  pointer-events: auto;
  max-width: 320px;
  min-width: 180px;
}

.event-marker-popup[hidden] {
  display: none;
}

/* Hover card (compact) */
.emp-hover {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md, 6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font-size: 0.78rem;
  color: var(--text);
  max-width: 320px;
  overflow: hidden;
}

.emp-type {
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  flex-shrink: 0;
}

.emp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.emp-dot--bullish { background: var(--palette-green-500); }
.emp-dot--bearish { background: var(--danger); }
.emp-dot--neutral { background: var(--palette-slate-500); }

.emp-headline {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emp-source {
  color: var(--text-dim);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.emp-hint {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Preview card (pinned on click) */
.emp-preview {
  padding: 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg, 8px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.emp-preview-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.emp-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm, 4px);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.emp-badge--bullish {
  color: var(--palette-green-500);
  background: rgba(34, 197, 94, 0.12);
}

.emp-badge--bearish {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}

.emp-badge--neutral {
  color: var(--palette-slate-500);
  background: rgba(100, 116, 139, 0.12);
}

.emp-count {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.emp-preview-headline {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}

.emp-preview-source {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.emp-open {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  align-self: flex-start;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  background: rgba(60, 194, 255, 0.08);
  border: 1px solid rgba(60, 194, 255, 0.25);
  border-radius: var(--radius-md, 6px);
  text-decoration: none;
  transition: background var(--transition-fast, 0.1s), border-color var(--transition-fast, 0.1s);
}

.emp-open:hover {
  background: rgba(60, 194, 255, 0.18);
  border-color: rgba(60, 194, 255, 0.5);
}

/* Drawing toggle active state */
.drawing-toggle-btn.active {
  color: var(--accent);
  background: rgba(60, 194, 255, 0.1);
}

/* Event markers toggle */
.event-markers-toggle.active {
  background: rgba(60, 194, 255, 0.12);
  border-color: rgba(60, 194, 255, 0.35);
  color: var(--accent);
}

.event-markers-toggle svg {
  opacity: 0.8;
}

/* =============================================================================
   Responsive Breakpoints
   ============================================================================= */

@media (max-width: 1024px) {
  .graph-panel {
    padding: var(--space-md);
  }

  .graph-symbol-header {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .graph-toolbar {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }

  .rules-panel {
    width: 300px;
  }
}

@media (max-width: 768px) {
  .graph-panel {
    padding: var(--space-sm);
    border-radius: var(--radius-md);
  }

  .graph-symbol-header {
    flex-direction: column;
    align-items: stretch;
  }

  .graph-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .graph-toolbar-group {
    flex-wrap: wrap;
  }

  .graph-toolbar-group:first-child {
    min-width: 0;
  }

  .last-price-display {
    flex-wrap: wrap;
  }

  .signal-legend {
    gap: 0.25rem;
  }

  .signal-legend-item {
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
  }

  .ai-analysis-panel__scores {
    flex-direction: column;
  }

  .rules-panel {
    width: 100%;
  }
}

@media (max-width: 480px) {
    .graph-panel {
        padding: var(--space-xs);
        border-radius: var(--radius-sm);
    }

    .graph-symbol-header {
        gap: var(--space-xs);
    }

    .graph-toolbar {
        gap: var(--space-xs);
    }

    .graph-toolbar-group {
        gap: 0.25rem;
    }

    .signal-legend-item {
        font-size: 0.6rem;
        padding: 0.15rem 0.35rem;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
    }

    .last-price-display {
        font-size: 0.8125rem;
    }

    .reset-zoom-button {
        min-height: 44px;
        padding: 0.375rem 0.625rem;
    }

    .ai-analysis-panel__close {
        width: 44px;
        height: 44px;
    }

    .graph-toolbar select,
    .graph-toolbar input {
        font-size: 1rem;
        min-height: 36px;
    }
}

/* =============================================================================
   Symbol News (graphs page focused-ticker news section)
   ============================================================================= */
.symbol-news {
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 1rem 1.25rem 1.25rem;
    margin-top: 1rem;
}
.symbol-news__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.symbol-news__title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.symbol-news__symbol {
    color: var(--accent);
    font-weight: 700;
}
.symbol-news__count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.symbol-news__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}
.symbol-news__card {
    background: var(--bg-elevated, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-md, 8px);
    padding: 0.75rem;
    transition: border-color 0.12s, transform 0.12s;
}
.symbol-news__card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.symbol-news__headline {
    display: flex;
    gap: 0.5rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}
.symbol-news__headline:hover { color: var(--accent); }
.symbol-news__sentiment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.25rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
}
.symbol-news__sentiment--positive { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.symbol-news__sentiment--negative { background: rgba(231, 76, 60, 0.15); color: var(--palette-c-e74c3c); }
.symbol-news__sentiment--neutral  { background: rgba(149, 165, 166, 0.15); color: #95a5a6; }
.symbol-news__meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.symbol-news__source { font-weight: 500; }
.symbol-news__time::before { content: '· '; opacity: 0.5; }
.symbol-news__loading,
.symbol-news__empty,
.symbol-news__error {
    padding: 1rem 0;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.symbol-news__error { color: var(--palette-c-e74c3c); }

/* Time-range chips (1W / 1M / 3M) in the news header */
.symbol-news__range {
    display: inline-flex;
    gap: 2px;
    background: var(--bg-elevated, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 6px;
    padding: 2px;
}
.symbol-news__range-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.symbol-news__range-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.symbol-news__range-btn--active {
    background: var(--accent);
    color: var(--palette-c-001425);
}
.symbol-news__range-btn--active:hover { background: var(--accent); color: var(--palette-c-001425); }

/* Load-more footer */
.symbol-news__footer {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
}
.symbol-news__load-more {
    background: var(--bg-elevated, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    color: var(--text);
    font-size: 0.8125rem;
    padding: 0.4rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}
.symbol-news__load-more:hover:not(:disabled) {
    border-color: var(--accent);
    background: rgba(60, 194, 255, 0.06);
}
.symbol-news__load-more:disabled {
    opacity: 0.6;
    cursor: progress;
}

/* Per-card AI Summarize button + expandable summary panel (issue #370) */
.symbol-news__summarize-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;        /* push to the right edge of .symbol-news__meta */
    background: rgba(60, 194, 255, 0.08);
    border: 1px solid rgba(60, 194, 255, 0.25);
    color: var(--accent);
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.symbol-news__summarize-btn:hover:not(:disabled) {
    background: rgba(60, 194, 255, 0.16);
    border-color: var(--accent);
}
.symbol-news__summarize-btn:disabled {
    opacity: 0.6;
    cursor: progress;
}
.symbol-news__summarize-btn.is-loading > span:last-child::after {
    content: '…';
}
.symbol-news__summarize-btn.is-expanded {
    background: rgba(60, 194, 255, 0.16);
}

.symbol-news__summary {
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: rgba(60, 194, 255, 0.04);
    border-left: 2px solid var(--accent);
    border-radius: 4px;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text);
    max-height: 320px;
    overflow-y: auto;
}
.symbol-news__summary strong { color: var(--text); font-weight: 600; }
.symbol-news__summary h1,
.symbol-news__summary h2,
.symbol-news__summary h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin: 0.4rem 0 0.2rem;
}
.symbol-news__summary--loading {
    color: var(--text-secondary);
    font-style: italic;
}
.symbol-news__summary-status {
    color: var(--text-secondary);
    font-size: 0.75rem;
}
.symbol-news__summary-error {
    color: var(--palette-c-e74c3c);
    font-size: 0.75rem;
}

