* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.budget-page {
  width: 100%;
  padding: 0px 10px 10px;
}

.budget-page-grid {
  width: min(100%, 900px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.budget-left-col,
.budget-right-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.intro-box,
.add-box,
.privacy-box,
.result-box,
.items-box,
.cta-box {
  width: 100%;
}

.cta-box{
  margin-top: 20px;
}

.top-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  flex-direction: row;
  justify-content: space-around;
}

.logo {
  display: block;
  width: 170px;
  max-width: 52%;
  height: auto;
  cursor: pointer;
}

.top-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.language-switch {
  display: flex;
  gap: 5px;
}

.language-button,
.theme-button {
  width: auto;
}

.theme-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  text-align-last: center;
}

h2 {
  margin-bottom: 16px;
}

h3 {
  margin-bottom: 7px;
}

.header-box{
    margin-bottom: 20px;
}

.lead,
.cta-box p {
  margin-bottom: 0;
  line-height: 1.55;
  text-align: center;
}

.intro-box .lead {
  margin-bottom: 19px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 13px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  font-weight: 600;
}

.item-type-amount-row{
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
}

.input-item-amount{
  font-size: 25px;
  font-weight: 700;
}

.item-type-switch{
  display: flex;
  flex-direction: column;
  align-items: stretch;
}


.amount-currency-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
}

.amount-currency-row .default-input-bold,
.amount-currency-row .default-select,
.form-group .default-input {
  width: 100%;
  min-width: 0;
}

.full-button {
  width: 100%;
  margin-top: 2px;
}

.form-alert {
  display: none;
  margin-top: 11px;
  margin-bottom: 0;
}

.form-alert.show {
  display: block;
}

.privacy-box .default-success-text {
  margin-bottom: 0;
}

.budget-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.budget-kpi,
.remaining-card {
  margin: 10px 0px 0px 0;
  padding: 15px;
  text-align: center;
}

.kpi-label,
.remaining-label {
  margin-bottom: 5px;
  font-size: 0.82rem;
  font-weight: 600;
}

.kpi-value {
  font-size: 1.16rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.remaining-value {
  font-size: clamp(1.65rem, 4vw, 2.15rem);
  line-height: 1.05;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.remaining-note {
  margin-top: 12px;
  margin-bottom: 0;
}

.budget-progress-wrap {
  margin-top: 16px;
}

.progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.section-subtitle {
  font-size: 0.78rem;
}

.clear-button {
  display: none;
  flex: 0 0 auto;
  width: auto;
}

.empty-state {
  min-height: 130px;
  margin: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
}

.empty-state strong {
  font-size: 0.92rem;
}

.empty-state span {
  font-size: 0.8rem;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0px;
}

.budget-item {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.budget-item-main {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0px 20px;
}

.budget-item-name {
  min-width: 0;
  font-size: 0.91rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.budget-item-amount {
  flex: 0 0 auto;
  font-size: 0.91rem;
  font-weight: 700;
  white-space: nowrap;
}

.remove-item {
  flex: 0 0 auto;
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
}

.cta-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-direction: column;
}

.cta-content > div {
  min-width: 0;
}

.cta-box h2 {
  margin-bottom: 7px;
}

.cta-button {
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
  height: 50px;
  font-size: 20px;
}

@media (max-width: 820px) {

  .budget-page {
    padding: 22px 14px 35px;
  }

  .budget-page-grid {
    grid-template-columns: minmax(0, 1fr);
    max-width: 520px;
  }

  .budget-left-col,
  .budget-right-col {
    gap: 14px;
  }

  .cta-content {
    align-items: stretch;
    flex-direction: column;
    gap: 15px;
  }

  .cta-button {
    width: 100%;
  }

}

@media (max-width: 500px) {

  .budget-page {
    padding: 14px 10px 28px;
  }

  .top-row {
    align-items: flex-start;
    margin-bottom: 15px;
  }

  .logo {
    width: 145px;
  }

  .top-controls {
    flex-direction: column;
    align-items: flex-end;
  }

  .theme-button {
    width: 100%;
  }

  .budget-kpi-grid {
    grid-template-columns: 1fr;
  }

  .budget-item-main {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .budget-item-amount {
    white-space: normal;
  }

}
