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

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

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #2c5f2e;
  color: #fff;
  border-radius: 8px;
  text-align: center;
}

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

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

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

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

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

.form-group input:focus {
  border-color: #2c5f2e;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: #2c5f2e;
  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: #1e4220;
}

/* リストセクション */
.list-section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

.summary {
  font-size: 0.8rem;
  color: #666;
}

/* 凡例 */
.legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.badge.expired  { background: #ffe0e0; color: #c0392b; border: 1px solid #e9a5a5; }
.badge.soon     { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.badge.ok       { background: #e8f5e9; color: #2c5f2e; border: 1px solid #a5d6a7; }
.badge.no-expiry{ background: #f0f0f0; color: #666;    border: 1px solid #ccc; }

/* アイテムリスト */
.item-list {
  list-style: none;
}

.item-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 10px;
  border-bottom: 1px solid #f0f0f0;
  gap: 10px;
}

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

.item-info {
  flex: 1;
}

.item-name {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.item-qty {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 4px;
}

.item-expiry {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
}

.item-expiry.expired  { background: #ffe0e0; color: #c0392b; }
.item-expiry.soon     { background: #fff3cd; color: #856404; }
.item-expiry.ok       { background: #e8f5e9; color: #2c5f2e; }
.item-expiry.no-expiry{ background: #f0f0f0; color: #666; }

.item-left-badge {
  display: none;
  font-size: 0.7rem;
  margin-left: 6px;
  vertical-align: middle;
}

.item-list li.expired-row {
  background: #fff8f8;
}

.item-list li.soon-row {
  background: #fffdf0;
}

.btn-delete {
  background: none;
  border: 1px solid #ddd;
  color: #999;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-delete:hover {
  background: #ffe0e0;
  border-color: #e9a5a5;
  color: #c0392b;
}

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

/* スマホ幅調整 */
@media (max-width: 480px) {
  h1 { font-size: 1.2rem; }
  .item-list li { flex-direction: column; }
  .btn-delete { align-self: flex-end; }
}
