*,
*::before,
*::after{
  box-sizing:border-box;
  margin:0;
  padding:0;
}

:root{
  --bg:#f5f0e8;
  --surface:#ffffff;
  --navy:#1a3a5c;
  --green:#2d9e61;
  --green-lt:#e6f7ee;
  --amber:#f5a623;
  --red:#e03e2d;
  --red-lt:#fdecea;
  --text:#1a1410;
  --muted:#6b5e52;
  --border:#d9cfbf;
  --shadow:0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:0 8px 32px rgba(0,0,0,.12);
  --radius:12px;
  --radius-sm:8px;
}

body{
  font-family:'IBM Plex Sans',sans-serif;
  background:var(--bg);
  color:var(--text);
  min-height:100vh;
}

.page{
  max-width:1120px;
  margin:auto;
  padding:32px 24px 60px;
}

.masthead{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  border-bottom:2px solid var(--border);
  padding-bottom:20px;
  margin-bottom:28px;
  gap:12px;
  flex-wrap:wrap;
}

.brand-name{
  font-family:'Playfair Display',serif;
  font-size:2.2rem;
  font-weight:900;
}

.brand-name span{
  color:var(--green);
}

.brand-sub{
  font-size:.8rem;
  color:var(--muted);
  margin-top:4px;
  font-family:'IBM Plex Mono',monospace;
}

.month-badge{
  background:var(--navy);
  color:#fff;
  padding:6px 14px;
  border-radius:30px;
  font-size:.8rem;
  font-family:'IBM Plex Mono',monospace;
}

.income-setup{
  background:linear-gradient(135deg,var(--navy),#0f2744);
  color:#fff;
  padding:28px;
  border-radius:var(--radius);
  margin-bottom:24px;
  box-shadow:var(--shadow-lg);
}

.income-setup h2{
  margin-bottom:4px;
  font-family:'Playfair Display',serif;
}

.income-setup p{
  opacity:.8;
  margin-bottom:16px;
  font-size:.9rem;
}

.income-input-group{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}

.pkr-wrap{
  display:flex;
  align-items:center;
  flex:1;
  background:rgba(255,255,255,.15);
  border:1px solid rgba(255,255,255,.2);
  border-radius:var(--radius-sm);
  overflow:hidden;
}

.pkr-sym{
  padding:0 12px;
}

.income-field{
  height:46px;
  width:100%;
  border:none;
  outline:none;
  background:transparent;
  color:white;
  padding:0 12px;
  font-size:1rem;
}

.btn-set-income{
  height:46px;
  border:none;
  padding:0 22px;
  background:var(--green);
  color:white;
  border-radius:var(--radius-sm);
  cursor:pointer;
  font-weight:600;
}

.summary-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin-bottom:20px;
}

.sum-card{
  background:white;
  padding:18px 16px;
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  border-top:4px solid transparent;
}

.sum-card.income{
  border-top-color:var(--navy);
}

.sum-card.expense{
  border-top-color:var(--red);
}

.sum-card.balance{
  border-top-color:var(--green);
}

.sum-card.usage{
  border-top-color:var(--amber);
}

.sum-label{
  font-size:.72rem;
  color:var(--muted);
  margin-bottom:8px;
  text-transform:uppercase;
}

.sum-value{
  font-family:'IBM Plex Mono',monospace;
  font-size:1.3rem;
}

.warning-box{
  display:none;
  gap:10px;
  align-items:center;
  padding:12px 16px;
  background:var(--red-lt);
  border-left:4px solid var(--red);
  border-radius:var(--radius-sm);
  margin-bottom:16px;
}

.warning-box.show{
  display:flex;
}

.progress-wrap{
  background:white;
  padding:18px 20px;
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  margin-bottom:24px;
}

.progress-header{
  display:flex;
  justify-content:space-between;
  margin-bottom:12px;
  font-size:.85rem;
}

.progress-track{
  background:#e8e0d4;
  height:14px;
  border-radius:20px;
  overflow:hidden;
}

.progress-fill{
  width:0%;
  height:100%;
  background:var(--green);
  transition:.4s;
}

.progress-fill.warn{
  background:var(--amber);
}

.progress-fill.danger{
  background:var(--red);
}

.main-body{
  display:grid;
  grid-template-columns:340px 1fr;
  gap:24px;
}

.form-card,
.list-card{
  background:white;
  padding:24px;
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

.form-card h2,
.list-card h2{
  margin-bottom:18px;
  font-family:'Playfair Display',serif;
  color:var(--navy);
}

.form-input,
.form-select{
  width:100%;
  height:46px;
  padding:0 14px;
  margin-bottom:12px;
  border:1.5px solid var(--border);
  border-radius:var(--radius-sm);
  outline:none;
}

.btn-add{
  width:100%;
  height:46px;
  border:none;
  border-radius:var(--radius-sm);
  background:var(--navy);
  color:white;
  cursor:pointer;
  font-weight:600;
}

.btn-add.editing-mode{
  background:var(--green);
}

.list-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:16px;
}

.btn-clear{
  padding:8px 16px;
  border:none;
  border-radius:var(--radius-sm);
  background:var(--red-lt);
  color:var(--red);
  cursor:pointer;
}

.exp-item{
  display:grid;
  grid-template-columns:1fr auto auto;
  gap:12px;
  align-items:center;
  padding:14px 0;
  border-bottom:1px solid #ede8e0;
}

.exp-desc{
  font-weight:600;
}

.exp-meta{
  font-size:.75rem;
  color:var(--muted);
  margin-top:4px;
}

.exp-cat-badge{
  background:#eee8de;
  padding:2px 9px;
  border-radius:30px;
  margin-right:4px;
}

.exp-amount{
  font-family:'IBM Plex Mono',monospace;
}

.action-btns{
  display:flex;
  gap:6px;
}

.edit-btn,
.delete-btn{
  border:none;
  padding:7px 12px;
  border-radius:var(--radius-sm);
  cursor:pointer;
}

.edit-btn{
  background:#e8f0fb;
  color:var(--navy);
}

.delete-btn{
  background:var(--red-lt);
  color:var(--red);
}

.toast{
  position:fixed;
  bottom:28px;
  left:50%;
  transform:translateX(-50%);
  background:var(--navy);
  color:white;
  padding:12px 24px;
  border-radius:30px;
  opacity:0;
  transition:.3s;
}

.toast.show{
  opacity:1;
}

.edit-indicator{
  display:none;
  align-items:center;
  gap:8px;
  padding:10px 14px;
  background:var(--green-lt);
  border-radius:var(--radius-sm);
  margin-bottom:14px;
}

.edit-indicator.show{
  display:flex;
}

.cancel-edit-btn{
  margin-left:auto;
  border:none;
  background:none;
  cursor:pointer;
}

.empty-state{
  text-align:center;
  padding:48px 20px;
  color:var(--muted);
}

.app-footer{
  margin-top:48px;
  text-align:center;
  padding:20px;
  border-top:1px solid var(--border);
}

.footer-dev{
  margin-top:6px;
}

.footer-dev a{
  text-decoration:none;
  color:var(--navy);
}

@media(max-width:900px){

  .summary-grid{
    grid-template-columns:repeat(2,1fr);
  }

  .main-body{
    grid-template-columns:1fr;
  }

}

@media(max-width:600px){

  .summary-grid{
    grid-template-columns:1fr 1fr;
  }

  .exp-item{
    grid-template-columns:1fr auto;
  }

  .action-btns{
    grid-column:1/-1;
    justify-content:flex-end;
  }

}