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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #333;
  font-size: 16px;
}

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

header {
  background: #c0392b;
  color: white;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  text-align: center;
}

header h1 {
  font-size: 1.4rem;
}

section {
  background: white;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

h2 {
  font-size: 1rem;
  color: #555;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e74c3c;
}

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

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

.form-row {
  display: flex;
  gap: 10px;
}

.form-row .form-group {
  flex: 1;
}

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

input:focus {
  border-color: #e74c3c;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:active {
  opacity: 0.7;
}

.btn-primary {
  background: #e74c3c;
  color: white;
  width: 100%;
}

.btn-secondary {
  background: #3498db;
  color: white;
}

.btn-ghost {
  background: #eee;
  color: #555;
}

/* サマリー */
.summary-section {
  display: flex;
  gap: 12px;
}

.summary-card {
  flex: 1;
  background: #fff5f5;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

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

.summary-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #c0392b;
}

/* ランキング */
.ranking-list {
  list-style: none;
}

.ranking-list li {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 10px;
}

.ranking-list li:last-child {
  border-bottom: none;
}

.rank-num {
  font-weight: bold;
  color: white;
  background: #e74c3c;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.rank-num.gold { background: #f1c40f; color: #333; }
.rank-num.silver { background: #95a5a6; }
.rank-num.bronze { background: #e67e22; }

.rank-name {
  flex: 1;
  font-size: 0.95rem;
}

.rank-info {
  font-size: 0.85rem;
  color: #888;
  text-align: right;
}

.rank-amount {
  font-weight: bold;
  color: #c0392b;
  font-size: 0.95rem;
}

/* フィルター */
.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-row input {
  flex: 1;
  min-width: 140px;
}

/* テーブル */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  background: #f0f0f0;
  padding: 8px 6px;
  text-align: left;
  font-size: 0.8rem;
  color: #666;
  white-space: nowrap;
}

td {
  padding: 8px 6px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

.amount-cell {
  color: #c0392b;
  font-weight: bold;
  white-space: nowrap;
}

.delete-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  color: #999;
  font-size: 0.8rem;
  white-space: nowrap;
}

.delete-btn:hover {
  background: #fee;
  border-color: #e74c3c;
  color: #e74c3c;
}

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

/* レスポンシブ */
@media (max-width: 500px) {
  .summary-section {
    flex-direction: column;
  }

  .summary-value {
    font-size: 1.3rem;
  }

  th:nth-child(3),
  td:nth-child(3),
  th:nth-child(4),
  td:nth-child(4) {
    display: none;
  }

  table {
    font-size: 0.82rem;
  }
}
