*{
    box-sizing: border-box;
}

.container{
    text-align: center;
    margin: 0 auto;
    padding: 20px;
    display:flex;
    flex-flow: row wrap;
    gap: 20px;
    justify-content: center;
}

.cardDespesas, .cardReceitas{
    flex: 1;
    min-width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.cardDespesas{
    background-color: #fff;
}

.cardReceitas{
    background-color: #fff;
    text-align: left;
}

form {
  display: flex;
  flex-flow: row wrap;
  gap: 15px;
  width: 100%;
}

select, input {
  padding: 10px;
  border: 2px solid #4A47A3;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: 0.3s;
  width: calc(50% - 7.5px);
  flex: 1;
  min-height: 44px;
  box-sizing: border-box;
}

select:focus, input:focus {
  border-color: #FF6F61;
}

.total{
    display: flex;
    flex-flow:row wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.totalp{
    margin-left: 0;
    text-align: center;
}

.inputTotal, .inputRenda{
    flex:1;
    margin-left: 0;
    min-height: 44px;
}

#adicionar,.remover, #btnCancel {
  background: #FF6F61;
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
  min-height: 44px;
}

#adicionar:hover,#btnCancel:hover,.remover:hover {
  background: #ff3b2e;
}

.gastos-lista {
  margin-top: 25px;
  text-align: left;
  width: 100%;
}

.gasto-item {
  background: #f3f3f3;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 5px solid #4A47A3;
  flex-wrap: wrap;
  gap: 10px;
}

.gasto-item span {
  font-weight: bold;
  color: #333;
}

.edit, #btnSave, #salvarRenda, #adicionarLucro{
  background: #09cf1a;
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
  min-height: 40px;
}

.edit:hover, #btnSave:hover, #adicionarLucro:hover {
  background:greenyellow;
}

#salvarRenda{
    margin-left: 10px;
}

.edit{
  display:none;
}

.gastos-modal{
    display:none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    background:#968a8ad2;
    padding:20px;
    border-radius:8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.9);
    z-index: 999;
    max-height: 90vh;
    overflow-y: auto;
}

#edt-nome, #edt-valor, #edt-tipo{
    background:#968a8a68;
    width: 100%;
    min-height: 40px;
}

/* Mobile: até 480px */
@media (max-width: 480px) {
  .container {
    margin: 0;
    padding: 10px;
    gap: 15px;
  }

  .cardDespesas, .cardReceitas {
    min-width: 100%;
    max-width: 100%;
    padding: 15px;
  }

  select, input {
    width: 100% !important;
    flex: 100%;
  }

  form {
    gap: 10px;
  }

  .total {
    flex-direction: column;
  }

  .inputTotal, .inputRenda {
    width: 100%;
  }

  #adicionar, .remover, #btnCancel,
  .edit, #btnSave, #salvarRenda, #adicionarLucro {
    width: 100%;
    padding: 10px;
  }

  .gasto-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .gastos-modal {
    width: 95%;
    padding: 15px;
  }
}

/* Tablet: 481px até 768px */
@media (min-width: 481px) and (max-width: 768px) {
  .container {
    flex-direction: column;
    padding: 15px;
  }

  .cardDespesas, .cardReceitas {
    min-width: 100%;
    max-width: 100%;
  }

  select, input {
    width: calc(50% - 7.5px);
  }

  .gastos-modal {
    width: 90%;
    max-width: 100%;
  }

  .gasto-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Desktop: 769px e acima */
@media (min-width: 769px) {
  .container {
    max-width: 1200px;
    margin: 0 auto;
  }

  .cardDespesas, .cardReceitas {
    min-width: 45%;
    max-width: 500px;
  }

  select, input {
    width: calc(50% - 7.5px);
  }

  .gastos-modal {
    max-width: 500px;
  }
}
    .gasto-item {
  padding: 10px;
  margin: 5px 0;
  border-left: 5px solid transparent; /* padrão */
}

.gasto-item.despesa {
  border-left-color: red;
}

.gasto-item.receita {
  border-left-color: green;
}
