/* Colours used across the app */
:root {
  --bg: #0d0d0d;          /* page background (near-black) */
  --card: #1a1a1a;        /* boxes */
  --border: #333333;
  --text: #f5f5f5;        /* main text (white) */
  --muted: #a8a8a8;       /* small text (light grey) */
  --yellow: #FFD400;      /* main colour */
  --on-yellow: #111111;   /* text on yellow */
  --red: #ff7070;
  --red-bg: #2a1515;
  --red-border: #4d2424;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
  /* Extra space on top, plus room for a phone's notch when opened as an app */
  padding: calc(28px + env(safe-area-inset-top)) 16px 4px;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--on-yellow);
  font-size: 20px;
  font-weight: 700;
}

.app-name {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

/* Today's total */
.total {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}

.total-label {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
}

.total-amount {
  margin: 4px 0 0;
  font-size: 40px;
  font-weight: 700;
  color: var(--yellow);
}

/* Labels */
.field-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 8px;
}

/* Amount box */
.amount-input {
  width: 100%;
  font-size: 28px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
  background: var(--card);
  color: var(--text);
}

/* Hide the small up/down arrows on computers */
.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-input {
  -moz-appearance: textfield;
  appearance: textfield;
}

.amount-input:focus,
.new-cat-input:focus {
  outline: none;
  border-color: var(--yellow);
}

/* Category buttons */
.categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.cat-tile {
  position: relative;
}

.cat-btn {
  width: 100%;
  height: 100%;
  font-size: 16px;
  padding: 16px 8px;
  min-height: 56px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.cat-btn.selected {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--on-yellow);
  font-weight: 700;
}

/* "+ Add" category button */
.cat-btn.add-cat {
  border-style: dashed;
  color: var(--yellow);
  background: transparent;
}

/* Small × on custom categories */
.remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--red-border);
  background: var(--red-bg);
  color: var(--red);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

/* New category box */
.new-cat {
  margin-top: 12px;
}

.new-cat[hidden] {
  display: none;
}

.new-cat-input {
  width: 100%;
  font-size: 18px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
}

.new-cat-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.small-btn {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  min-height: 48px;
  border-radius: 12px;
  cursor: pointer;
}

.save-btn {
  border: none;
  background: var(--yellow);
  color: var(--on-yellow);
}

.cancel-btn {
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text);
}

/* Message */
.message {
  min-height: 22px;
  margin: 12px 0 8px;
  color: var(--red);
  font-size: 15px;
}

/* Add button */
.add-btn {
  width: 100%;
  font-size: 22px;
  font-weight: 700;
  padding: 18px;
  border: none;
  border-radius: 14px;
  background: var(--yellow);
  color: var(--on-yellow);
  cursor: pointer;
}

.add-btn:active {
  background: #e6bf00;
}

/* Section titles */
.list-title {
  font-size: 18px;
  margin: 28px 0 10px;
}

.empty {
  color: var(--muted);
}

/* Month switcher */
.month-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 24px;
}

.switch-btn {
  width: 56px;
  height: 52px;
  font-size: 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--yellow);
  cursor: pointer;
}

.switch-btn:disabled {
  color: #555555;
  border-color: #262626;
  cursor: default;
}

.month-label {
  flex: 1;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
}

/* Monthly Summary section */
.month {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px 16px 12px;
  margin-top: 8px;
}

.month .list-title {
  margin-top: 16px;
}

.month-total {
  font-size: 20px;
  font-weight: 700;
  color: var(--yellow);
  margin: 0 0 14px;
}

.bars {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bar-row {
  margin-bottom: 16px;
}

.bar-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 17px;
  margin-bottom: 7px;
}

.bar-name {
  font-weight: 700;
}

.bar-track {
  height: 14px;
  background: #2c2c2c;
  border-radius: 7px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--yellow);
  border-radius: 7px;
}

/* Categories with ₹ 0 this month look lighter */
.bar-row.zero {
  color: #666666;
}

.bar-row.zero .bar-track {
  background: #222222;
}

/* Expense list */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
}

.item-cat {
  font-weight: 600;
  font-size: 16px;
}

.item-date {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

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

.item-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.delete-btn {
  font-size: 14px;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--red-border);
  border-radius: 10px;
  background: var(--red-bg);
  color: var(--red);
  cursor: pointer;
}
