* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  display: flex;
  background: #f9f9f9;
  color: #333;
}

.side-nav {
  background: linear-gradient(133deg, #657eea, #774ba2);
  width: 240px;
  min-height: 100vh;
  padding: 20px;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
}

.brand-logo {
  color: #fff;
  font-size: 1.4rem;
  font-weight: bold;
  margin-bottom: 20px;
  text-align: center;
}

.menu {
  list-style: none;
  padding: 0;
}

.menu li {
  margin: 8px 0;
}

.menu a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 10px 12px;
  display: block;
  border-radius: 6px;
  transition: all 0.25s;
}

.menu a.active,
.menu a:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.main-area {
  flex: 1;
  padding: 18px;
}

.top-header {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.05);
}

#bal-display {
  margin: 0;
  font-size: 1.6rem;
  color: #2d3748;
}

.profile-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pfp {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid #657eea;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  border-left: 4px solid transparent;
}

.card small {
  color: #666;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.card p {
  font-size: 1.3rem;
  font-weight: bold;
  margin: 6px 0 0;
}

.card.income {
  border-left-color: #48bb78;
}
.card.expense {
  border-left-color: #f56565;
}
.card.save {
  border-left-color: #ed8936;
}
.card.fav-cat {
  border-left-color: #9f7aea;
}

.income p {
  color: #48bb78;
}

.expense p {
  color: #e53e3e;
}

.save p {
  color: #ed8936;
}

.fav-cat p {
  color: #9f7aea;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.table-box {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 26px;
}

table {
  width: 100%;
  border-collapse: collapse;
}
thead {
  background: #f7fafc;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  font-size: 0.9rem;
}

.expense-tag {
  color: #e53e3e;
  font-weight: bold;
}
.income-tag {
  color: #38a169;
  font-weight: bold;
}

.cat-breakdown {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
}

.bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.bar-wrap {
  flex: 1;
  height: 10px;
  background: #e2e8f0;
  margin-left: 14px;
  border-radius: 5px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  transition: width 0.4s ease;
}

.redish {
  background: linear-gradient(90deg, #f56565, #e53e3e);
}
.orangeish {
  background: linear-gradient(90deg, #ed8936, #dd6b20);
}
.greenish {
  background: linear-gradient(90deg, #48bb78, #38a169);
}

/* Small screen tweaks */
@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  .side-nav {
    width: 100%;
    min-height: auto;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .stats {
    grid-template-columns: 1fr;
  }
  .top-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}
