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

html, body {
  width: 100%;
  height: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  background: #08080c;
  color: #ededf5;
  scroll-behavior: smooth;
}

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

@media (max-width: 640px) {
  .container {
    padding: 1rem;
  }
}

h1 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #f59e0b;
}

.pergunta {
  font-size: 0.95rem;
  color: #9a9ab0;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #ededf5;
  border-bottom: 2px solid rgba(245, 158, 11, 0.2);
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #ededf5;
}

.painel-principal {
  background: #101018;
  border: 1px solid #26263a;
  border-radius: 12px;
  padding: 2rem;
}

@media (max-width: 640px) {
  .painel-principal {
    padding: 1.25rem;
  }
}

/* CONTROLES */
.secao-controles {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(245, 158, 11, 0.05);
  border-radius: 8px;
  border-left: 3px solid #f59e0b;
}

.grid-controles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.controle {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.controle label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #ededf5;
}

.input-grupo {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.controle input[type="range"] {
  flex: 1;
  cursor: pointer;
  accent-color: #f59e0b;
}

.controle input[type="range"]:focus {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

.valor-controle {
  font-size: 0.8rem;
  color: #9a9ab0;
  font-family: 'Cascadia Code', Consolas, monospace;
  min-width: 3rem;
  text-align: right;
}

.botao-secundario {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid #f59e0b;
  color: #f59e0b;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  align-self: flex-start;
}

.botao-secundario:hover {
  background: rgba(245, 158, 11, 0.25);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.botao-secundario:active {
  transform: translateY(1px);
}

.botao-secundario:focus {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* TABELA DE INSTÂNCIAS */
.secao-instancias {
  margin-bottom: 2rem;
}

.tabela-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #26263a;
}

.tabela-precos {
  width: 100%;
  border-collapse: collapse;
  background: #1a1a26;
}

.tabela-precos thead {
  background: rgba(245, 158, 11, 0.1);
  border-bottom: 2px solid #26263a;
}

.tabela-precos th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  color: #f59e0b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tabela-precos td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(38, 38, 58, 0.5);
  font-size: 0.875rem;
}

.tabela-precos tbody tr:hover {
  background: rgba(245, 158, 11, 0.05);
}

.tabela-precos input {
  width: 100%;
  background: #101018;
  border: 1px solid #26263a;
  color: #ededf5;
  padding: 0.5rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.875rem;
}

.tabela-precos input:focus {
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
}

.mais-barato {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  font-weight: 600;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  text-align: center;
}

/* RESULTADO */
.secao-resultado {
  margin-bottom: 2rem;
}

.grid-resultados {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.card-resultado {
  padding: 1.25rem;
  background: #1a1a26;
  border: 1px solid #26263a;
  border-radius: 8px;
}

.card-resultado .instancia {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f59e0b;
  margin-bottom: 0.75rem;
}

.card-resultado .custos {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.custo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custo-label {
  font-size: 0.75rem;
  color: #9a9ab0;
}

.custo-valor {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ededf5;
  font-family: 'Cascadia Code', Consolas, monospace;
}

.custo-valor.melhor {
  color: #10b981;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

/* PONTO DE EQUILÍBRIO */
.painel-equilbrio {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(245, 158, 11, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.1);
}

.conteudo-equilibrio {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.metrica-destaque {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.metrica-destaque .rotulo {
  font-size: 0.875rem;
  color: #9a9ab0;
}

.metrica-destaque .valor {
  font-size: 2rem;
  font-weight: 700;
  color: #f59e0b;
  font-family: 'Cascadia Code', Consolas, monospace;
}

.metrica-destaque .subrotulo {
  font-size: 0.75rem;
  color: #9a9ab0;
}

.barra-utilizacao {
  position: relative;
  height: 40px;
  background: #101018;
  border: 1px solid #26263a;
  border-radius: 6px;
  overflow: hidden;
}

.barra-fundo {
  position: absolute;
  inset: 0;
  background: rgba(245, 158, 11, 0.1);
}

.barra-uso {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #ec4899);
  width: 0%;
  transition: width 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .barra-uso {
    transition: none;
  }
}

.marcador-equilibrio {
  position: absolute;
  top: 0;
  left: 0%;
  height: 100%;
  width: 2px;
  background: #f59e0b;
  transform: translateX(-50%);
}

.marcador-atual {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 3px;
  background: #10b981;
  transform: translateX(50%);
}

.legendas-barra {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #9a9ab0;
}

/* GPU OCIOSA */
.painel-ociosa {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(239, 68, 68, 0.05);
  border-radius: 8px;
  border-left: 3px solid #ef4444;
}

.painel-ociosa .descricao {
  font-size: 0.875rem;
  color: #9a9ab0;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.grid-ociosa {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.metrica-ociosa {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.rotulo-ociosa {
  font-size: 0.875rem;
  font-weight: 600;
  color: #ededf5;
}

.cifra-ociosa,
.cifra-liquida {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ef4444;
  font-family: 'Cascadia Code', Consolas, monospace;
}

.cifra-liquida.economia {
  color: #10b981;
}

.subrotulo-ociosa {
  font-size: 0.75rem;
  color: #9a9ab0;
}

/* ALAVANCAS */
.painel-alavancas {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(16, 185, 129, 0.05);
  border-radius: 8px;
  border-left: 3px solid #10b981;
}

.painel-alavancas .descricao {
  font-size: 0.875rem;
  color: #9a9ab0;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.grid-alavancas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.alavanca {
  padding: 1rem;
  background: #1a1a26;
  border: 1px solid #26263a;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.titulo-alavanca {
  font-size: 0.875rem;
  font-weight: 600;
  color: #ededf5;
}

.valor-alavanca {
  font-size: 1.5rem;
  font-weight: 700;
  color: #10b981;
  font-family: 'Cascadia Code', Consolas, monospace;
}

.descricao-pequena {
  font-size: 0.75rem;
  color: #9a9ab0;
}

/* LIÇÃO */
.bloco-licao {
  margin-top: 2rem;
  padding: 1.5rem;
  background: rgba(124, 58, 237, 0.05);
  border-radius: 8px;
  border-left: 3px solid #7c3aed;
}

.bloco-licao h3 {
  color: #7c3aed;
  margin-bottom: 0.75rem;
}

.bloco-licao p {
  font-size: 0.95rem;
  color: #9a9ab0;
  line-height: 1.6;
}

/* RESPONSIVIDADE */
@media (max-width: 640px) {
  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1rem;
  }

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

  .botao-secundario {
    width: 100%;
    align-self: stretch;
  }

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

  .tabela-precos th,
  .tabela-precos td {
    padding: 0.5rem;
    font-size: 0.75rem;
  }

  .metrica-destaque .valor {
    font-size: 1.5rem;
  }

  .barra-utilizacao {
    height: 30px;
  }

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

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

  .cifra-ociosa,
  .cifra-liquida {
    font-size: 1.5rem;
  }
}

/* PREFERS-REDUCED-MOTION */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* SCROLLBAR PERSONALIZADO */
.tabela-wrapper::-webkit-scrollbar {
  height: 8px;
}

.tabela-wrapper::-webkit-scrollbar-track {
  background: rgba(245, 158, 11, 0.05);
}

.tabela-wrapper::-webkit-scrollbar-thumb {
  background: #f59e0b;
  border-radius: 4px;
}

.tabela-wrapper::-webkit-scrollbar-thumb:hover {
  background: #d97706;
}

/* CONTRASTE E ACESSIBILIDADE */
@media (prefers-contrast: more) {
  .metrica-destaque .valor {
    text-shadow: 0 0 4px rgba(245, 158, 11, 0.5);
  }

  .valor-alavanca {
    text-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
  }
}

/* Resumo textual do resultado — anunciado por leitor de tela e útil para leitura rápida. */
.resumo-acessivel {
  margin: 0 0 1rem;
  padding: 0.7rem 0.95rem;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.08);
  color: #EDEDF5;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Rótulo de qual instância os painéis de análise estão usando. */
.instancia-ref {
  font-size: 0.8rem;
  font-weight: 500;
  color: #9A9AB0;
  margin-left: 0.35rem;
}
