* {
  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: 600px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a1a2e;
  padding: 16px 0 20px;
}

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

/* サマリー */
.summary {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.summary-box {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.summary-box .label {
  font-size: 0.72rem;
  color: #888;
  margin-bottom: 6px;
}

.summary-box .amount {
  font-size: 1.1rem;
  font-weight: 700;
}

.summary-box.balance .amount { color: #1a1a2e; }
.summary-box.income .amount  { color: #2196F3; }
.summary-box.expense .amount { color: #e53935; }

/* フォーム */
.form-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  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: #666;
  margin-bottom: 4px;
}

.form-group input[type="date"],
.form-group input[type="text"],
.form-group input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #2196F3;
}

.radio-group {
  display: flex;
  gap: 20px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.radio-label input[type="radio"] {
  accent-color: #2196F3;
  width: 16px;
  height: 16px;
}

.btn-add {
  width: 100%;
  padding: 12px;
  background: #2196F3;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.2s;
}

.btn-add:hover { background: #1976D2; }
.btn-add:active { background: #1565C0; }

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

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-header h2 { margin-bottom: 0; }

.btn-clear {
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: #999;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-clear:hover {
  border-color: #e53935;
  color: #e53935;
}

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

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

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

.history-item .item-date {
  font-size: 0.78rem;
  color: #aaa;
  min-width: 72px;
}

.history-item .item-desc {
  flex: 1;
  font-size: 0.92rem;
  color: #333;
}

.history-item .item-amount {
  font-size: 0.95rem;
  font-weight: 700;
  min-width: 80px;
  text-align: right;
}

.history-item.income .item-amount { color: #2196F3; }
.history-item.expense .item-amount { color: #e53935; }

.history-item .item-delete {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
  transition: color 0.2s;
  line-height: 1;
}

.history-item .item-delete:hover { color: #e53935; }

@media (max-width: 400px) {
  .summary {
    flex-direction: column;
  }
}
