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

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

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

h1 {
  font-size: 1.5rem;
  color: #1a4a8a;
  margin-bottom: 16px;
  text-align: center;
  padding: 12px 0;
  border-bottom: 3px solid #4a7fd4;
}

h2 {
  font-size: 1.1rem;
  color: #2c5282;
  margin-bottom: 12px;
}

h3 {
  font-size: 0.95rem;
  color: #4a5568;
  margin-bottom: 10px;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* フォーム */
.form-group {
  margin-bottom: 12px;
}

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

.form-group input,
.form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #cbd5e0;
  border-radius: 6px;
  font-size: 1rem;
  color: #333;
  background: #f7fafc;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #4a7fd4;
  background: #fff;
}

.btn-primary {
  width: 100%;
  padding: 11px;
  background: #4a7fd4;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #3566b5;
}

/* タブ */
.summary-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  border: 2px solid #4a7fd4;
  border-radius: 6px;
  background: #fff;
  color: #4a7fd4;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #4a7fd4;
  color: #fff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ランキング */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f7fafc;
  border-radius: 7px;
  border-left: 4px solid #4a7fd4;
}

.rank-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: #4a7fd4;
  min-width: 22px;
}

.rank-num.gold { color: #d4a017; }
.rank-num.silver { color: #9e9e9e; }
.rank-num.bronze { color: #b87333; }

.rank-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
}

.rank-count {
  font-size: 0.9rem;
  color: #e53e3e;
  font-weight: 700;
}

.bar-wrap {
  flex: 1;
  background: #e2e8f0;
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: #4a7fd4;
  border-radius: 4px;
  transition: width 0.4s;
}

/* 記録一覧 */
.records-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.badge {
  font-size: 0.8rem;
  background: #4a7fd4;
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 6px;
}

.btn-danger-small {
  padding: 5px 12px;
  background: #fff;
  color: #e53e3e;
  border: 1.5px solid #e53e3e;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger-small:hover {
  background: #fff5f5;
}

.record-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.record-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #f7fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.record-body {
  flex: 1;
}

.record-product {
  font-weight: 700;
  font-size: 0.95rem;
  color: #2d3748;
}

.record-detail {
  font-size: 0.82rem;
  color: #718096;
  margin-top: 2px;
}

.record-reason {
  display: inline-block;
  font-size: 0.78rem;
  background: #ebf4ff;
  color: #2b6cb0;
  padding: 2px 7px;
  border-radius: 10px;
  margin-top: 4px;
  font-weight: 600;
}

.record-date {
  font-size: 0.75rem;
  color: #a0aec0;
  margin-top: 3px;
}

.btn-delete {
  background: none;
  border: none;
  color: #cbd5e0;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}

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

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

@media (max-width: 480px) {
  h1 { font-size: 1.3rem; }
  .card { padding: 14px 12px; }
}
