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

:root {
  --bg:      #09090f;
  --bg2:     #111118;
  --bg3:     #1a1a28;
  --border:  #1e1e30;
  --text:    #e2e2f0;
  --muted:   #5a5a7a;
  --orange:  #f7931a;
  --green:   #00d48c;
  --red:     #ff4055;
  --yellow:  #f5c518;
  --blue:    #4e8ef7;
  --purple:  #8b5cf6;
  --font:    'Inter', system-ui, sans-serif;
  --mono:    'JetBrains Mono', monospace;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13px; line-height: 1.5; overflow-x: hidden }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.card-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ── Header ─────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}
.header-logo { display: flex; align-items: center; gap: 7px }
.logo-text { font-weight: 800; font-size: 16px; letter-spacing: -0.5px; color: var(--text) }
.logo-accent { color: var(--orange) }
.logo-version { font-size: 9px; font-weight: 700; color: var(--muted); background: var(--bg3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; letter-spacing: 0.5px }
.header-price { display: flex; align-items: center; gap: 8px }
.live-price { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--text) }
.change-badge { font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 5px; background: var(--bg3) }
.change-badge.pos { color: var(--green); background: rgba(0,212,140,.1) }
.change-badge.neg { color: var(--red);   background: rgba(255,64,85,.1) }
.header-meta { display: flex; align-items: center; gap: 8px; margin-left: auto }
.last-update { font-size: 10px; color: var(--muted); font-family: var(--mono) }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; flex-shrink: 0 }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(0.85)} }

/* ── Layout ─────────────────────────────────────────────────────── */
.main {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  gap: 10px;
  padding: 10px;
  min-height: calc(100vh - 50px);
  align-items: start;
}
.panel-left, .panel-right { display: flex; flex-direction: column; gap: 10px }
.panel-center { display: flex; flex-direction: column; gap: 10px; min-width: 0 }

/* ── Gauge ──────────────────────────────────────────────────────── */
.gauge-card { padding: 16px 14px 10px }
.gauge-wrap { display: flex; justify-content: center }
.gauge-svg { width: 180px; height: auto }
.score-breakdown { display: flex; flex-direction: column; gap: 4px; margin-top: 8px }
.breakdown-row {
  display: flex; align-items: center; gap: 6px; font-size: 10px;
}
.breakdown-label { color: var(--muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.breakdown-bar { flex: 1; height: 3px; background: var(--bg3); border-radius: 2px; overflow: hidden }
.breakdown-fill { height: 100%; border-radius: 2px; transition: width .8s ease }
.breakdown-score { color: var(--muted); font-family: var(--mono); font-size: 9px; width: 28px; text-align: right }

/* ── MTF ────────────────────────────────────────────────────────── */
.mtf-card {}
.mtf-badges { display: flex; gap: 6px; margin-bottom: 8px }
.mtf-badge {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 6px 4px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg3); transition: border-color .3s;
}
.mtf-badge.bullish { border-color: rgba(0,212,140,.3); background: rgba(0,212,140,.05) }
.mtf-badge.bearish { border-color: rgba(255,64,85,.3);  background: rgba(255,64,85,.05)  }
.mtf-badge.neutral  { border-color: rgba(245,197,24,.3); background: rgba(245,197,24,.05) }
.mtf-tf { font-size: 10px; font-weight: 700; color: var(--muted) }
.mtf-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted) }
.mtf-badge.bullish .mtf-dot { background: var(--green) }
.mtf-badge.bearish .mtf-dot { background: var(--red)   }
.mtf-badge.neutral  .mtf-dot { background: var(--yellow) }
.mtf-signal { font-size: 9px; font-weight: 600; color: var(--muted) }
.mtf-badge.bullish .mtf-signal { color: var(--green) }
.mtf-badge.bearish .mtf-signal { color: var(--red)   }
.mtf-badge.neutral  .mtf-signal { color: var(--yellow) }
.mtf-summary { font-size: 10px; font-weight: 600; text-align: center; color: var(--muted); letter-spacing: .5px }
.mtf-summary.strong_bull { color: var(--green) }
.mtf-summary.bull { color: rgba(0,212,140,.7) }
.mtf-summary.bear { color: rgba(255,64,85,.7) }
.mtf-summary.strong_bear { color: var(--red) }

/* ── Context ─────────────────────────────────────────────────────── */
.context-rows { display: flex; flex-direction: column; gap: 8px }
.ctx-row { display: flex; align-items: center; justify-content: space-between; gap: 8px }
.ctx-label { font-size: 10px; color: var(--muted); white-space: nowrap }
.ctx-value { font-family: var(--mono); font-size: 11px; font-weight: 600; text-align: right }
.ctx-value.pos { color: var(--green) }
.ctx-value.neg { color: var(--red)   }
.ctx-value.warn { color: var(--yellow) }
.mono { font-family: var(--mono) }
.fg-inline { display: flex; align-items: center; gap: 6px }
.fg-bar-mini { width: 60px; height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; flex-shrink: 0 }
.fg-fill-mini { height: 100%; border-radius: 2px; background: linear-gradient(to right, var(--red), var(--yellow), var(--green)); transition: width .8s ease }

/* ── Recommendation ─────────────────────────────────────────────── */
.rec-text { font-size: 11px; color: var(--text); line-height: 1.6; opacity: .9 }

/* ── Chart ──────────────────────────────────────────────────────── */
.chart-card { padding: 10px }
.chart-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap }
.chart-legend { display: flex; gap: 10px; flex-wrap: wrap }
.leg { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted) }
.leg-dot { width: 8px; height: 3px; border-radius: 2px; flex-shrink: 0 }
.chart-controls { display: flex; align-items: center; gap: 6px }
.interval-btns { display: flex; gap: 3px }
.btn-iv {
  padding: 3px 8px; border-radius: 5px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 10px; font-weight: 600;
  cursor: pointer; transition: all .15s; font-family: var(--font);
}
.btn-iv:hover { border-color: var(--orange); color: var(--orange) }
.btn-iv.active { background: var(--orange); border-color: var(--orange); color: #000 }
.btn-fs {
  padding: 5px 6px; border-radius: 5px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center;
}
.btn-fs:hover { border-color: var(--border); color: var(--text) }
.chart-container { height: 380px; border-radius: 6px; overflow: hidden }

/* ── Indicators Strip ───────────────────────────────────────────── */
.indicators-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.ind {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  transition: border-color .2s;
}
.ind.bullish { border-color: rgba(0,212,140,.3) }
.ind.bearish { border-color: rgba(255,64,85,.3) }
.ind.neutral  { border-color: rgba(245,197,24,.3) }
.ind-name { font-size: 9px; color: var(--muted); font-weight: 600; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.ind-val { font-family: var(--mono); font-size: 13px; font-weight: 700; margin: 2px 0; color: var(--text) }
.ind.bullish .ind-val { color: var(--green) }
.ind.bearish .ind-val { color: var(--red)   }
.ind.neutral  .ind-val { color: var(--yellow) }
.ind-sig { font-size: 8px; color: var(--muted); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }

/* ── S/R Radar ──────────────────────────────────────────────────── */
.sr-radar-card { padding: 12px 14px }
.sr-tf-label { font-size: 9px; color: var(--muted); font-weight: 500; margin-left: 6px }
.zone-bar-wrap { margin: 8px 0 6px }
.zone-bar { position: relative; height: 36px; border-radius: 6px; overflow: visible; margin: 0 12px }
.zone-gradient { position: absolute; inset: 10px 0; border-radius: 4px; background: linear-gradient(to right, rgba(0,212,140,.18) 0%, rgba(0,212,140,.06) 42%, rgba(100,100,120,.12) 48%, rgba(100,100,120,.12) 52%, rgba(255,64,85,.06) 58%, rgba(255,64,85,.18) 100%); border: 1px solid var(--border) }
.zone-price-marker { position: absolute; top: 0; bottom: 0; transform: translateX(-50%); z-index: 5; display: flex; flex-direction: column; align-items: center }
.zone-price-line { width: 2px; height: 36px; background: var(--orange); border-radius: 1px }
.zone-price-tag { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); background: var(--orange); color: #000; font-size: 8px; font-weight: 700; padding: 1px 4px; border-radius: 3px; white-space: nowrap }
.zone-dots { position: absolute; inset: 0; pointer-events: none }
.zone-dot-wrap {
  position: absolute; top: 0; display: flex; flex-direction: column; align-items: center;
  transform: translateX(-50%); pointer-events: all; cursor: default; z-index: 2;
}
.zone-dot-wrap:hover .zone-dot { transform: scale(1.4) }
.zone-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.15); margin-top: 7px;
  transition: transform .2s; box-shadow: 0 0 6px rgba(0,0,0,.4); flex-shrink: 0;
}
.zone-dot.fraco     { background: #444466 }
.zone-dot.relevante { background: #4e8ef7 }
.zone-dot.bom       { background: #f5c518 }
.zone-dot.muito_bom { background: #f7931a; box-shadow: 0 0 8px rgba(247,147,26,.5) }
.zone-dot.super_bom { background: #00d48c; box-shadow: 0 0 10px rgba(0,212,140,.6); animation: glowPulse 2s infinite }
@keyframes glowPulse { 0%,100% { box-shadow: 0 0 8px rgba(0,212,140,.5) } 50% { box-shadow: 0 0 16px rgba(0,212,140,.9) } }
.zone-dot-price { font-size: 8px; font-weight: 600; color: var(--muted); white-space: nowrap; margin-top: 2px }
.zone-dot-rating { font-size: 7px; font-weight: 700; white-space: nowrap; letter-spacing: .3px }
.zone-dot-rating.fraco     { color: #444466 }
.zone-dot-rating.relevante { color: #4e8ef7 }
.zone-dot-rating.bom       { color: #f5c518 }
.zone-dot-rating.muito_bom { color: #f7931a }
.zone-dot-rating.super_bom { color: #00d48c }
.zone-dot-wrap::before { content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: var(--bg3); border: 1px solid var(--border); color: var(--text); font-size: 9px; padding: 3px 7px; border-radius: 5px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 10 }
.zone-dot-wrap:hover::before { opacity: 1 }
.zone-labels { display: flex; justify-content: space-between; font-size: 8px; color: var(--muted); margin-top: 4px; padding: 0 12px }
.zone-legend { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px }
.zone-leg-item { font-size: 9px; padding: 2px 6px; border-radius: 3px; border: 1px solid var(--border); color: var(--muted); cursor: default; white-space: nowrap }
.zone-leg-item.support { border-color: rgba(0,212,140,.3); color: var(--green) }
.zone-leg-item.resistance { border-color: rgba(255,64,85,.3); color: var(--red) }

/* ── Entry & Trade ──────────────────────────────────────────────── */
.entry-form { display: flex; gap: 6px; margin-bottom: 6px }
.input-wrap { flex: 1; display: flex; align-items: center; background: var(--bg3); border: 1px solid var(--border); border-radius: 7px; padding: 0 10px; gap: 6px }
.input-pfx { color: var(--muted); font-family: var(--mono); font-size: 13px }
.input-wrap input { background: transparent; border: none; outline: none; color: var(--text); font-family: var(--mono); font-size: 13px; width: 100%; padding: 8px 0 }
.input-wrap input::placeholder { color: var(--muted) }
.btn-register { padding: 8px 12px; background: var(--orange); border: none; border-radius: 7px; color: #000; font-weight: 700; font-size: 12px; cursor: pointer; white-space: nowrap; font-family: var(--font) }
.btn-register:hover { opacity: .9 }
.entry-hint { font-size: 10px; color: var(--muted) }

.pnl-row { display: flex; align-items: center; justify-content: space-between; gap: 6px }
.pnl-col { text-align: center; min-width: 0 }
.pnl-label { font-size: 9px; color: var(--muted); font-weight: 700; letter-spacing: 1px; margin-bottom: 2px }
.pnl-entry, .pnl-current { font-family: var(--mono); font-size: 13px; font-weight: 700 }
.pnl-pct { font-family: var(--mono); font-size: 18px; font-weight: 800 }
.pnl-pct.pos { color: var(--green) }
.pnl-pct.neg { color: var(--red)   }
.pnl-arrow { color: var(--muted); font-size: 16px }

.atr-stop { font-size: 10px; color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); line-height: 1.5 }
.atr-stop b { color: var(--red) }

.targets-list, .rebuy-list { display: flex; flex-direction: column; gap: 6px }
.target-item { padding: 8px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg3) }
.target-item.reached { border-color: rgba(0,212,140,.4) }
.target-item.pending { border-color: var(--border) }
.target-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px }
.target-label { font-weight: 600; font-size: 11px }
.target-gain { font-family: var(--mono); font-size: 12px; color: var(--green); font-weight: 700 }
.target-price { font-family: var(--mono); font-size: 12px; color: var(--text) }
.target-portion { font-size: 10px; color: var(--muted) }
.target-reason { font-size: 10px; color: var(--muted); margin-top: 3px }
.target-reached-badge { font-size: 8px; color: var(--green); font-weight: 700; letter-spacing: .5px }

.rebuy-item { padding: 8px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg3); font-size: 10px; line-height: 1.6 }
.rebuy-item b { color: var(--orange) }

/* ── S/R List ──────────────────────────────────────────────────── */
.sr-card-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px }
.sr-tf-badge { font-size: 9px; color: var(--muted); background: var(--bg3); border: 1px solid var(--border); padding: 2px 6px; border-radius: 4px }
.sr-list { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto }
.sr-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; border: 1px solid transparent }
.sr-item.resistance { background: rgba(255,64,85,.05); border-color: rgba(255,64,85,.15) }
.sr-item.support    { background: rgba(0,212,140,.05); border-color: rgba(0,212,140,.15) }
.sr-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0 }
.sr-item.resistance .sr-dot { background: var(--red) }
.sr-item.support    .sr-dot { background: var(--green) }
.sr-label { font-size: 10px; flex: 1 }
.sr-price { font-family: var(--mono); font-size: 11px; font-weight: 600 }
.sr-dist  { font-family: var(--mono); font-size: 10px; color: var(--muted); width: 44px; text-align: right }
.sr-strength-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); flex-shrink: 0 }
.sr-item.resistance .sr-strength-dot.strong { background: var(--red) }
.sr-item.support    .sr-strength-dot.strong { background: var(--green) }
.sr-strength-dot.medium { background: var(--yellow) }

/* ── Scored S/R Levels ─────────────────────────────────────────── */
.scored-levels-wrap {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.scored-col { display: flex; flex-direction: column; gap: 2px }
.scored-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 6px;
  background: var(--bg3);
  border-radius: 5px;
  border: 1px solid var(--border);
  margin: 3px 0;
}
.scored-price-divider { font-size: 9px; font-weight: 700; letter-spacing: 1px; color: var(--orange) }
.scored-price-val { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--orange) }
.scored-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid transparent;
}
.scored-row.resistance { border-color: rgba(255,64,85,.15) }
.scored-row.support    { border-color: rgba(0,212,140,.15) }
.scored-row:hover { background: var(--bg3) }
.scored-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  min-width: 60px;
  text-align: center;
}
.rating-super   { background: rgba(0,212,140,.2);  color: var(--green)  }
.rating-muito   { background: rgba(247,147,26,.2); color: var(--orange) }
.rating-bom     { background: rgba(245,197,24,.2); color: var(--yellow) }
.rating-relevante { background: rgba(78,142,247,.2); color: var(--blue) }
.rating-fraco   { background: rgba(90,90,122,.2);  color: var(--muted)  }
.scored-label { font-size: 10px; color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.scored-p { font-family: var(--mono); font-size: 11px; font-weight: 600 }
.scored-d { font-family: var(--mono); font-size: 10px; color: var(--muted); width: 44px; text-align: right; flex-shrink: 0 }
.resistance-col .scored-p { color: var(--red) }
.support-col    .scored-p { color: var(--green) }

/* ── Alert ─────────────────────────────────────────────────────── */
.alert-banner { position: fixed; bottom: 14px; right: 14px; background: var(--bg3); border: 1px solid var(--orange); border-radius: 8px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-size: 12px; z-index: 999; max-width: 320px; box-shadow: 0 4px 24px rgba(0,0,0,.5) }
.alert-banner button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px }
.alert-banner.hidden { display: none }

/* ── Collapsible left panel ─────────────────────────────────────── */
.card-title-row {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.collapse-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 2px 4px; transition: transform .2s, color .15s;
}
.collapse-btn:hover { color: var(--text) }
.card.collapsed .collapse-btn { transform: rotate(-90deg) }
.card.collapsed .card-body { display: none }

/* ── Lite link in Pro header ────────────────────────────────────── */
.lite-link {
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  color: var(--muted); text-decoration: none;
  border: 1px solid var(--border); border-radius: 4px;
  padding: 3px 8px; transition: all .15s; white-space: nowrap;
}
.lite-link:hover { color: var(--text); border-color: var(--muted) }

/* ── Utils ─────────────────────────────────────────────────────── */
.hidden { display: none !important }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .main { grid-template-columns: 220px 1fr 260px }
  .indicators-strip { grid-template-columns: repeat(4, 1fr) }
}
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; grid-template-rows: auto }
  .panel-left { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
  .indicators-strip { grid-template-columns: repeat(4, 1fr) }
  .chart-container { height: 300px }
}
@media (max-width: 580px) {
  .header { flex-wrap: wrap; gap: 8px }
  .panel-left { grid-template-columns: 1fr }
  .indicators-strip { grid-template-columns: repeat(2, 1fr) }
  .main { padding: 8px; gap: 8px }
}

/* ── Fullscreen chart ─────────────────────────────────────────── */
.chart-card.fullscreen {
  position: fixed; inset: 0; z-index: 200; border-radius: 0; padding: 10px;
  display: flex; flex-direction: column;
}
.chart-card.fullscreen .chart-container { flex: 1; height: auto !important }
