:root{
  --bg:#0F0A0B;
  --bg-elev:#180F11;
  --card:#1E1315;
  --border:#3A2226;
  --text:#F2E9EA;
  --text2:#B8A5A8;
  --accent:#A0293D;
  --brand:#7E2234;
  --brand-peach:#F9B37C;
  --brand-gray:#6C6E71;
  --buy:#2E9E5B;
  --sell:#C7434B;
  --neutral:#B8A5A8;
  --radius:14px;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:linear-gradient(180deg,#170D0F,#0F0A0B 300px);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}

.container{
  max-width:1200px;
  margin:0 auto;
  padding:16px;
}

header.top{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:20px 16px 12px;
  border-bottom:1px solid var(--border);
  background:linear-gradient(180deg,#1A0D11,#110809);
}
header.top h1{
  margin:0;
  font-size:clamp(20px,5vw,26px);
  letter-spacing:.3px;
}
header.top h1 span{color:var(--brand-peach)}
header.top p{
  margin:0;
  color:var(--text2);
  font-size:13px;
  max-width:640px;
}

.top-row{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  flex-wrap:wrap;
}
.user-box{
  display:flex;
  align-items:center;
  gap:10px;
  flex-shrink:0;
}
.user-email{
  font-size:12px;
  color:var(--text2);
  max-width:180px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.auth-panel{max-width:420px;margin:40px auto}
.auth-panel h2{margin:0 0 14px;color:var(--brand-peach);font-size:18px}
.auth-panel form{display:flex;flex-direction:column;gap:10px}
.auth-links{
  display:flex;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:8px;
  margin-top:14px;
}
.link-btn{
  background:none;
  border:none;
  color:var(--brand-peach);
  font-size:12.5px;
  cursor:pointer;
  padding:6px 0;
}
.link-btn:hover{text-decoration:underline}

.disclaimer{
  background:rgba(160,41,61,.12);
  border:1px solid rgba(160,41,61,.4);
  border-radius:10px;
  padding:10px 14px;
  font-size:12.5px;
  color:var(--text2);
  margin:14px 0;
}

.panel{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px;
  margin-bottom:16px;
}
.panel h2{
  margin:0 0 10px;
  font-size:15px;
  color:var(--brand-peach);
  text-transform:uppercase;
  letter-spacing:.06em;
}

.watchlist-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}

.chip{
  display:flex;
  align-items:center;
  gap:6px;
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:999px;
  padding:6px 8px 6px 14px;
  font-size:13px;
  font-weight:600;
}
.chip button{
  background:none;
  border:none;
  color:var(--text2);
  font-size:16px;
  line-height:1;
  padding:6px;
  cursor:pointer;
  min-width:28px;
  min-height:28px;
}
.chip button[data-remove]:hover{color:var(--sell)}

.chip-move{
  font-size:12px !important;
  min-width:22px !important;
  min-height:22px !important;
  padding:2px !important;
  border-radius:6px;
}
.chip-move:not(:disabled):hover{background:rgba(249,179,124,.15);color:var(--brand-peach) !important}
.chip-move:disabled{opacity:.25;cursor:default}

.add-form{
  display:flex;
  gap:8px;
  flex:1;
  min-width:220px;
}
.add-form input{
  flex:1;
  min-width:0;
}

.search-wrap{position:relative}
.search-results{
  display:none;
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  right:0;
  z-index:20;
  list-style:none;
  margin:0;
  padding:6px;
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:10px;
  max-height:320px;
  overflow-y:auto;
  box-shadow:0 8px 24px rgba(0,0,0,.4);
}
.search-results.open{display:block}
.search-results li{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:10px 10px;
  border-radius:8px;
  cursor:pointer;
}
.search-results li:hover, .search-results li:active{background:rgba(249,179,124,.1)}
.search-results .sr-main{display:flex;flex-direction:column;min-width:0}
.search-results .sr-symbol{font-weight:700;font-size:13.5px}
.search-results .sr-name{font-size:11.5px;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search-results .sr-meta{font-size:10.5px;color:var(--text2);text-align:right;white-space:nowrap;flex-shrink:0}
.search-results .sr-empty{color:var(--text2);font-size:12.5px;padding:10px;cursor:default}

input[type=text],input[type=password]{
  background:var(--bg-elev);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:10px;
  padding:11px 12px;
  font-size:14px;
  min-height:44px;
}
input[type=text]:focus,input[type=password]:focus{outline:2px solid var(--accent)}

button.btn{
  background:var(--brand);
  color:#fff;
  border:none;
  border-radius:10px;
  padding:11px 16px;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  min-height:44px;
}
button.btn:active{background:var(--accent)}
button.btn.secondary{
  background:transparent;
  border:1px solid var(--border);
  color:var(--text2);
}
button.btn.small{
  padding:8px 12px;
  min-height:36px;
  font-size:13px;
}

.settings-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.settings-row .add-form{flex:2;min-width:260px}
.settings-note{font-size:12px;color:var(--text2);width:100%}
.settings-note a{color:var(--brand-peach)}

.grid{
  display:grid;
  grid-template-columns:1fr;
  gap:16px;
}
@media(min-width:760px){
  .grid{grid-template-columns:repeat(auto-fill,minmax(380px,1fr));}
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
  min-width:0;
}

.card-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:8px;
}
.card-head h3{
  margin:0;
  font-size:18px;
}
.card-head .company{
  font-size:12px;
  color:var(--text2);
  font-weight:400;
  display:block;
  margin-top:2px;
}
.ticker-link{
  text-decoration:none;
  color:inherit;
  display:block;
}
.ticker-link-arrow{
  color:var(--brand-peach);
  font-weight:400;
  font-size:15px;
}
.ticker-link:hover h3, .ticker-link:active h3{color:var(--brand-peach)}
.card-head .price{
  text-align:right;
}
.card-head .price .val{
  font-size:20px;
  font-weight:700;
}
.card-head .price .chg{
  font-size:12.5px;
  font-weight:600;
}
.chg.up{color:var(--buy)}
.chg.down{color:var(--sell)}

.gauge-wrap{display:flex;flex-direction:column;gap:6px}
.gauge-label{
  display:flex;
  justify-content:space-between;
  font-size:13px;
  font-weight:700;
}
.gauge-track{
  position:relative;
  height:10px;
  border-radius:999px;
  background:linear-gradient(90deg,#1E8A4C,#2E9E5B 20%,#4B4142 48%,#4B4142 52%,#B23A42 80%,#C7434B);
}
.gauge-marker{
  position:absolute;
  top:-4px;
  width:18px;
  height:18px;
  border-radius:50%;
  background:#fff;
  border:3px solid var(--brand);
  transform:translateX(-50%);
  box-shadow:0 1px 4px rgba(0,0,0,.5);
}
.gauge-scale{
  display:flex;
  justify-content:space-between;
  font-size:10.5px;
  color:var(--text2);
}

.stats-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:8px;
  font-size:12.5px;
}
@media(min-width:420px){
  .stats-grid{grid-template-columns:repeat(3,1fr);}
}
.stat{
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:8px;
  padding:8px;
}
.stat .k{color:var(--text2);display:block;font-size:11px}
.stat .v{font-weight:700;font-size:13.5px}

.range-row{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.range-row button{
  background:var(--bg-elev);
  border:1px solid var(--border);
  color:var(--text2);
  border-radius:8px;
  padding:6px 10px;
  font-size:12px;
  cursor:pointer;
  min-height:32px;
}
.range-row button.active{
  background:var(--brand);
  color:#fff;
  border-color:var(--brand);
}

.chart-box{
  position:relative;
  height:220px;
  width:100%;
}
@media(min-width:600px){
  .chart-box{height:260px}
}

.card-foot{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:11.5px;
  color:var(--text2);
}
.card-foot button{
  background:none;
  border:none;
  color:var(--brand-peach);
  cursor:pointer;
  font-size:12px;
  padding:6px;
  min-height:32px;
}

.state-msg{
  font-size:13px;
  color:var(--text2);
  padding:20px 0;
  text-align:center;
}
.state-msg.error{color:var(--sell)}

.skeleton{
  opacity:.5;
  animation:pulse 1.2s ease-in-out infinite;
}
@keyframes pulse{
  0%,100%{opacity:.4}
  50%{opacity:.8}
}

footer.app-foot{
  text-align:center;
  color:var(--text2);
  font-size:11.5px;
  padding:24px 16px 40px;
}

/* ─── página de detalhe ─────────────────────────────────────────────── */
.back-link{
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:var(--text2);
  text-decoration:none;
  font-size:13px;
  padding:8px 0;
}
.back-link:hover{color:var(--brand-peach)}

.detail-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  flex-wrap:wrap;
  gap:12px;
  margin-bottom:4px;
}
.detail-head h1{
  margin:0;
  font-size:clamp(24px,6vw,32px);
}
.detail-head .company{color:var(--text2);font-size:14px;display:block;margin-top:2px}
.detail-head .price .val{font-size:clamp(24px,6vw,30px);font-weight:700}
.detail-head .price .chg{font-size:14px;font-weight:600;text-align:right;display:block}

.detail-chart-box{
  position:relative;
  height:340px;
  width:100%;
}
@media(min-width:700px){
  .detail-chart-box{height:440px}
}

.levels-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:16px;
}
@media(min-width:700px){
  .levels-grid{grid-template-columns:1fr 1fr}
}

.level-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.level-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:8px;
  padding:9px 12px;
  font-size:13.5px;
}
.level-row .tag{
  font-size:11px;
  color:var(--text2);
  min-width:70px;
}
.level-row .price{font-weight:700}
.level-row .pct{font-size:12px;color:var(--text2);min-width:56px;text-align:right}
.level-row.support .tag{color:var(--buy)}
.level-row.resistance .tag{color:var(--sell)}
.level-row.current{
  border-color:var(--brand-peach);
  background:rgba(249,179,124,.08);
}
.level-row.current .price{color:var(--brand-peach)}

.fib-note{font-size:12px;color:var(--text2);margin:0 0 10px}

.trend-note{
  border-radius:8px;
  padding:10px 12px;
  font-size:12.5px;
  margin-top:4px;
}
.trend-note.trend-warn{background:rgba(199,67,75,.12);border:1px solid rgba(199,67,75,.4)}
.trend-note.trend-info{background:rgba(184,165,168,.08);border:1px solid var(--border);color:var(--text2)}

.tf-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:10px;
}
.tf-box{
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:10px;
  padding:14px 8px;
  text-align:center;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.tf-label{font-size:12px;color:var(--text2);text-transform:uppercase;letter-spacing:.04em}
.tf-verdict{font-weight:700;font-size:13px}
.tf-verdict.tf-buy{color:var(--buy)}
.tf-verdict.tf-sell{color:var(--sell)}
.tf-verdict.tf-neutral{color:var(--neutral)}
.tf-score{font-size:11px;color:var(--text2)}
