
/* ==========================================================================
   POSIÇÕES ABERTAS — aba da carteira
   ========================================================================== */

.pos-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.pos-head h3 {
  margin: 0 0 3px;
  font-size: 17px;
  font-weight: 800;
  color: var(--text, #F5F7FA);
  letter-spacing: -.02em;
}

.pos-head p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted, #8996AA);
}

/* ---- resumo ---- */
.pos-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .035);
  font-size: 13px;
  color: var(--text-muted, #8996AA);
}

.pos-summary b {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pos-summary.is-up b { color: #0ECB81; }
.pos-summary.is-down b { color: #F6465D; }
.pos-summary.is-up { border-color: rgba(14, 203, 129, .25); background: rgba(14, 203, 129, .07); }
.pos-summary.is-down { border-color: rgba(246, 70, 93, .25); background: rgba(246, 70, 93, .07); }

/* ---- grade de cards ---- */
.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.pos-card {
  padding: 15px;
  border-radius: 16px;
  background: #14181E;
  border: 1px solid rgba(255, 255, 255, .07);
  position: relative;
  overflow: hidden;
}

.pos-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #F6465D;
}
.pos-card.is-up::before { background: #0ECB81; }

.pos-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.pos-card__asset {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.pos-card__sym {
  font-size: 15px;
  font-weight: 800;
  color: #F5F7FA;
  letter-spacing: -.01em;
}

.pos-card__lado {
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.pos-card__lado.is-long  { background: rgba(14, 203, 129, .15); color: #0ECB81; }
.pos-card__lado.is-short { background: rgba(246, 70, 93, .15); color: #F6465D; }

.pos-card__result {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
}

.pos-card__pnl {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #F6465D;
}

.pos-card.is-up .pos-card__pnl { color: #0ECB81; }

.pos-card__pct {
  font-size: 11.5px;
  font-weight: 700;
  color: #8996AA;
  font-variant-numeric: tabular-nums;
}

.pos-card.is-up .pos-card__pct { color: rgba(14, 203, 129, .8); }
.pos-card.is-down .pos-card__pct { color: rgba(246, 70, 93, .8); }

.pos-card__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 12px;
}

.pos-card__grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pos-card__grid span {
  font-size: 11px;
  color: #8996AA;
}

.pos-card__grid b {
  font-size: 13px;
  font-weight: 700;
  color: #C5CBD4;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* barra de intensidade do resultado */
.pos-card__bar {
  margin-top: 13px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
}

.pos-card__bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: #F6465D;
  transition: width .3s ease;
}

.pos-card.is-up .pos-card__bar i { background: #0ECB81; }

/* ---- vazio ---- */
.pos-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 44px 20px;
  border: 1px dashed rgba(255, 255, 255, .1);
  border-radius: 16px;
  color: var(--text-muted, #8996AA);
}

.pos-empty__icon {
  font-size: 30px;
  line-height: 1;
  margin-bottom: 4px;
  opacity: .8;
}

.pos-empty b {
  font-size: 15px;
  color: var(--text, #F5F7FA);
  font-weight: 700;
}

.pos-empty p {
  margin: 0;
  font-size: 13px;
  max-width: 320px;
  line-height: 1.5;
}

.pos-empty .btn {
  margin-top: 10px;
}

/* ---- mobile ---- */
@media (max-width: 900px) {
  .pos-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .pos-head .btn {
    width: 100%;
    text-align: center;
  }

  .pos-grid {
    grid-template-columns: 1fr;
  }

  .pos-card {
    padding: 14px;
    border-radius: 14px;
  }

  .pos-card__pnl { font-size: 16px; }

  .pos-card__grid b { font-size: 12.5px; }

  .pos-summary {
    padding: 12px 14px;
  }

  .pos-summary b { font-size: 16px; }

  .pos-empty { padding: 34px 16px; }
}

@media (max-width: 900px) {
  .pos-card__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .pos-card__grid { gap: 8px; }
  .pos-card__grid b { font-size: 12px; }
  .pos-card__lado { font-size: 10px; padding: 2px 6px; }
}

/* ---- histórico de posições encerradas ---- */
.pos-history {
  margin-top: 22px;
}

.pos-history h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted, #8996AA);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.pos-hist {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 7px;
  border-radius: 12px;
  background: #151920;
  border: 1px solid rgba(255, 255, 255, .055);
  font-size: 12.5px;
}

.pos-hist__sym {
  font-weight: 800;
  color: #F5F7FA;
  white-space: nowrap;
}

.pos-hist__lado {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.pos-hist__lado.is-long  { background: rgba(14, 203, 129, .15); color: #0ECB81; }
.pos-hist__lado.is-short { background: rgba(246, 70, 93, .15); color: #F6465D; }

.pos-hist__meta {
  color: #98A0AC;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-hist__res {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #F6465D;
  white-space: nowrap;
}

.pos-hist.is-up .pos-hist__res { color: #0ECB81; }

.pos-hist__date {
  color: #59606B;
  font-size: 11px;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .pos-hist {
    grid-template-columns: auto 1fr auto;
    row-gap: 4px;
  }

  .pos-hist__date {
    grid-column: 1 / -1;
    font-size: 10.5px;
  }
}
