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

:root {
  font-family: "Open Sans", sans-serif;
  font-size: 16px;
}

::-webkit-scrollbar {
  width: 0.5rem;
}

::-webkit-scrollbar-track {
  background-color: transparent;
}

::-webkit-scrollbar-thumb {
  background: #e4ece9;
}

body {
  width: 100%;
  height: 100vh;

  background-color: #e4ece9;

  display: flex;
  flex-direction: column;
  align-items: center;

  color: #1f2523;
}

body.dark-mode {
  background-color: #181c1f;
  color: #f1f1f1;
}
body.dark-mode .logo {
  filter: brightness(0.85);
}
body.dark-mode form,
body.dark-mode aside,
body.dark-mode #historico-categorias {
  background: #23272b !important;
  color: #f1f1f1;
  box-shadow: 0 2px 16px #0006;
}
body.dark-mode .fa-solid,
body.dark-mode .fa-regular,
body.dark-mode .fa-light,
body.dark-mode .fa-duotone {
  color: #4be09b !important;
}
body.dark-mode .expense-info strong,
body.dark-mode .expense-info span,
body.dark-mode .expense-amount {
  color: #e6ffe6 !important;
}
body.dark-mode .expense-date {
  color: #b2e0c2 !important;
}
body.dark-mode aside header,
body.dark-mode aside header p,
body.dark-mode aside header h2,
body.dark-mode aside header small {
  color: #e6ffe6 !important;
}
body.dark-mode aside header p i {
  color: #4be09b !important;
}
body.dark-mode aside header {
  border-bottom-color: #2d3a4a !important;
}
body.dark-mode .expense-amount small {
  color: #b2e0c2 !important;
}
body.dark-mode .remove-icon {
  filter: invert(0.7) brightness(1.5);
}
body.dark-mode input,
body.dark-mode select {
  background: #23272b;
  color: #e6ffe6;
  border-color: #444;
}
body.dark-mode input::placeholder,
body.dark-mode select:invalid {
  color: #b2e0c2;
}
body.dark-mode form button,
body.dark-mode .painel-btn {
  background: #1f8459;
  color: #fff;
  border: 1.5px solid #1f8459;
}
body.dark-mode form button:hover,
body.dark-mode .painel-btn:hover {
  background: #176c48;
  color: #fff;
  border-color: #176c48;
}
body.dark-mode #historico-categorias h3 {
  color: #4be09b !important;
  text-shadow: 0 1px 8px #000a;
}
body.dark-mode #historico-categorias {
  box-shadow: 0 4px 32px #000a !important;
}
body.dark-mode .toast {
  background: #23272b;
  color: #e6ffe6;
  box-shadow: 0 2px 16px #000a;
}
body.dark-mode .toast.toast-erro {
  color: #ff7b6b;
  border-left-color: #ff7b6b;
}
body.dark-mode .toast.toast-sucesso {
  color: #7bffb0;
  border-left-color: #7bffb0;
}
body.dark-mode .toast.toast-info {
  color: #7bbcff;
  border-left-color: #7bbcff;
}
body.dark-mode #historico-categorias span,
body.dark-mode #historico-categorias div > span {
  color: #e6ffe6 !important;
}

.logo {
  margin: 3rem 0 2rem;
}

main section {
  display: flex;
  flex: 1;
  gap: 1.25rem;
  padding-bottom: 2rem;
}

form {
  background-color: #f9fbfa;
  border-radius: 1rem;
  padding: 2.5rem;
  max-width: 462px;

  display: flex;
  flex-direction: column;
}

form h1 {
  font-size: 1.25rem;
}

form p {
  font-size: 0.87rem;
  color: #4d5c57;
  margin: 0.75rem 0 2.5rem;
}

fieldset {
  border: none;
  display: flex;
}

fieldset legend {
  text-transform: uppercase;
  font-size: 0.62rem;
  color: #4d5c57;
  margin-bottom: 0.5rem;
}

fieldset:focus-within legend {
  color: #1f8459;
  font-weight: 700;
}

input,
select {
  flex: 1;
  height: 3rem;
  border-radius: 0.5rem;
  border: 1px solid #cdd5d2;
  padding: 0 1rem;
  font-size: 0.87rem;
  color: #1f2523;
  background-color: transparent;
  outline: none;
}

select {
  appearance: none;
  background-image: url(img/chevron-down.svg);
  background-repeat: no-repeat;
  background-position: right 0.7rem top 50%;
  background-size: 1.25rem auto;
}

input::placeholder,
select:invalid {
  color: #4d5c57;
}

input:focus,
select:focus {
  border: 1.5px solid #1f8459;
}

.inputs-row {
  display: flex;
  flex: 1;

  gap: 1rem;
  margin-top: 1rem;
}

.inputs-row fieldset:first-child {
  flex: 1;
}

.inputs-row fieldset:last-child input {
  max-width: 154px;
}

form button {
  height: 3rem;
  border-radius: 0.5rem;
  border: none;
  font-size: 0.87rem;
  color: #ffffff;
  background-color: #1f8459;
  font-weight: 700;
  padding: 1rem 1.25rem;
  cursor: pointer;

  transition: background-color 0.2s;
}

button:hover {
  background-color: #2cb178;
}

form button:last-child {
  margin-top: 2rem;
}

aside {
  background-color: #f9fbfa;
  border-radius: 1rem;
  padding: 2.5rem;
  max-width: 462px;

  min-width: 600px;
}

aside header {
  display: flex;
  justify-content: space-between;

  border-bottom-width: 1px;
  border-bottom-style: solid;
  border-bottom-color: #e4ece9;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}
aside header p {
  color: #4d5c57;
  font-weight: 400;
  font-size: 1rem;
}

aside header p span {
  color: #4d5c57;
  font-weight: 400;
  font-size: 0.87rem;
}

aside header p i {
  color: #cdd5d2;
  margin: 0 0.5rem;
  font-style: normal;
}

aside header h2 {
  font-size: 1rem;
  color: #1f2523;
}

aside header small {
  color: #4d5c57;
  font-weight: 400;
  font-size: 0.75rem;
  margin-right: 0.25rem;
}

aside ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;

  max-height: 310px;
  min-height: 310px;

  overflow-y: scroll;
}

.expense {
  display: flex;
  align-items: center;
  height: 38px;
}

.expense img:first-child {
  width: 2rem;
  height: 2rem;

  margin-right: 0.75rem;
}

.expense > div {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.expense-info strong {
  font-size: 0.87rem;
  color: #1f2523;
}

.expense-info span {
  font-size: 0.75rem;
  color: #4d5c57;
}

.expense-amount {
  font-size: 0.87rem;
  color: #1f2523;
  font-weight: 600;
}

.expense-amount small {
  font-size: 0.75rem;
  color: #4d5c57;
  font-weight: 400;
  margin-right: 0.25rem;
}

.remove-icon {
  height: 1rem;
  margin-left: 0.5rem;

  cursor: pointer;
  transition: opacity 0.2s;
}

.remove-icon:hover {
  opacity: 0.7;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px 0;
  width: 100%;
  font-size: 1rem;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  margin: 12px 0 8px 0;
  transition: box-shadow 0.2s, border-color 0.2s;
  box-shadow: 0 1px 4px #0001;
}
.google-btn img {
  height: 22px;
  width: 22px;
}
.google-btn:hover {
  box-shadow: 0 2px 8px #0002;
  border-color: #bbb;
}

.toast {
  min-width: 220px;
  max-width: 90vw;
  background: #fff;
  color: #1f2523;
  border-radius: 8px;
  box-shadow: 0 2px 16px #0002;
  padding: 16px 28px;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 6px solid #1f8459;
  animation: toastIn 0.3s;
}
.toast.toast-erro {
  border-left-color: #e4572e;
  color: #e4572e;
}
.toast.toast-sucesso {
  border-left-color: #1f8459;
  color: #1f8459;
}
.toast.toast-info {
  border-left-color: #2d8cff;
  color: #2d8cff;
}
@keyframes toastIn {
  from { opacity:0; transform:translateY(30px); }
  to   { opacity:1; transform:translateY(0); }
}

#filtros-despesas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}
#filtros-despesas input[type="date"],
#filtros-despesas input[type="text"] {
  border-radius: 0.5rem;
  border: 1.5px solid #cdd5d2;
  background: #f9fbfa;
  color: #1f2523;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  transition: border 0.2s, box-shadow 0.2s;
  outline: none;
  margin-bottom: 0;
  box-shadow: 0 1px 4px rgba(31, 132, 89, 0.06);
  min-width: 170px;
  max-width: 220px;
  width: 100%;
}
#filtros-despesas input[type="date"]:focus,
#filtros-despesas input[type="text"]:focus {
  border: 1.5px solid #1f8459;
  box-shadow: 0 2px 8px rgba(31, 132, 89, 0.13);
}
#filtros-despesas input[type="text"]::placeholder {
  color: #4d5c57;
  opacity: 1;
}
#filtros-despesas button {
  height: 2.4rem;
  border-radius: 0.5rem;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  padding: 0 1.25rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 0;
  margin-right: 0.5rem;
  box-shadow: 0 1px 4px rgba(31, 132, 89, 0.06);
}
#btn-filtrar {
  background: #1f8459;
  color: #fff;
}
#btn-filtrar:hover {
  background: #2cb178;
}
#btn-limpar-filtro {
  background: #e4572e;
  color: #fff;
}
#btn-limpar-filtro:hover {
  background: #ff7b6b;
}
body.dark-mode #filtros-despesas input[type="date"],
body.dark-mode #filtros-despesas input[type="text"] {
  background: #23272b;
  color: #e6ffe6;
  border-color: #444;
  box-shadow: 0 1px 4px rgba(44, 177, 120, 0.10);
}
body.dark-mode #filtros-despesas input[type="text"]::placeholder {
  color: #b2e0c2;
}
@media (max-width: 700px) {
  #filtros-despesas {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
  }
  #filtros-despesas button {
    margin-right: 0;
    width: 100%;
  }
}

@media (min-width: 1100px) {
  form {
    max-height: 428px;
  }
}

@media (max-width: 1100px) {
  :root {
    font-size: 14px;
  }

  main,
  aside {
    min-width: 100%;
  }

  main section {
    flex-direction: column;
    width: 100%;

    padding: 1.5rem;
  }

  main section form {
    min-width: 100%;
  }

  main section aside ul {
    width: 100%;
    height: auto;
    overflow: auto;
  }
}

@media (max-width: 900px) {
  main section {
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 1rem;
  }
  form, aside {
    max-width: 98vw;
    min-width: unset;
    padding: 1.2rem 0.7rem;
  }
  #historico-categorias {
    width: 99vw !important;
    padding: 18px 4vw 18px 4vw !important;
  }
  #grafico-categorias {
    max-width: 98vw !important;
    width: 98vw !important;
    height: 220px !important;
  }
}
@media (max-width: 600px) {
  .logo {
    margin: 1.2rem 0 1.2rem;
    width: 120px;
  }
  main section {
    padding-bottom: 0.5rem;
  }
  form, aside {
    padding: 0.7rem 0.2rem;
    border-radius: 0.7rem;
  }
  form h1 {
    font-size: 1.05rem;
  }
  .inputs-row {
    flex-direction: column;
    gap: 0.5rem;
  }
  .expense {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding-bottom: 6px;
  }
  .expense-amount, .expense-date {
    margin-left: 0;
    margin-top: 2px;
    font-size: 0.93rem;
  }
  #historico-categorias {
    padding: 10px 2vw 10px 2vw !important;
    font-size: 0.98rem;
  }
  #grafico-categorias {
    height: 160px !important;
  }
  .toast {
    min-width: 140px;
    font-size: 0.93rem;
    padding: 10px 14px;
  }
}

@media (max-width: 620px) {
  .inputs-row {
    flex-direction: column;
  }

  .inputs-row fieldset:last-child input {
    max-width: auto;
    min-width: 100%;
  }

  aside header {
    flex-direction: column;
    align-items: center;
  }
}
