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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

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

h1 {
  text-align: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: #2e7d32;
}

h2 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: #555;
}

/* 残高カード */
.balance-card {
  background: #2e7d32;
  color: #fff;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin-bottom: 12px;
}

.balance-label {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-bottom: 4px;
}

.balance-amount {
  font-size: 2.2rem;
  font-weight: bold;
}

/* 節約ペースカード */
.pace-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.pace-label {
  font-size: 0.85rem;
  color: #777;
}

.pace-info {
  font-size: 1rem;
  font-weight: bold;
  color: #e53935;
}

/* フォームカード */
.form-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: #777;
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #4caf50;
}

.type-buttons {
  display: flex;
  gap: 8px;
}

.type-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  color: #777;
  transition: all 0.15s;
}

.type-btn.active#btn-income {
  border-color: #4caf50;
  background: #e8f5e9;
  color: #2e7d32;
  font-weight: bold;
}

.type-btn.active#btn-expense {
  border-color: #e53935;
  background: #ffebee;
  color: #c62828;
  font-weight: bold;
}

.add-btn {
  width: 100%;
  padding: 12px;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s;
}

.add-btn:hover {
  background: #388e3c;
}

/* 履歴カード */
.history-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.history-list {
  list-style: none;
}

.empty-msg {
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
  padding: 16px 0;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 10px;
}

.history-item:last-child {
  border-bottom: none;
}

.item-type {
  width: 4px;
  height: 40px;
  border-radius: 2px;
  flex-shrink: 0;
}

.item-type.income {
  background: #4caf50;
}

.item-type.expense {
  background: #e53935;
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-note {
  font-size: 0.95rem;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-date {
  font-size: 0.78rem;
  color: #aaa;
  margin-top: 2px;
}

.item-amount {
  font-size: 1rem;
  font-weight: bold;
  flex-shrink: 0;
}

.item-amount.income {
  color: #2e7d32;
}

.item-amount.expense {
  color: #e53935;
}

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

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

@media (min-width: 640px) {
  .container {
    padding: 24px;
  }
}
