:root {
  --bg-grad: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
  --card: #ffffff;
  --muted: #8b96a5;
  --accent: #6c63ff;
  --income: #4caf50;
  --expense: #f44336;
  --savings: #2196f3;
  --glass: rgba(255, 255, 255, 0.6);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg-grad);
  min-height: 100vh;
  padding: 28px;
}
.wrap {
  max-width: 820px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(12, 20, 30, 0.12);
}
header.app-head {
  padding: 18px 18px;
  background: linear-gradient(
    90deg,
    rgba(108, 99, 255, 0.95),
    rgba(72, 153, 255, 0.95)
  );
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
header .title {
  font-weight: 700;
  font-size: 18px;
}
header .sub {
  font-size: 12px;
  opacity: 0.95;
}
.currency-select {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 6px 10px;
  border-radius: 8px;
  color: white;
}

.hero {
  padding: 18px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.02)
  );
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: center;
}
.balance-card {
  flex: 1;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%);
  padding: 14px;
  border-radius: 14px;
}
.balance-card small {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}
.balance-card h2 {
  margin: 0;
  font-size: 26px;
}

.alloc-card {
  /* CONTAINER STYLES */
  width: 280px; /* Slightly wider for better readability */
  padding: 18px;
  border-radius: 16px;
  background: #ffffff; /* Use a clean white background */
  color: #333333; /* Dark text for contrast */
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1); /* Soft, noticeable shadow */
  margin: 15px; /* Add margin for breathing room */
}

.alloc-title {
  /* TITLE STYLES */
  font-size: 1.1em;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.alloc-subtitle {
  /* SUBTITLE STYLES */
  font-size: 11px;
  color: #777777;
  margin-bottom: 20px; /* Space before the list of allocations */
  display: block;
}

.alloc-row {
  /* ROW STYLES */
  display: flex;
  justify-content: space-between; /* Pushes name and amount to the edges */
  align-items: center;
  margin-bottom: 12px; /* Spacing between rows */
  padding-bottom: 8px;
  border-bottom: 1px solid #eeeeee; /* Subtle separator */
}

.alloc-row:last-child {
  border-bottom: none; /* No border for the last item */
  margin-bottom: 0;
}

.alloc-row span:first-child {
  /* CATEGORY NAME (Needs, Wants, Savings) */
  font-size: 14px;
  font-weight: 500;
}

.alloc-row span:last-child {
  /* AMOUNT (e.g., ₹0.00) */
  font-size: 16px;
  font-weight: 700;
}

/* Optional: Adding Color Cues for Clarity */
.needs-amount {
  color: #e74c3c; /* Red/Orange: Highest priority/Essential */
}

.wants-amount {
  color: #f39c12; /* Yellow/Orange: Discretionary */
}

.save-amount {
  color: #2ecc71; /* Green: Positive/Goal-focused */
}

.controls {
  display: flex;
  gap: 12px;
  padding: 14px;
  flex-wrap: wrap;
}
.big-btn {
  flex: 1;
  min-width: 140px;
  padding: 12px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  color: white;
  cursor: pointer;
  font-size: 14px;
}
.big-btn.income {
  background: var(--income);
}
.big-btn.expense {
  background: var(--expense);
}
.big-btn.savings {
  background: var(--savings);
}

/* Fix content layout for small screens */
.content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 18px;
}

@media (min-width: 700px) {
  .content {
    grid-template-columns: 1fr 300px;
  }
}

@media (min-width: 900px) {
  .content {
    grid-template-columns: 1fr 360px;
  }
}

/* Make allocation card responsive */
.alloc-card {
  width: 100%;
  max-width: 320px;
}

/* Better responsiveness for header */
header.app-head {
  flex-wrap: wrap;
  text-align: center;
}

/* Smaller screen optimizations */
@media (max-width: 400px) {
  body {
    padding: 12px;
  }
  .currency-select {
    width: 100%;
  }
  .wrap {
    border-radius: 12px;
  }
}

/* FIX IPHONE SE RESPONSIVENESS */
@media (max-width: 450px) {
  body {
    padding: 16px;
  }

  .wrap {
    border-radius: 14px;
    overflow: hidden;
  }

  header.app-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .controls {
    flex-direction: column;
  }

  .alloc-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .content {
    grid-template-columns: 1fr !important;
  }
}

.panel .section {
  background: var(--card);
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  background: #f2f6fb;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: #374151;
  display: flex;
  gap: 8px;
  align-items: center;
}
.chip .x {
  background: #ffecec;
  color: #ff5a5a;
  padding: 4px 6px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.transactions {
  max-height: 360px;
  overflow: auto;
}
.trans-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 6px;
  border-bottom: 1px solid #f2f4f7;
}
.trans-left {
  display: flex;
  gap: 10px;
  align-items: center;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.trans-desc {
  font-weight: 600;
}
.trans-meta {
  font-size: 12px;
  color: var(--muted);
}
.amount {
  font-weight: 700;
}

.card {
  background: var(--card);
  padding: 12px;
  border-radius: 12px;
}
.chart-wrap {
  height: 240px;
}

.progress {
  height: 12px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
}

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}
.page-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e6edf3;
  background: white;
  cursor: pointer;
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 23, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}
.modal {
  background: var(--card);
  padding: 16px;
  border-radius: 12px;
  max-width: 520px;
  width: 100%;
}
.form-row {
  display: flex;
  gap: 10px;
}
input,
select,
textarea {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #e6edf3;
}

footer {
  padding: 12px;
  background: #fafafa;
  border-top: 1px solid #f1f5f9;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.currency-select {
  color: black;
}

/* --- iPhone SE Fix Perfect Mobile Layout --- */

@media (max-width: 450px) {
  body {
    padding: 12px !important;
  }

  .wrap {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  .hero,
  .content,
  .balance-card,
  .alloc-card {
    padding: 10px !important;
  }

  .content {
    grid-template-columns: 1fr !important;
  }

  .controls {
    flex-direction: column;
  }
}
