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

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  padding: 16px 0 12px;
  color: #222;
  border-bottom: 2px solid #3b82f6;
  margin-bottom: 20px;
}

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

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

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

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

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
}

input[type="text"],
input[type="date"] {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="date"]:focus {
  border-color: #3b82f6;
}

.btn-primary {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #2563eb;
}

/* 一覧 */
.list-section {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

.count-badge {
  background: #e5e7eb;
  color: #555;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.legend {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

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

.badge-expired { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-ok      { background: #dcfce7; color: #166534; }

/* テーブル */
#tableWrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  background: #f3f4f6;
  padding: 8px 10px;
  text-align: left;
  font-size: 0.8rem;
  color: #666;
  font-weight: 600;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

tbody tr:hover {
  background: #fafafa;
}

tbody td {
  padding: 10px 10px;
  vertical-align: middle;
}

/* 行のステータス色 */
tr.status-expired {
  background: #fff5f5;
}
tr.status-expired td {
  color: #b91c1c;
}
tr.status-warning {
  background: #fffbeb;
}
tr.status-warning td {
  color: #92400e;
}
tr.status-ok td {
  color: #166534;
}

.days-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

.chip-expired { background: #fee2e2; color: #b91c1c; }
.chip-warning { background: #fef3c7; color: #92400e; }
.chip-ok      { background: #dcfce7; color: #166534; }

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

.btn-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

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

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

  h1 { font-size: 1.2rem; }

  thead th:nth-child(3) { display: none; }
  tbody td:nth-child(3) { display: none; }
}
