* {
  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;
}

header {
  background: #e74c3c;
  color: white;
  padding: 20px 16px;
  text-align: center;
}

header h1 {
  font-size: 1.5rem;
  font-weight: bold;
}

header .subtitle {
  font-size: 0.85rem;
  margin-top: 4px;
  opacity: 0.9;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.card h2 {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 14px;
  color: #555;
  border-left: 4px solid #e74c3c;
  padding-left: 8px;
}

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

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

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #e74c3c;
}

.form-group textarea {
  resize: vertical;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #c0392b;
}

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

.tab-btn {
  flex: 1;
  padding: 8px;
  background: #f0f0f0;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  color: #666;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #e74c3c;
  color: white;
  font-weight: bold;
}

.tab-content {
  display: none;
}

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

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

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #fef9f9;
  border-radius: 6px;
  border-left: 3px solid #e74c3c;
}

.summary-item .label {
  font-size: 0.9rem;
  color: #444;
}

.summary-item .badge {
  background: #e74c3c;
  color: white;
  font-size: 0.8rem;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: 12px;
  min-width: 36px;
  text-align: center;
}

/* 一覧 */
.list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

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

.count-badge {
  background: #e74c3c;
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: 12px;
}

#records-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.record-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 14px;
  position: relative;
}

.record-card .record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.record-card .meta-tag {
  background: #fef0f0;
  color: #c0392b;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: bold;
}

.record-card .record-date {
  color: #888;
}

.record-card .record-content {
  font-size: 0.9rem;
  color: #444;
  line-height: 1.5;
  white-space: pre-wrap;
}

.record-card .delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s;
}

.record-card .delete-btn:hover {
  color: #e74c3c;
}

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

@media (max-width: 375px) {
  header h1 {
    font-size: 1.3rem;
  }
  .card {
    padding: 16px;
  }
}
