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

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

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

header {
  text-align: center;
  padding: 20px 0 16px;
}

header h1 {
  font-size: 1.6rem;
  color: #2e7d32;
}

.subtitle {
  font-size: 0.85rem;
  color: #777;
  margin-top: 4px;
}

/* 入力エリア */
.input-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}

.input-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.input-group input[type="text"]:focus {
  border-color: #43a047;
}

.input-group input[type="date"] {
  flex: 0 1 150px;
  padding: 10px 8px;
  border: 1.5px solid #c8e6c9;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
}

.input-group input[type="date"]:focus {
  border-color: #43a047;
}

.input-group button {
  flex: 0 0 70px;
  padding: 10px 0;
  background: #43a047;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.input-group button:hover {
  background: #388e3c;
}

/* サマリー */
.summary {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 10px;
}

/* リスト */
.list-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

#itemList {
  list-style: none;
}

.item-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  border-bottom: 1px solid #f1f1f1;
  animation: fadeIn 0.2s ease;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.item-badge {
  font-size: 1.2rem;
  flex-shrink: 0;
}

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

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

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

.item-days {
  font-size: 0.8rem;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ステータス別カラー */
.status-expired {
  background: #ffebee;
  color: #c62828;
}

.status-danger {
  background: #fff3e0;
  color: #e65100;
}

.status-warning {
  background: #fffde7;
  color: #f57f17;
}

.status-safe {
  background: #e8f5e9;
  color: #2e7d32;
}

/* カード背景 */
.item-card.expired {
  background: #fff5f5;
}

.item-card.danger {
  background: #fff8f0;
}

.item-card.warning {
  background: #fffff0;
}

.delete-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #bbb;
  padding: 4px;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

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

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

.empty-msg.show {
  display: block;
}

/* レスポンシブ */
@media (max-width: 400px) {
  .input-group input[type="date"] {
    flex: 1 1 100%;
  }
  .input-group button {
    flex: 1 1 100%;
  }
}
