* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

/* Header / Input Bar */
header {
  background: #1a1a2e;
  color: #fff;
  padding: 20px 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
  text-align: center;
}

.input-bar {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a0a0b8;
  font-weight: 500;
}


select {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 0.9rem;
  padding: 10px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

select:focus {
  border-color: #4fc3f7;
}

select option {
  background: #1a1a2e;
  color: #fff;
}

/* Main Grid */
main.grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Columns */
.column {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}

.column h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #666;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #eee;
  font-weight: 600;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}

thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #999;
  font-weight: 500;
  border-bottom: 1px solid #eee;
}

tbody td, tfoot td {
  padding: 10px 16px;
  border-bottom: 1px solid #f5f5f5;
}

tbody tr:hover {
  background: #f8f9fb;
}

/* Income breakdown table */
#col-income table {
  text-align: right;
}

#col-income th {
  text-align: right;
}

#col-income th:first-child,
#col-income td:first-child,
#col-budget th:first-child,
#col-budget td:first-child {
  text-align: left;
  font-weight: 600;
}

#col-budget table {
  text-align: right;
}

#col-budget th {
  text-align: right;
}

.budget-name-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

#col-income .row-gross td { color: #1a1a2e; }
#col-income .row-tax td { color: #777; }
#col-income .row-net td { color: #1a1a2e; }

.income-cell-input {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #f8f9fb;
  font-size: 0.9rem;
  color: inherit;
  font-weight: inherit;
  text-align: right;
  width: 100%;
  padding: 4px 6px;
  outline: none;
  transition: all 0.15s;
  cursor: pointer;
}

.income-cell-input:hover {
  background: #eef1f5;
  border-color: #ccc;
}

.income-cell-input:focus {
  background: #fff;
  border-color: #4fc3f7;
  box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.2);
  cursor: text;
}

.income-cell-input.last-edited {
  font-weight: 700;
  background: #e3f2fd;
  border-color: #90caf9;
}

/* Budget */
.budget-controls {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
}

#add-category {
  background: none;
  border: 1px dashed #ccc;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.8rem;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

#add-category:hover {
  border-color: #4fc3f7;
  color: #4fc3f7;
}

#budget-body td {
  vertical-align: middle;
}

.budget-name-input {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #f8f9fb;
  font-size: 0.9rem;
  color: #1a1a2e;
  font-weight: 500;
  width: 100%;
  padding: 4px 6px;
  outline: none;
  transition: all 0.15s;
  cursor: pointer;
}

.budget-name-input:hover {
  background: #eef1f5;
  border-color: #ccc;
}

.budget-name-input:focus {
  background: #fff;
  border-color: #4fc3f7;
  box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.2);
  cursor: text;
}

.budget-pct-input {
  border: 1px solid #eee;
  border-radius: 4px;
  background: #f8f9fb;
  font-size: 0.85rem;
  color: #1a1a2e;
  width: 56px;
  padding: 4px 6px;
  text-align: right;
  outline: none;
  transition: border-color 0.2s;
}

.budget-pct-input:focus {
  border-color: #4fc3f7;
  background: #fff;
}

.delete-btn {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 4px;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

.delete-btn:hover {
  color: #e53935;
  background: #fce4ec;
}

/* Budget totals */
.budget-total-row td {
  border-top: 2px solid #eee;
  font-weight: 500;
}

.budget-remaining-row td {
  color: #999;
  font-size: 0.85rem;
}

.budget-remaining-row.over-budget td {
  color: #c62828;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 1100px) {
  main.grid {
    padding: 16px;
  }

  #col-income table {
    font-size: 0.8rem;
  }
}

@media (max-width: 600px) {
  .input-bar {
    flex-direction: column;
    gap: 12px;
  }

  header {
    padding: 16px;
  }

  #gross-income {
    width: 100%;
  }
}
