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

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

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

h1 {
  font-size: 1.4rem;
  text-align: center;
  padding: 12px 0 16px;
  color: #1a1a2e;
  border-bottom: 2px solid #dee2e6;
  margin-bottom: 16px;
}

h2 {
  font-size: 1rem;
  color: #495057;
  margin-bottom: 10px;
}

/* サマリー */
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

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

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

.summary-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.summary-card.total .summary-value { color: #495057; }
.summary-card.pass .summary-value  { color: #28a745; }
.summary-card.fail .summary-value  { color: #dc3545; }
.summary-card.rate .summary-value  { color: #e67e22; }

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

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

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

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

.form-group input[type="text"]:focus {
  border-color: #4a90d9;
}

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

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

.radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.pass-label { color: #28a745; }
.fail-label { color: #dc3545; }

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

.btn-add:hover { background: #357abd; }

/* 製品別集計 */
.stats-section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.stats-table th {
  background: #f8f9fa;
  padding: 7px 10px;
  text-align: left;
  border-bottom: 2px solid #dee2e6;
  color: #495057;
}

.stats-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f1f3f5;
}

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

/* 記録一覧 */
.list-section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

.btn-clear {
  padding: 5px 12px;
  background: #fff;
  color: #dc3545;
  border: 1px solid #dc3545;
  border-radius: 5px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-clear:hover {
  background: #dc3545;
  color: #fff;
}

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

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

.record-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 7px;
  border-left: 4px solid;
  background: #f8f9fa;
}

.record-item.pass {
  border-left-color: #28a745;
  background: #f6fff8;
}

.record-item.fail {
  border-left-color: #dc3545;
  background: #fff8f8;
}

.record-badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  margin-top: 2px;
}

.record-item.pass .record-badge {
  background: #d4edda;
  color: #155724;
}

.record-item.fail .record-badge {
  background: #f8d7da;
  color: #721c24;
}

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

.record-product {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-reason {
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 2px;
}

.record-time {
  font-size: 0.75rem;
  color: #adb5bd;
  margin-top: 2px;
}

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

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

/* レスポンシブ */
@media (max-width: 480px) {
  .summary {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 375px) {
  h1 { font-size: 1.2rem; }
}
