* {
  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;
  padding: 16px;
}

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

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
  color: #2c3e50;
}

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

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

.form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-row input[type="text"] {
  flex: 2;
  min-width: 140px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-row input[type="text"]:focus {
  border-color: #3498db;
}

.form-row input[type="date"] {
  flex: 1;
  min-width: 130px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-row input[type="date"]:focus {
  border-color: #3498db;
}

.form-row button {
  padding: 10px 20px;
  background: #3498db;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.form-row button:hover {
  background: #2980b9;
}

.error-msg {
  color: #e74c3c;
  font-size: 0.85rem;
  margin-top: 8px;
  min-height: 1.2em;
}

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

.list-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

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

.badge {
  background: #ecf0f1;
  color: #777;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 999px;
}

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

#itemList {
  list-style: none;
}

#itemList li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #f9f9f9;
  border-left: 4px solid #ccc;
  gap: 8px;
}

#itemList li.status-ok {
  border-left-color: #2ecc71;
  background: #f0fff4;
}

#itemList li.status-soon {
  border-left-color: #f39c12;
  background: #fffbf0;
}

#itemList li.status-expired {
  border-left-color: #e74c3c;
  background: #fff5f5;
}

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

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

.item-meta {
  font-size: 0.8rem;
  color: #777;
  margin-top: 2px;
}

.item-days {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}

.item-days.ok { color: #27ae60; }
.item-days.soon { color: #d68910; }
.item-days.expired { color: #e74c3c; }

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

.delete-btn:hover {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

@media (max-width: 400px) {
  .form-row {
    flex-direction: column;
  }
  .form-row input,
  .form-row button {
    width: 100%;
  }
}
