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

html {
  font-size: 10px;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1.6rem;
  line-height: 1.5;
  color: #1a2b4a;
  background-color: #e8f0fe;
  min-height: 100vh;
}

.app {
  max-width: 88rem;
  margin: 0 auto;
  padding: 2rem 1.6rem 4rem;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
  margin-bottom: 2.4rem;
}

.header__title {
  font-size: 2.4rem;
  font-weight: 700;
  color: #1565c0;
}

.lang-switch {
  display: flex;
  gap: 0.4rem;
  background-color: #ffffff;
  border-radius: 0.8rem;
  padding: 0.4rem;
  box-shadow: 0 0.2rem 0.8rem rgba(21, 101, 192, 0.12);
}

.lang-switch__btn {
  font-size: 1.4rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 0.6rem;
  background-color: transparent;
  color: #1565c0;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.lang-switch__btn:hover {
  background-color: #e3f2fd;
}

.lang-switch__btn:focus-visible {
  outline: 0.2rem solid #1565c0;
  outline-offset: 0.2rem;
}

.lang-switch__btn--active {
  background-color: #1565c0;
  color: #ffffff;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.main__top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: stretch;
}

.card--form,
.card--summary {
  display: flex;
  flex-direction: column;
}

.card--summary .summary {
  grid-template-columns: 1fr 1fr;
  flex-grow: 1;
}

.card--summary .summary__value {
  font-size: 1.8rem;
}

.card {
  background-color: #ffffff;
  border-radius: 1.2rem;
  padding: 2.4rem;
  box-shadow: 0 0.4rem 1.6rem rgba(21, 101, 192, 0.1);
}

.card__title {
  font-size: 1.8rem;
  font-weight: 600;
  color: #1565c0;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 0.2rem solid #e3f2fd;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.8rem;
}

.card__subtitle {
  font-size: 1.4rem;
  font-weight: 500;
  color: #546e7a;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.form__group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.form__fieldset {
  border: none;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.form__label {
  font-size: 1.4rem;
  font-weight: 600;
  color: #1a2b4a;
}

.form__radios {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.form__radio-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.4rem;
  color: #1a2b4a;
  cursor: pointer;
  padding: 0.8rem 1.2rem;
  border: 0.2rem solid #bbdefb;
  border-radius: 0.8rem;
  background-color: #fafcff;
  transition: border-color 0.2s, background-color 0.2s;
}

.form__radio-label:has(.form__radio:checked) {
  border-color: #1565c0;
  background-color: #e3f2fd;
}

.form__radio {
  accent-color: #1565c0;
}

.form__input {
  font-size: 1.6rem;
  padding: 1rem 1.2rem;
  border: 0.2rem solid #bbdefb;
  border-radius: 0.8rem;
  background-color: #fafcff;
  color: #1a2b4a;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form__input:focus {
  outline: none;
  border-color: #1565c0;
  box-shadow: 0 0 0 0.3rem rgba(21, 101, 192, 0.2);
}

.form__input--error {
  border-color: #c62828;
  background-color: #fff5f5;
}

.form__error {
  font-size: 1.3rem;
  color: #c62828;
  min-height: 1.8rem;
}

.btn {
  font-size: 1.5rem;
  font-weight: 600;
  padding: 1rem 2rem;
  border: none;
  border-radius: 0.8rem;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.btn:focus-visible {
  outline: 0.2rem solid #1565c0;
  outline-offset: 0.2rem;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background-color: #1565c0;
  color: #ffffff;
}

.btn--primary:hover {
  background-color: #0d47a1;
}

.btn--secondary {
  background-color: #e3f2fd;
  color: #1565c0;
}

.btn--secondary:hover {
  background-color: #bbdefb;
}

.btn--danger {
  background-color: #c62828;
  color: #ffffff;
}

.btn--danger:hover {
  background-color: #b71c1c;
}

.btn--small {
  font-size: 1.3rem;
  padding: 0.6rem 1.2rem;
}

.movements-empty {
  font-size: 1.4rem;
  color: #546e7a;
  text-align: center;
  padding: 2rem 1rem;
  background-color: #f5f9ff;
  border-radius: 0.8rem;
  border: 0.2rem dashed #bbdefb;
}

.movements-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.movement {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  grid-template-areas: "type desc amount delete";
  align-items: center;
  gap: 1.2rem;
  padding: 1.2rem 1.6rem;
  border-radius: 0.8rem;
  background-color: #f5f9ff;
  border-left: 0.4rem solid #1565c0;
}

.movement__type {
  grid-area: type;
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.8rem;
  border-radius: 0.4rem;
  white-space: nowrap;
}

.movement__desc {
  grid-area: desc;
  font-size: 1.5rem;
  font-weight: 500;
  color: #1a2b4a;
  word-break: break-word;
  min-width: 0;
}

.movement__amount {
  grid-area: amount;
  font-size: 1.6rem;
  font-weight: 700;
  white-space: nowrap;
  justify-self: end;
}

.movement__delete {
  grid-area: delete;
  justify-self: end;
}

.movement--income {
  border-left-color: #2e7d32;
}

.movement--expense {
  border-left-color: #c62828;
}

.movement--income .movement__type {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.movement--expense .movement__type {
  background-color: #ffebee;
  color: #c62828;
}

.movement--income .movement__amount {
  color: #2e7d32;
}

.movement--expense .movement__amount {
  color: #c62828;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.6rem;
  margin-bottom: 2rem;
}

.summary__item {
  background-color: #f5f9ff;
  border-radius: 0.8rem;
  padding: 1.6rem;
  text-align: center;
}

.summary__item--income {
  background-color: #e8f5e9;
}

.summary__item--expense {
  background-color: #ffebee;
}

.summary__label {
  font-size: 1.3rem;
  font-weight: 600;
  color: #546e7a;
  margin-bottom: 0.8rem;
}

.summary__value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: #1565c0;
}

.summary__value.positive {
  color: #2e7d32;
}

.summary__value.negative {
  color: #c62828;
}

.feedback {
  font-size: 1.4rem;
  padding: 1rem 1.2rem;
  border-radius: 0.8rem;
  margin-bottom: 1.6rem;
}

.feedback--success {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.feedback--info {
  background-color: #e3f2fd;
  color: #1565c0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.6rem;
}

.modal[hidden] {
  display: none;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(26, 43, 74, 0.5);
}

.modal__dialog {
  position: relative;
  background-color: #ffffff;
  border-radius: 1.2rem;
  padding: 2.4rem;
  max-width: 44rem;
  width: 100%;
  box-shadow: 0 0.8rem 3.2rem rgba(21, 101, 192, 0.2);
}

.modal__title {
  font-size: 2rem;
  font-weight: 700;
  color: #1565c0;
  margin-bottom: 1.2rem;
}

.modal__text {
  font-size: 1.5rem;
  color: #546e7a;
  margin-bottom: 2rem;
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .card--summary .summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .main__top {
    grid-template-columns: 1fr;
  }

  .header__title {
    font-size: 2rem;
  }

  .card--summary .summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .movement {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "type amount"
      "desc desc"
      "delete delete";
    gap: 1rem;
    padding: 1.4rem;
  }

  .movement__type {
    align-self: center;
  }

  .movement__amount {
    font-size: 1.5rem;
    align-self: center;
  }

  .movement__desc {
    padding-top: 0.8rem;
    border-top: 0.1rem solid #dbeafe;
  }

  .movement__delete {
    width: 100%;
    justify-self: stretch;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .card--summary .summary {
    grid-template-columns: 1fr;
  }

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

  .modal__actions {
    flex-direction: column;
  }

  .modal__actions .btn {
    width: 100%;
  }
}
