/* MY Top 50 Scanner — Mobile-first dark UI */

:root {
  --bg: #0a0e17;
  --surface: #111827;
  --surface2: #1a2234;
  --border: #1e2a3a;
  --text: #e5e7eb;
  --text-dim: #6b7280;
  --green: #00e676;
  --red: #ff1744;
  --blue: #2196f3;
  --yellow: #ffc107;
  --radius: 12px;
  --font: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* Sticky header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px 6px;
  transition: background 0.3s;
}
/* Header fresh blink — subtle green glow when data is recent */
@keyframes header-pulse {
  0%, 100% { border-bottom-color: var(--green); box-shadow: 0 1px 8px rgba(0,230,118,0.15); }
  50% { border-bottom-color: rgba(0,230,118,0.3); box-shadow: 0 1px 4px rgba(0,230,118,0.05); }
}
.header--fresh {
  border-bottom: 2px solid var(--green);
  animation: header-pulse 3s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .header--fresh { animation: none; } }
body.reduce-motion .header--fresh { animation: none !important; }

.header__top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header__title {
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
  margin-right: auto;
}
/* Header indices scrolling ticker */
.header__indices {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
  height: 20px;
  margin: 0 6px;
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.header__indices.scrolling .indices-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  gap: 6px;
  animation: indicesScroll 28s linear infinite;
}
.indices-track { line-height: 20px; }
@keyframes indicesScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.idx-item {
  font-size: 0.62rem;
  white-space: nowrap;
}
.idx-item b {
  color: var(--text);
  font-weight: 700;
  margin-right: 2px;
}
.idx-horizon {
  font-size: 0.58rem;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
  margin: 0 1px;
}
.idx-horizon.positive { background: rgba(0,230,118,0.1); color: var(--green); }
.idx-horizon.negative { background: rgba(255,23,68,0.1); color: var(--red); }
.idx-sep {
  color: var(--border);
  font-size: 0.55rem;
  margin: 0 2px;
}

.header__session {
  font-size: 0.72rem;
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface2);
}
.header__status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.header--fresh .header__status-dot {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.header__toggle-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.7rem;
  cursor: pointer;
  white-space: nowrap;
}
.header__toggle-btn:active { background: var(--surface2); }
.header__toggle-btn.active { color: var(--blue); border-color: var(--blue); }
.header__info-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  flex-wrap: wrap;
}
.header__info-bar > span {
  font-size: 0.62rem;
  color: var(--text-dim);
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface2);
  white-space: nowrap;
}
.header__source { border-left: 2px solid var(--blue); }
.header__rate { border-left: 2px solid var(--green); }
.header__next { border-left: 2px solid var(--yellow); }
.header__updated { border-left: 2px solid var(--text-dim); }

/* Compact controls row: Search + Positions + Activity on one line */
.controls-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 6px;
  position: sticky;
  top: 56px;
  z-index: 99;
  background: var(--bg);
}
.controls-row__search {
  flex: 1;
  min-width: 0;
}
.controls-row__search input {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.8rem;
  outline: none;
}
.controls-row__search input:focus { border-color: var(--blue); }
.controls-row__search input::placeholder { color: var(--text-dim); }
.controls-row__btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}
.controls-row__btn:active { background: var(--surface2); }
.controls-row__btn.expanded { color: var(--blue); border-color: var(--blue); }
.controls-row__count {
  font-size: 0.6rem;
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 999px;
  color: var(--text-dim);
}
.controls-row__badge {
  font-size: 0.5rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0,230,118,0.15);
  color: var(--green);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  animation: pulse-badge 2s ease-in-out infinite;
}
.controls-row__arrow {
  font-size: 0.55rem;
  color: var(--text-dim);
  transition: transform 0.2s;
}
.controls-row__btn.expanded .controls-row__arrow { transform: rotate(0deg); }
.controls-row__btn:not(.expanded) .controls-row__arrow { transform: rotate(-90deg); }

/* Stock Position List */
.position-list {
  margin: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.position-list:not(.expanded) { display: none; }
.position-list__body {
  display: block;
  padding: 6px 10px 8px;
}
.position-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pos-chip {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-dim);
}
.pos-chip.in-scan {
  color: var(--text);
  border-color: rgba(0,230,118,0.3);
}
.pos-chip.in-scan.up {
  border-color: var(--green);
  color: var(--green);
}
.pos-chip.in-scan.down {
  border-color: var(--red);
  color: var(--red);
}
.pos-chip.not-in-scan {
  opacity: 0.45;
}
.pos-chip.selected {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  opacity: 1;
}
.pos-chip .pos-price {
  font-weight: 400;
  font-size: 0.6rem;
  margin-left: 3px;
  opacity: 0.7;
}
.pos-chip .pos-change {
  font-size: 0.6rem;
  margin-left: 2px;
}

/* ── Live Trading Activity — Scan Log ── */
.scan-log {
  margin: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.scan-log:not(.expanded) { display: none; }
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.scan-log__count-bar {
  padding: 4px 10px;
  border-top: 1px solid var(--border);
}
.scan-log__count {
  font-size: 0.62rem;
  color: var(--text-dim);
}
.scan-log__body {
  display: block;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.scan-log__empty {
  padding: 16px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.scan-log__entries {
  padding: 0 6px 6px;
}

/* Scan log entry row */
.sl-entry {
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.sl-entry:hover { background: var(--surface2); }
.sl-entry.sl-sig-strong-buy { border-left-color: var(--green); background: rgba(0,230,118,0.04); }
.sl-entry.sl-sig-buy { border-left-color: #66ffa6; background: rgba(0,230,118,0.02); }
.sl-entry.sl-sig-sell { border-left-color: #ff6e7a; background: rgba(255,23,68,0.02); }
.sl-entry.sl-sig-strong-sell { border-left-color: var(--red); background: rgba(255,23,68,0.04); }
.sl-entry.sl-sig-hold { border-left-color: var(--border); }

.sl-row1 {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sl-time {
  font-size: 0.58rem;
  color: var(--text-dim);
  font-family: 'SF Mono', 'Fira Code', monospace;
  min-width: 58px;
}
.sl-symbol {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  min-width: 48px;
}
.sl-price {
  font-size: 0.72rem;
  color: var(--text);
  font-weight: 500;
}
.sl-change {
  font-size: 0.65rem;
  font-weight: 600;
}
.sl-change.positive { color: var(--green); }
.sl-change.negative { color: var(--red); }
.sl-rec {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: auto;
}
.sl-rec-strong-buy { background: rgba(0,230,118,0.2); color: var(--green); }
.sl-rec-buy { background: rgba(0,230,118,0.12); color: #66ffa6; }
.sl-rec-hold { background: rgba(255,193,7,0.12); color: var(--yellow); }
.sl-rec-sell { background: rgba(255,23,68,0.12); color: #ff6e7a; }
.sl-rec-strong-sell { background: rgba(255,23,68,0.2); color: var(--red); }

/* Tags */
.sl-tag {
  font-size: 0.5rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sl-tag-pos { background: rgba(33,150,243,0.15); color: var(--blue); }
.sl-tag-wl { background: rgba(255,193,7,0.15); color: var(--yellow); }

/* Row 2: horizon predictions */
.sl-row2 {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.sl-horizon {
  font-size: 0.58rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}
.sl-horizon.sl-buy { background: rgba(0,230,118,0.1); color: #66ffa6; }
.sl-horizon.sl-sell { background: rgba(255,23,68,0.1); color: #ff6e7a; }
.sl-horizon.sl-hold { background: rgba(255,255,255,0.05); color: var(--text-dim); }
.sl-pct {
  font-weight: 600;
  margin-left: 2px;
}
.sl-conf {
  display: inline-block;
  width: 30px;
  height: 3px;
  border-radius: 2px;
  background: var(--surface2);
  position: relative;
  vertical-align: middle;
  margin-left: auto;
}
.sl-conf-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 2px;
  background: var(--blue);
}
.sl-conf-pct {
  font-size: 0.52rem;
  color: var(--text-dim);
  margin-left: 2px;
}

/* Mobile tightening */
@media (max-width: 480px) {
  .sl-time { display: none; }
  .sl-symbol { min-width: 36px; font-size: 0.74rem; }
  .sl-price { font-size: 0.68rem; }
  .sl-horizon { font-size: 0.54rem; padding: 1px 4px; }
  .sl-entry { padding: 5px 6px; }
  .sl-row1 { gap: 4px; }
  .sl-row2 { gap: 3px; }
  .scan-log__count { font-size: 0.6rem; }
  .controls-row__btn span:first-child { font-size: 0.65rem; }
  .controls-row__search input { padding: 6px 8px; font-size: 0.75rem; }
  .header__title { font-size: 0.95rem; }
  .controls-row { top: 50px; }
  .chips { top: 86px; }
}

@media (prefers-reduced-motion: reduce) {
  .scan-log__badge { animation: none; }
}
body.reduce-motion .scan-log__badge { animation: none !important; }

/* Filter chips */
.chips {
  display: flex;
  gap: 6px;
  padding: 6px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: sticky;
  top: 96px;
  z-index: 98;
  background: var(--bg);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}
.chip.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.chip[data-filter="watchlist"] {
  border-color: var(--yellow);
  color: var(--yellow);
}
.chip[data-filter="watchlist"].active {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #000;
}

/* Settings bar */
.settings-bar {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 6px;
}
.settings-bar label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-dim);
  cursor: pointer;
}

/* Card grid */
.card-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0 12px 80px;
}
@media (min-width: 640px) {
  .card-list { grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px 80px; }
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.3s;
}
.card.glow-green { box-shadow: 0 0 12px rgba(0,230,118,0.25); }
.card.glow-red { box-shadow: 0 0 12px rgba(255,23,68,0.25); }

/* Blink animation */
@keyframes blink-green {
  0%, 100% { box-shadow: 0 0 4px rgba(0,230,118,0.1); }
  50% { box-shadow: 0 0 16px rgba(0,230,118,0.4); }
}
@keyframes blink-red {
  0%, 100% { box-shadow: 0 0 4px rgba(255,23,68,0.1); }
  50% { box-shadow: 0 0 16px rgba(255,23,68,0.4); }
}
.card.blink-up-fast { animation: blink-green 0.6s infinite; }
.card.blink-up-slow { animation: blink-green 2s infinite; }
.card.blink-down-fast { animation: blink-red 0.6s infinite; }
.card.blink-down-slow { animation: blink-red 2s infinite; }

@media (prefers-reduced-motion: reduce) {
  .card.blink-up-fast, .card.blink-up-slow,
  .card.blink-down-fast, .card.blink-down-slow { animation: none; }
  .card.blink-up-fast, .card.blink-up-slow { box-shadow: 0 0 8px rgba(0,230,118,0.3); }
  .card.blink-down-fast, .card.blink-down-slow { box-shadow: 0 0 8px rgba(255,23,68,0.3); }
}
/* User toggle for reduced motion */
body.reduce-motion .card { animation: none !important; }
body.reduce-motion .card.blink-up-fast, body.reduce-motion .card.blink-up-slow { box-shadow: 0 0 8px rgba(0,230,118,0.3); }
body.reduce-motion .card.blink-down-fast, body.reduce-motion .card.blink-down-slow { box-shadow: 0 0 8px rgba(255,23,68,0.3); }

/* Rank badge */
.rank-badge {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--yellow);
  background: rgba(255,193,7,0.15);
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 4px;
  min-width: 22px;
  text-align: center;
}
.rank-badge.rank-pos {
  color: var(--text-dim);
  background: rgba(255,255,255,0.08);
}

/* Card header */
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
}
.card__symbol {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.card__badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}
.card__badge.up { background: rgba(0,230,118,0.15); color: var(--green); }
.card__badge.down { background: rgba(255,23,68,0.15); color: var(--red); }
.card__badge.neutral { background: rgba(255,255,255,0.08); color: var(--text-dim); }
.card__name {
  font-size: 0.7rem;
  color: var(--text-dim);
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Metrics row */
.card__metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 8px 12px;
}
.metric {
  text-align: center;
}
.metric__label {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.metric__value {
  font-size: 0.85rem;
  font-weight: 600;
}
.metric__value.positive { color: var(--green); }
.metric__value.negative { color: var(--red); }

/* Mini analytics */
.card__analytics-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 4px 12px 6px;
  border-top: 1px solid var(--border);
}

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

/* BOLL & S/R rows */
.card__data-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 12px;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
}
.card__data-row .label { color: var(--text-dim); }
.card__data-row .values { display: flex; gap: 8px; }
.card__data-row .val-green { color: var(--green); }
.card__data-row .val-red { color: var(--red); }
.card__data-row .val-blue { color: var(--blue); }

/* Reasons + inline news ticker */
.card__reasons {
  display: flex;
  align-items: center;
  padding: 4px 12px 6px;
  font-size: 0.65rem;
  color: var(--yellow);
  border-top: 1px solid var(--border);
  gap: 6px;
  overflow: hidden;
}
.card__reasons-text {
  flex-shrink: 0;
  white-space: nowrap;
}
.card__reasons .news-ticker {
  margin-left: 0;
}

/* Toggle buttons */
.card__toggles {
  display: flex;
  border-top: 1px solid var(--border);
}
.card__toggle-btn {
  flex: 1;
  padding: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: color 0.15s, background 0.15s;
}
.card__toggle-btn:last-child { border-right: none; }
.card__toggle-btn:active { background: var(--surface2); }
.card__toggle-btn.active { color: var(--blue); background: rgba(33,150,243,0.08); }

/* Expanded chart */
.card__chart-area {
  display: none;
  border-top: 1px solid var(--border);
}
.card__chart-area.open { display: block; }
.tf-tabs {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 6px;
  overflow: hidden;
}
.tf-tab {
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
}
.tf-tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chart-container {
  width: 100%;
  height: 320px;
  padding: 0 4px 8px;
}

/* Indicator toggle pills */
.chart-indicator-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 12px 6px;
  align-items: center;
}
.ind-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  transition: all 0.15s;
}
.ind-pill input { display: none; }
.ind-pill:has(input:checked) {
  background: rgba(33,150,243,0.15);
  border-color: var(--blue);
  color: var(--blue);
}
/* Indicator group toggle buttons */
.ind-group-toggle {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  transition: all 0.15s;
  letter-spacing: 0.03em;
}
.ind-group-toggle:hover { border-color: var(--text-dim); }
.ind-group-toggle.active {
  background: rgba(33,150,243,0.15);
  border-color: var(--blue);
  color: var(--blue);
}
.ind-group-panel {
  display: none;
  gap: 4px;
}
.ind-group-panel.open {
  display: inline-flex;
  align-items: center;
}

.ind-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 2px;
}

/* Sub-chart panes */
.sub-charts-area {
  padding: 0 4px;
}
.sub-chart-wrap {
  position: relative;
  margin-top: 2px;
}
.sub-chart-label {
  position: absolute;
  top: 2px;
  left: 8px;
  z-index: 2;
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(15,19,24,0.7);
  padding: 1px 6px;
  border-radius: 3px;
  pointer-events: none;
}

/* Expanded analytics with insights */
.card__analytics-full {
  display: none;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
}
.card__analytics-full.open { display: block; }

.analytics-insights { display: flex; flex-direction: column; gap: 2px; }

.ai-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue);
  margin-top: 10px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(33,150,243,0.2);
}
.ai-section-title:first-child { margin-top: 0; }

.ai-row {
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.ai-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-header .a-label {
  color: var(--text-dim);
  font-size: 0.72rem;
  min-width: 85px;
  flex-shrink: 0;
}
.ai-value {
  font-weight: 600;
  font-size: 0.8rem;
  min-width: 60px;
}
.ai-signal {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: auto;
  white-space: nowrap;
}
.ai-signal.positive { background: rgba(0,230,118,0.12); color: var(--green); }
.ai-signal.negative { background: rgba(255,23,68,0.12); color: var(--red); }
.ai-signal:not(.positive):not(.negative) { background: rgba(255,255,255,0.06); color: var(--text-dim); }

.ai-guide {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 3px;
  line-height: 1.4;
  padding-left: 2px;
  opacity: 0.85;
}

.ai-rank-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}
.ai-rank-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--yellow) 40%, var(--green) 80%);
  transition: width 0.3s;
}

/* Scrolling news ticker (beside 1H / 4H tabs) */
.news-ticker {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
  height: 22px;
  margin-left: 4px;
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.news-ticker .ticker-empty {
  font-size: 0.65rem;
  color: var(--text-dim);
  line-height: 22px;
}
.news-ticker.scrolling .ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  gap: 10px;
  animation: tickerScroll 20s linear infinite;
}
.ticker-item {
  font-size: 0.65rem;
  line-height: 22px;
  white-space: nowrap;
}
.ticker-icon {
  margin-right: 3px;
  font-size: 0.5rem;
  vertical-align: middle;
}
.ticker-date {
  color: var(--text-dim);
  margin-right: 4px;
  font-size: 0.6rem;
}
.ticker-cat {
  font-size: 0.58rem;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}
.cat-catalyst .ticker-icon { color: var(--yellow); }
.cat-news .ticker-icon { color: var(--blue); }
.cat-catalyst .ticker-cat { background: rgba(255,193,7,0.15); color: var(--yellow); }
.cat-news .ticker-cat { background: rgba(33,150,243,0.15); color: var(--blue); }
.sent-pos { color: var(--green); }
.sent-neg { color: var(--red); }
.sent-neu { color: var(--text-dim); }
.ticker-sep {
  color: var(--text-dim);
  font-size: 0.6rem;
  opacity: 0.3;
}
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }  /* -50% because content is duplicated */
}

/* Status banner */
.status-banner {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.status-banner .spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Offline banner */
.offline-banner {
  display: none;
  background: var(--yellow);
  color: #000;
  text-align: center;
  padding: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}
body.offline .offline-banner { display: block; }

/* Bollinger alert banner on card */
.card__boll-alert {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  border-top: 1px solid var(--border);
}
.card__boll-alert .boll-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.card__boll-alert.alert-near_upper,
.card__boll-alert.alert-above_upper {
  background: rgba(255,23,68,0.1);
  color: var(--red);
}
.card__boll-alert.alert-near_upper .boll-dot,
.card__boll-alert.alert-above_upper .boll-dot { background: var(--red); }
.card__boll-alert.alert-near_lower,
.card__boll-alert.alert-below_lower {
  background: rgba(0,230,118,0.1);
  color: var(--green);
}
.card__boll-alert.alert-near_lower .boll-dot,
.card__boll-alert.alert-below_lower .boll-dot { background: var(--green); }
.card__boll-alert.alert-near_mid {
  background: rgba(33,150,243,0.08);
  color: var(--blue);
}
.card__boll-alert.alert-near_mid .boll-dot { background: var(--blue); }

/* Pulsing dot for active alerts */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}
.card__boll-alert .boll-dot { animation: pulse-dot 1.5s infinite; }
@media (prefers-reduced-motion: reduce) {
  .card__boll-alert .boll-dot { animation: none; }
}
body.reduce-motion .card__boll-alert .boll-dot { animation: none !important; }

/* Watchlist reason banner */
.watchlist-reasons {
  padding: 5px 12px;
  font-size: 0.68rem;
  background: rgba(255,193,7,0.08);
  border-top: 1px solid rgba(255,193,7,0.2);
  color: var(--yellow);
  line-height: 1.4;
}
.watchlist-reasons .wl-icon {
  margin-right: 4px;
  font-size: 0.7rem;
}

/* Prediction / Recommendation section */
.card__prediction-1d {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
}
.card__prediction-1d .pred-label { color: var(--text-dim); }
.rec-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.65rem;
  text-transform: uppercase;
}
.rec-badge.strong-buy { background: rgba(0,230,118,0.2); color: var(--green); }
.rec-badge.buy { background: rgba(0,230,118,0.12); color: #66ffa6; }
.rec-badge.hold { background: rgba(255,193,7,0.15); color: var(--yellow); }
.rec-badge.sell { background: rgba(255,23,68,0.12); color: #ff6e7a; }
.rec-badge.strong-sell { background: rgba(255,23,68,0.2); color: var(--red); }

/* Predictions panel (expanded) */
.card__predictions {
  display: none;
  border-top: 1px solid var(--border);
  padding: 10px 12px;
}
.card__predictions.open { display: block; }
.pred-table {
  width: 100%;
  font-size: 0.72rem;
  border-collapse: collapse;
}
.pred-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  padding: 4px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.6rem;
  text-transform: uppercase;
}
.pred-table td {
  padding: 5px 4px;
  border-bottom: 1px solid var(--border);
}
.pred-table tr:last-child td { border-bottom: none; }
.pred-range {
  font-size: 0.6rem;
  color: var(--text-dim);
}
.pred-conf {
  display: inline-block;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface2);
  position: relative;
  vertical-align: middle;
}
.pred-conf-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 2px;
  background: var(--blue);
}
.pred-rationale {
  font-size: 0.6rem;
  color: var(--text-dim);
  padding: 6px 0 2px;
  line-height: 1.4;
  font-style: italic;
}

/* Legend panel */
.card__legend {
  display: none;
  border-top: 1px solid var(--border);
  padding: 10px 12px;
}
.card__legend.open { display: block; }
.legend-item {
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  line-height: 1.45;
}
.legend-item:last-child { border-bottom: none; }
.legend-term {
  font-weight: 700;
  color: var(--blue);
}
.legend-def {
  color: var(--text-dim);
}

/* (header toggle buttons styled via .header__toggle-btn above) */

/* ── Signal Details Panel (info icon toggle) ── */
.signal-details-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
  vertical-align: middle;
}
.signal-details-btn:hover,
.signal-details-btn.active {
  color: var(--blue);
}

.card__signal-details {
  display: none;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  background: rgba(17,24,39,0.6);
}
.card__signal-details.open { display: block; }

.sd-section-title {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue);
  margin-top: 8px;
  margin-bottom: 4px;
}
.sd-section-title:first-child { margin-top: 0; }

/* Criteria */
.sd-rec-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.sd-conf-label {
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-left: auto;
}
.sd-conf-bar {
  display: inline-block;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface2);
  position: relative;
  vertical-align: middle;
}
.sd-conf-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 2px;
  background: var(--blue);
}
.sd-conf-pct {
  font-size: 0.6rem;
  color: var(--text-dim);
  min-width: 24px;
}
.sd-criteria-list {
  margin: 0;
  padding: 0 0 0 14px;
  font-size: 0.68rem;
  color: var(--text);
  line-height: 1.5;
  opacity: 0.9;
}
.sd-criteria-list li {
  margin-bottom: 2px;
}

/* Analytics grid */
.sd-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.sd-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  background: var(--surface2);
  border-radius: 6px;
}
.sd-label {
  font-size: 0.55rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sd-val {
  font-size: 0.75rem;
  font-weight: 600;
}
.sd-val.positive { color: var(--green); }
.sd-val.negative { color: var(--red); }

/* Volume */
.sd-vol-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sd-vol-note {
  font-size: 0.62rem;
  color: var(--text-dim);
  font-style: italic;
}

/* BOLL range visualization */
.sd-boll { margin-top: 2px; }
.sd-boll-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.sd-boll-pos {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text);
}
.sd-boll-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sd-boll-lo, .sd-boll-hi {
  font-size: 0.6rem;
  font-weight: 500;
  white-space: nowrap;
  min-width: 48px;
}
.sd-boll-lo { color: var(--green); text-align: right; }
.sd-boll-hi { color: var(--red); }
.sd-boll-track {
  flex: 1;
  height: 8px;
  background: linear-gradient(90deg, rgba(0,230,118,0.15), rgba(33,150,243,0.1) 50%, rgba(255,23,68,0.15));
  border-radius: 4px;
  position: relative;
  min-width: 80px;
}
.sd-boll-mid {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--blue);
  opacity: 0.6;
}
.sd-boll-dot {
  position: absolute;
  top: -1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--blue);
  transform: translateX(-50%);
  box-shadow: 0 0 4px rgba(33,150,243,0.5);
}
.sd-boll-price {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 3px;
  text-align: center;
}

/* News items */
.sd-news-content {
  max-height: 120px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sd-loading, .sd-no-news {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-style: italic;
}
.sd-news-item {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(30,42,58,0.5);
  font-size: 0.65rem;
  line-height: 1.4;
}
.sd-news-item:last-child { border-bottom: none; }
.sd-news-icon {
  flex-shrink: 0;
  font-size: 0.5rem;
  margin-top: 2px;
  color: var(--text-dim);
}
.sd-news-item.positive .sd-news-icon { color: var(--green); }
.sd-news-item.negative .sd-news-icon { color: var(--red); }
.sd-news-date {
  flex-shrink: 0;
  font-size: 0.58rem;
  color: var(--text-dim);
  min-width: 36px;
}
.sd-news-headline {
  color: var(--text);
}
.sd-news-item.positive .sd-news-headline { color: var(--green); }
.sd-news-item.negative .sd-news-headline { color: var(--red); }
.sd-empty {
  font-size: 0.65rem;
  color: var(--text-dim);
  padding: 4px 0;
}

@media (max-width: 480px) {
  .sd-grid { grid-template-columns: repeat(2, 1fr); }
  .sd-boll-lo, .sd-boll-hi { font-size: 0.55rem; min-width: 40px; }
  .sd-criteria-list { font-size: 0.62rem; }
}

/* ── Strategy Insight Panel (BOLL-Bounce HL5%) ── */
.strategy-btn {
  background: rgba(255,193,7,0.1);
  border: 1px solid rgba(255,193,7,0.3);
  color: var(--yellow);
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.2;
  transition: all 0.15s;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.strategy-btn:hover,
.strategy-btn.active {
  background: var(--yellow);
  color: #000;
  border-color: var(--yellow);
}

.card__strategy {
  display: none;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  background: rgba(17,24,39,0.6);
}
.card__strategy.open { display: block; }

.strat-insight { font-size: 0.82rem; }
.strat-empty { color: var(--text-dim); font-size: 0.78rem; padding: 6px 0; }

.strat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.strat-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--yellow);
}
.strat-signal {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}
.strat-signal-buy { background: rgba(0,230,118,0.2); color: var(--green); }
.strat-signal-watch { background: rgba(255,193,7,0.2); color: var(--yellow); }
.strat-signal-wait { background: rgba(255,255,255,0.08); color: var(--text-dim); }

.strat-section { margin-bottom: 8px; }
.strat-subtitle {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--blue);
  margin-bottom: 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(33,150,243,0.2);
}

/* Rules checklist */
.strat-rule {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0 0;
}
.strat-rule-icon {
  font-size: 0.78rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.strat-rule-icon:first-child { color: var(--green); }
.strat-rule .strat-rule-icon { color: var(--text-dim); }
.strat-rule:has(.positive) .strat-rule-icon { color: var(--green); }
.strat-rule:has(.negative) .strat-rule-icon { color: var(--red); }
.strat-rule-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  min-width: 80px;
}
.strat-rule-value {
  font-weight: 600;
  font-size: 0.82rem;
  min-width: 44px;
}
.strat-rule-value.positive { color: var(--green); }
.strat-rule-value.negative { color: var(--red); }
.strat-rule-target {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-left: auto;
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 3px;
}
.strat-rule-detail {
  font-size: 0.68rem;
  color: var(--text-dim);
  padding: 2px 0 5px 24px;
  opacity: 0.85;
  line-height: 1.4;
  border-bottom: 1px solid rgba(30,42,58,0.5);
}

/* Exit grid */
.strat-exit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.strat-exit-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 2px;
  border-radius: 6px;
  background: var(--surface2);
}
.strat-exit-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.strat-exit-val {
  font-weight: 700;
  font-size: 0.85rem;
  margin: 3px 0;
}
.strat-exit-tp .strat-exit-val { color: var(--green); }
.strat-exit-boll .strat-exit-val { color: var(--blue); }
.strat-exit-sl .strat-exit-val { color: var(--red); }
.strat-exit-stale .strat-exit-val { color: var(--yellow); }
.strat-exit-price {
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* BOLL range bar with zones */
.strat-boll-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.strat-boll-lo, .strat-boll-hi {
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  min-width: 48px;
}
.strat-boll-lo { color: var(--green); text-align: right; }
.strat-boll-hi { color: var(--red); }
.strat-boll-track {
  flex: 1;
  height: 10px;
  background: var(--surface2);
  border-radius: 5px;
  position: relative;
  min-width: 80px;
}
.strat-boll-buy-zone {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(0,230,118,0.12);
  border-radius: 5px 0 0 5px;
}
.strat-boll-sell-zone {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(255,23,68,0.12);
  border-radius: 0 5px 5px 0;
}
.strat-boll-mid {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--blue);
  opacity: 0.5;
}
.strat-boll-dot {
  position: absolute;
  top: -2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--yellow);
  transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(255,193,7,0.5);
}
.strat-boll-labels {
  display: flex;
  justify-content: space-between;
  padding: 3px 50px 0;
  font-size: 0.62rem;
}
.strat-zone-buy { color: var(--green); }
.strat-zone-mid { color: var(--text-dim); }
.strat-zone-sell { color: var(--red); }

/* 5-day projection */
.strat-proj {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.strat-proj-day {
  font-size: 0.72rem;
  padding: 4px 10px;
  background: var(--surface2);
  border-radius: 5px;
  color: var(--green);
}
.strat-proj-day b {
  color: var(--text-dim);
  font-weight: 600;
  margin-right: 3px;
}

/* Warning footer */
.strat-warning {
  font-size: 0.68rem;
  color: var(--yellow);
  background: rgba(255,193,7,0.06);
  padding: 6px 10px;
  border-radius: 6px;
  line-height: 1.45;
  margin-top: 6px;
}

@media (max-width: 480px) {
  .strat-exit-grid { grid-template-columns: repeat(2, 1fr); }
  .strat-boll-labels { padding: 3px 40px 0; }
  .strat-rule-target { font-size: 0.6rem; }
  .strat-proj { gap: 5px; }
  .strat-proj-day { flex: 1; text-align: center; min-width: 0; }
}

/* ── Agent Trading Panel ── */
.agent-panel {
  margin: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.agent-panel:not(.expanded) { display: none; }
.controls-row__badge--agent {
  background: rgba(33,150,243,0.15);
  color: var(--blue);
}

.agent-panel__summary { padding: 8px 10px; }
.agent-panel__loading {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
  padding: 12px;
}

.agent-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.agent-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  background: var(--surface2);
  border-radius: 6px;
}
.agent-stat__label {
  font-size: 0.55rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.agent-stat__value {
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 2px;
}
.agent-stat__value.positive { color: var(--green); }
.agent-stat__value.negative { color: var(--red); }

.agent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0 0;
  font-size: 0.6rem;
  color: var(--text-dim);
}
.agent-session {
  padding: 1px 6px;
  background: var(--surface2);
  border-radius: 4px;
  text-transform: capitalize;
}

.agent-section-title {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue);
  padding: 6px 10px 4px;
  border-top: 1px solid var(--border);
}

/* Agent positions table */
.agent-panel__positions { padding: 0 6px 4px; }
.agent-pos-table {
  width: 100%;
  font-size: 0.68rem;
  border-collapse: collapse;
  padding: 0 10px;
}
.agent-pos-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  padding: 3px 4px;
  font-size: 0.58rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.agent-pos-table td {
  padding: 4px;
  border-bottom: 1px solid rgba(30,42,58,0.5);
}
.agent-pos-table td.positive { color: var(--green); }
.agent-pos-table td.negative { color: var(--red); }
.agent-pos-sym { font-weight: 700; }
.agent-empty {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  padding: 10px;
}

/* Agent trades feed */
.agent-panel__trades { padding: 0 6px 6px; }
.agent-trades-feed {
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.agent-trade {
  padding: 5px 8px;
  border-radius: 6px;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
}
.agent-trade-buy { border-left-color: var(--green); background: rgba(0,230,118,0.03); }
.agent-trade-sell { border-left-color: var(--red); background: rgba(255,23,68,0.03); }
.agent-trade-row1 {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.agent-trade-badge {
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
}
.agent-trade-buy .agent-trade-badge { background: rgba(0,230,118,0.2); color: var(--green); }
.agent-trade-sell .agent-trade-badge { background: rgba(255,23,68,0.2); color: var(--red); }
.agent-trade-sym { font-size: 0.75rem; font-weight: 700; }
.agent-trade-qty { font-size: 0.65rem; color: var(--text-dim); }
.agent-trade-price { font-size: 0.7rem; }
.agent-trade-time {
  font-size: 0.55rem;
  color: var(--text-dim);
  margin-left: auto;
}
.agent-trade-reasoning {
  font-size: 0.62rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 3px;
  line-height: 1.4;
  opacity: 0.8;
}
.agent-trade .positive { color: var(--green); font-weight: 600; font-size: 0.68rem; }
.agent-trade .negative { color: var(--red); font-weight: 600; font-size: 0.68rem; }

@media (max-width: 480px) {
  .agent-summary { grid-template-columns: repeat(2, 1fr); }
  .agent-pos-table { font-size: 0.62rem; }
  .agent-trade-time { display: none; }
}

/* ── BOLL-M Combined Row ── */
.card__boll-combined .boll-combined-values {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.boll-sep {
  color: var(--text-dim);
  opacity: 0.3;
  font-size: 0.7rem;
}
.boll-tf-tag {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(255,255,255,0.06);
  padding: 1px 4px;
  border-radius: 3px;
  min-width: 20px;
  text-align: center;
}
.boll-m-count {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  white-space: nowrap;
}
.boll-m-below.active {
  color: var(--green);
  background: rgba(16, 185, 129, 0.12);
}
.boll-m-above.active {
  color: var(--red);
  background: rgba(239, 68, 68, 0.12);
}
.boll-m-avg {
  font-size: 0.6rem;
  color: var(--text-dim);
  opacity: 0.55;
}

/* ── Pk/Pr(3M) Row ── */
.card__pkpr-row .label small {
  font-size: 0.6rem;
  opacity: 0.6;
}
.pkpr-scroll-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.pkpr-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: #f59e0b;
  white-space: nowrap;
  flex-shrink: 0;
}
.pkpr-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}
.pkpr-scroll::-webkit-scrollbar { display: none; }
.pkpr-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.pkpr-item b {
  color: var(--accent);
  font-size: 0.6rem;
}
.pkpr-vol {
  color: #f59e0b;
  font-weight: 600;
}
.pkpr-none {
  font-size: 0.68rem;
  color: var(--text-dim);
  opacity: 0.5;
}

/* ── Gain/Loss Badge ── */
.gl-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1;
}
.gl-badge small {
  font-weight: 400;
  opacity: 0.7;
}
.gl-gainer {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.gl-loser {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
