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

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

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

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e40af;
  text-align: center;
  padding: 20px 0 16px;
  border-bottom: 2px solid #3b82f6;
  margin-bottom: 20px;
}

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

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

.form-group {
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

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

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

textarea {
  resize: vertical;
}

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

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

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

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

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

.count-badge {
  font-size: 0.8rem;
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}

#itemList {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  background: #f8fafc;
  position: relative;
}

.item-card.done {
  opacity: 0.55;
}

.item-card.done .item-text {
  text-decoration: line-through;
  color: #94a3b8;
}

.item-text {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 8px;
  padding-right: 30px;
  white-space: pre-wrap;
  word-break: break-word;
}

.item-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.meta-owner {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #475569;
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 20px;
}

.meta-deadline {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #475569;
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 20px;
}

.meta-deadline.overdue {
  background: #fee2e2;
  color: #b91c1c;
}

.item-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}

.btn-done,
.btn-delete {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-done {
  background: #dcfce7;
  color: #16a34a;
}

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

.btn-delete {
  background: #fee2e2;
  color: #dc2626;
}

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

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

/* スマホ対応 */
@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}
