/* Backtest de Combinações Campeãs */
.bt-page {
  padding-bottom: 32px;
}

.bt-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: center;
  margin-bottom: 26px;
}

.bt-hero h1 {
  margin: 14px 0 12px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.bt-hero h1 span {
  color: var(--primary);
}

.bt-hero p {
  max-width: 850px;
  color: var(--muted);
  line-height: 1.75;
}

.bt-hero-badge {
  min-width: 240px;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--primary), #d63ea4);
  color: #fff;
  box-shadow: 0 18px 40px rgba(166, 29, 125, 0.23);
  text-align: center;
}

.bt-hero-badge span,
.bt-hero-badge small {
  display: block;
  opacity: .9;
}

.bt-hero-badge strong {
  display: block;
  margin: 8px 0;
  font-size: 1.5rem;
}

.bt-panel {
  margin-top: 20px;
  padding: 24px;
  border-radius: 28px;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(166,29,125,.10);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.bt-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.bt-panel-head h2 {
  margin-top: 10px;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.bt-status {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  background: rgba(166,29,125,.07);
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
}

.bt-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.bt-field {
  display: grid;
  gap: 8px;
}

.bt-field > span {
  font-size: .9rem;
  font-weight: 750;
}

.bt-field em {
  font-weight: 500;
  color: var(--muted);
}

.bt-field input {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(166,29,125,.14);
  border-radius: 15px;
  padding: 0 14px;
  outline: none;
  background: rgba(255,255,255,.9);
}

.bt-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(166,29,125,.09);
}

.bt-field small,
.bt-field-static small {
  color: var(--muted);
  line-height: 1.45;
}

.bt-field-static {
  align-content: start;
  padding: 14px;
  border-radius: 15px;
  background: rgba(166,29,125,.05);
  border: 1px solid rgba(166,29,125,.08);
}

.bt-field-static strong {
  font-size: 1.1rem;
}

.bt-warning,
.bt-alert {
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: 17px;
  line-height: 1.6;
}

.bt-warning {
  background: rgba(247,181,0,.12);
  border: 1px solid rgba(247,181,0,.22);
  color: #72520d;
}

.bt-alert {
  background: rgba(200,44,145,.07);
  border: 1px solid rgba(200,44,145,.13);
  color: var(--primary-dark);
}

.bt-alert--error {
  background: rgba(214,46,46,.08);
  border-color: rgba(214,46,46,.16);
  color: #8e2222;
}

.bt-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.bt-progress-wrap {
  margin-top: 20px;
}

.bt-progress {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(166,29,125,.09);
}

.bt-progress > div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #e14baa);
  transition: width .18s ease;
}

.bt-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  color: var(--muted);
  font-size: .88rem;
}

.bt-progress-meta strong {
  color: var(--primary-dark);
}

.bt-score {
  min-width: 115px;
  text-align: center;
  border-radius: 18px;
  padding: 13px 16px;
  background: rgba(166,29,125,.07);
}

.bt-score span {
  display: block;
  color: var(--muted);
  font-size: .8rem;
}

.bt-score strong {
  display: block;
  margin-top: 5px;
  font-size: 1.35rem;
  color: var(--primary-dark);
}

.bt-balls {
  display: grid;
  grid-template-columns: repeat(15, minmax(40px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.bt-ball {
  aspect-ratio: 1;
  min-width: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #d63ea4);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(166,29,125,.15);
}

.bt-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.bt-metric-grid article,
.bt-card {
  padding: 17px;
  border-radius: 19px;
  background: rgba(166,29,125,.045);
  border: 1px solid rgba(166,29,125,.08);
}

.bt-metric-grid article span,
.bt-card span {
  display: block;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.35;
}

.bt-metric-grid article strong,
.bt-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.13rem;
  color: var(--text);
}

.bt-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 13px;
  margin-top: 20px;
}

.bt-card--accent {
  background: linear-gradient(135deg, rgba(166,29,125,.11), rgba(214,62,164,.08));
}

.bt-card--good strong {
  color: #0f7a49;
}

.bt-card--bad strong {
  color: #9c2b2b;
}

.bt-grid-2 {
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 20px;
}

#btSaldoChart {
  width: 100%;
  height: auto;
  min-height: 300px;
  display: block;
}

.bt-chart-message {
  padding: 14px;
  border-radius: 14px;
  background: rgba(247,181,0,.12);
  color: #72520d;
  margin-bottom: 12px;
}

.bt-stage-list {
  display: grid;
  gap: 11px;
}

.bt-stage-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: rgba(166,29,125,.045);
}

.bt-stage-row strong {
  color: var(--primary-dark);
}

.bt-stage-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(166,29,125,.09);
  overflow: hidden;
}

.bt-stage-bar div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #db48a8);
}

.bt-comparison {
  width: 100%;
  border-collapse: collapse;
}

.bt-comparison th,
.bt-comparison td {
  padding: 11px 10px;
  text-align: right;
  border-bottom: 1px solid rgba(166,29,125,.08);
}

.bt-comparison th:first-child,
.bt-comparison td:first-child {
  text-align: left;
}

.bt-comparison th {
  color: var(--muted);
  font-size: .8rem;
}

.bt-random-box {
  display: grid;
  gap: 11px;
}

.bt-random-box article {
  padding: 13px 14px;
  border-radius: 16px;
  background: rgba(166,29,125,.045);
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.bt-random-box span {
  color: var(--muted);
}

.bt-table-wrap {
  overflow: auto;
  max-height: 720px;
  border: 1px solid rgba(166,29,125,.08);
  border-radius: 18px;
}

.bt-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1500px;
  font-size: .84rem;
}

.bt-table th,
.bt-table td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(166,29,125,.08);
  vertical-align: top;
  white-space: nowrap;
}

.bt-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff8fd;
  color: var(--primary-dark);
  text-align: left;
}

.bt-table tbody tr:hover {
  background: rgba(166,29,125,.035);
}

.bt-combo {
  max-width: 330px;
  white-space: normal !important;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.bt-positive {
  color: #0f7a49;
  font-weight: 800;
}

.bt-negative {
  color: #a12828;
  font-weight: 800;
}

.bt-neutral {
  color: var(--muted);
}

.bt-method p {
  color: var(--muted);
  line-height: 1.75;
  max-width: 1050px;
}

.bt-method p + p {
  margin-top: 10px;
}

@media (max-width: 1100px) {
  .bt-form-grid,
  .bt-metric-grid,
  .bt-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .bt-grid-2,
  .bt-hero {
    grid-template-columns: 1fr;
  }

  .bt-hero-badge {
    max-width: 320px;
  }

  .bt-balls {
    grid-template-columns: repeat(8, 1fr);
  }
}

@media (max-width: 620px) {
  .bt-form-grid,
  .bt-metric-grid,
  .bt-cards {
    grid-template-columns: 1fr;
  }

  .bt-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .bt-panel-head {
    flex-direction: column;
  }

  .bt-balls {
    grid-template-columns: repeat(5, 1fr);
  }

  .bt-progress-meta {
    flex-direction: column;
  }
}


/* ===== Seleção automática/manual ===== */
.bt-selection-mode {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(166,29,125,.035);
  border: 1px solid rgba(166,29,125,.08);
}

.bt-mode-head,
.bt-manual-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.bt-mode-head > div:first-child {
  display: grid;
  gap: 5px;
}

.bt-mode-head > div:first-child > span {
  font-weight: 800;
}

.bt-mode-head small,
.bt-manual-note {
  color: var(--muted);
  line-height: 1.55;
}

.bt-mode-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 15px;
  background: rgba(166,29,125,.08);
}

.bt-mode-switch label {
  cursor: pointer;
}

.bt-mode-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.bt-mode-switch span {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--muted);
  transition: .18s ease;
}

.bt-mode-switch input:checked + span {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 6px 18px rgba(166,29,125,.12);
}

.bt-manual-box {
  display: grid;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(166,29,125,.08);
}

.bt-manual-top > div:first-child {
  display: grid;
  gap: 5px;
}

.bt-manual-top span {
  color: var(--muted);
  font-size: .9rem;
}

.bt-manual-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.bt-manual-actions .btn {
  min-height: 42px;
  padding: 0 14px;
  font-size: .86rem;
}

.bt-manual-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 8px;
}

.bt-manual-number {
  aspect-ratio: 1;
  min-width: 42px;
  border: 1px solid rgba(166,29,125,.15);
  border-radius: 13px;
  background: #fff;
  color: var(--primary-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: .15s ease;
}

.bt-manual-number:hover {
  transform: translateY(-1px);
  border-color: rgba(166,29,125,.35);
}

.bt-manual-number.is-selected {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), #d63ea4);
  box-shadow: 0 8px 18px rgba(166,29,125,.18);
}

.bt-manual-number:disabled:not(.is-selected) {
  cursor: not-allowed;
  opacity: .42;
}

.bt-manual-note {
  margin: 0;
}

@media (max-width: 900px) {
  .bt-manual-grid {
    grid-template-columns: repeat(9, 1fr);
  }
}

@media (max-width: 620px) {
  .bt-mode-head,
  .bt-manual-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .bt-mode-switch {
    width: 100%;
  }

  .bt-mode-switch label {
    flex: 1;
  }

  .bt-mode-switch span {
    width: 100%;
  }

  .bt-manual-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .bt-manual-actions {
    width: 100%;
  }

  .bt-manual-actions .btn {
    width: 100%;
  }
}
