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

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #3a7bd5;
}

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

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

.form-row {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row label {
  font-size: 0.85rem;
  color: #666;
}

input[type="text"],
input[type="date"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fafafa;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
  outline: none;
  border-color: #3a7bd5;
  background: #fff;
}

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

.btn-primary:hover {
  background: #2e63b5;
}

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

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

.item-count {
  font-size: 0.85rem;
  color: #888;
}

/* アラートバナー */
.alert-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.88rem;
  color: #856404;
  margin-bottom: 12px;
}

/* アイテムリスト */
.empty-msg {
  color: #aaa;
  font-size: 0.9rem;
  text-align: center;
  padding: 20px 0;
}

.item-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  transition: box-shadow 0.15s;
}

.item-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* 期限切れ */
.item-card.expired {
  border-left: 4px solid #e74c3c;
  background: #fff5f5;
}

/* 30日以内 */
.item-card.expiring-soon {
  border-left: 4px solid #f39c12;
  background: #fffbf0;
}

/* 期限に余裕あり */
.item-card.safe {
  border-left: 4px solid #27ae60;
}

.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-meta {
  font-size: 0.82rem;
  color: #888;
  margin-top: 4px;
}

.item-expiry {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 6px;
}

.expired .item-expiry { color: #e74c3c; }
.expiring-soon .item-expiry { color: #f39c12; }
.safe .item-expiry { color: #27ae60; }

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

.expired .item-remaining { color: #e74c3c; font-weight: 600; }
.expiring-soon .item-remaining { color: #f39c12; font-weight: 600; }

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

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

/* レスポンシブ */
@media (max-width: 420px) {
  h1 { font-size: 1.2rem; }
  .item-name { font-size: 0.95rem; }
}
