* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: sans-serif;
  background: #f5f5f3;
  color: #1a1a1a;
  min-height: 100vh;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.app-title {
  font-size: 22px;
  font-weight: 700;
}
.app-sub {
  font-size: 14px;
  color: #666;
  margin-top: 2px;
}

.btn-clear {
  font-size: 13px;
  font-family: inherit;
  color: #e24b4a;
  background: none;
  border: 1px solid #f7c1c1;
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
  white-space: nowrap;
}

.btn-clear:hover {
  background: #fcebeb;
  border-color: #f09595;
}

.card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card-title,
.list-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group.full {
  grid-column: 1 / -1;
}

label {
  font-size: 13px;
  color: #555;
}

input,
select {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  color: #1a1a1a;
  font-family: inherit;
  transition: border-color 0.15s;
}

input:focus,
select:focus {
  outline: none;
  border-color: #999;
}

input.invalid {
  border-color: #e24b4a;
  background: #fff8f8;
}

.field-error {
  font-size: 12px;
  color: #e24b4a;
  display: none;
}

.field-error.visible {
  display: block;
}

.btn-add {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition:
    opacity 0.15s,
    transform 0.1s;
}

.btn-add:hover {
  opacity: 0.85;
}
.btn-add:active {
  transform: scale(0.98);
}

.summary-card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.summary-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 4px;
}

.summary-amount {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a1a;
}

.summary-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.breakdown-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid #e5e5e5;
  font-size: 13px;
  background: #fafafa;
}

.breakdown-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.breakdown-pill .pill-label {
  color: #555;
}
.breakdown-pill .pill-amount {
  font-weight: 600;
  color: #1a1a1a;
}

.chart-card {
  margin-bottom: 1.25rem;
}
.chart-wrapper {
  position: relative;
  height: 260px;
}

.hidden {
  display: none !important;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}

.filter-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: #999;
  color: #1a1a1a;
}
.filter-btn.active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.count-badge {
  font-size: 12px;
  color: #666;
  background: #f0f0f0;
  border-radius: 20px;
  padding: 2px 10px;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 0.75rem;
}

.empty-text {
  font-size: 14px;
  color: #999;
}

.expense-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid #f0f0f0;
  border-radius: 8px;
  transition: background 0.15s;
  animation: slideIn 0.2s ease;
}

.expense-item:last-child {
  border-bottom: none;
}
.expense-item:hover {
  background: #fafafa;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.expense-info {
  flex: 1;
  min-width: 0;
}
.expense-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.expense-meta {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}
.expense-amount {
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}

.btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  transition:
    color 0.15s,
    background 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

.btn-delete:hover {
  color: #e24b4a;
  background: #fdf0f0;
}

/* responsive */
@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-group.full {
    grid-column: 1;
  }
  .summary-amount {
    font-size: 22px;
  }
}
