* {
  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;
  color: #1e40af;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #2563eb;
}

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

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

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

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

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
}

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

input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}

textarea {
  resize: vertical;
  font-family: inherit;
}

button#addBtn {
  padding: 12px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

button#addBtn:hover {
  background: #1d4ed8;
}

/* リスト */
.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;
  gap: 8px;
  margin-bottom: 12px;
}

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

.count-badge {
  background: #e0e7ff;
  color: #2563eb;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

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

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* カード */
.card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  position: relative;
  transition: box-shadow 0.15s;
}

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

/* 期限ラベル色 */
.card.overdue {
  border-left: 4px solid #ef4444;
  background: #fff5f5;
}

.card.today {
  border-left: 4px solid #ef4444;
  background: #fff5f5;
}

.card.soon {
  border-left: 4px solid #f97316;
  background: #fffbf5;
}

.card.normal {
  border-left: 4px solid #2563eb;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-client {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.card-date-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.card-date {
  font-size: 0.85rem;
  color: #6b7280;
}

.date-label {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.label-overdue {
  background: #fee2e2;
  color: #dc2626;
}

.label-today {
  background: #fee2e2;
  color: #dc2626;
}

.label-soon {
  background: #ffedd5;
  color: #ea580c;
}

.card-memo {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #4b5563;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-done {
  flex: 1;
  padding: 7px;
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-done:hover {
  background: #a7f3d0;
}

.btn-delete {
  flex: 1;
  padding: 7px;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-delete:hover {
  background: #fca5a5;
}

/* 連絡済みカード */
.card.contacted {
  border-left: 4px solid #9ca3af;
  background: #f9fafb;
  opacity: 0.7;
}

.card.contacted .card-client {
  text-decoration: line-through;
  color: #9ca3af;
}

@media (min-width: 480px) {
  .card-top {
    align-items: center;
  }
}
