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

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

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

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 20px;
}

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

h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}

/* フォームカード */
.form-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 24px;
}

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

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

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.btn-primary:hover {
  background: #1976D2;
}

.error-msg {
  color: #e53935;
  font-size: 0.82rem;
  margin-top: 8px;
  min-height: 16px;
}

/* 一覧 */
.list-section {
  margin-bottom: 24px;
}

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

.item-count {
  font-size: 0.82rem;
  color: #888;
  background: #eee;
  padding: 2px 10px;
  border-radius: 20px;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

/* 品目カード */
.item-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  border-left: 5px solid #ccc;
  position: relative;
}

.item-card.risk-high { border-left-color: #e53935; }
.item-card.risk-mid  { border-left-color: #fb8c00; }
.item-card.risk-low  { border-left-color: #43a047; }
.item-card.risk-down { border-left-color: #1e88e5; }

.item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.item-name {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
}

.item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

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

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

.item-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.info-box {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 8px 10px;
}

.info-label {
  font-size: 0.73rem;
  color: #888;
  margin-bottom: 2px;
}

.info-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
}

.info-value.up   { color: #e53935; }
.info-value.down { color: #1e88e5; }

.item-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

.risk-high { background: #fdecea; color: #e53935; }
.risk-mid  { background: #fff3e0; color: #e65100; }
.risk-low  { background: #e8f5e9; color: #2e7d32; }
.risk-down { background: #e3f2fd; color: #1565c0; }

.item-memo {
  font-size: 0.82rem;
  color: #888;
}

/* 判定基準 */
.legend {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #555;
  line-height: 2;
}

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

  .item-body {
    grid-template-columns: 1fr 1fr;
  }
}
