* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: #f4f5f7;
  color: #1f2430;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

header h1 {
  font-size: 1.6rem;
  margin: 8px 0 24px;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border-top: 4px solid transparent;
}

.stat-card.stat-notes {
  border-top-color: #3457d5;
}

.stat-card.stat-tasks {
  border-top-color: #7c3aed;
}

.stat-card.stat-tasks-pending {
  border-top-color: #ea580c;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
}

.stat-notes .stat-value {
  color: #3457d5;
}

.stat-tasks .stat-value {
  color: #7c3aed;
}

.stat-tasks-pending .stat-value {
  color: #ea580c;
}

.stat-label {
  margin-top: 4px;
  font-size: 0.85rem;
  color: #6b7280;
}

.latest-reflection {
  grid-column: 1 / -1;
  background: #eef2ff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.latest-reflection-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4338ca;
  margin-bottom: 6px;
}

.latest-reflection-body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 0.9rem;
}

.latest-reflection-week {
  font-weight: 600;
  color: #312e81;
  white-space: nowrap;
}

.latest-reflection-comment {
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-inline {
  color: #9ca3af;
}

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

@media (max-width: 720px) {
  .columns {
    grid-template-columns: 1fr;
  }
  .dashboard {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.reflection-panel .list {
  max-height: 400px;
}

.panel h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field-label {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: -4px;
}

.form input,
.form textarea {
  padding: 10px 12px;
  border: 1px solid #d7dbe3;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}

.form button {
  align-self: flex-start;
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  background: #3457d5;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.form button:hover {
  background: #2a46b0;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
}

.item {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
}

.item-title {
  font-weight: 600;
  margin: 0 0 4px;
  word-break: break-word;
}

.item-body {
  margin: 0 0 6px;
  white-space: pre-wrap;
  color: #4b5563;
  font-size: 0.9rem;
  word-break: break-word;
}

.item-meta {
  font-size: 0.75rem;
  color: #9ca3af;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 10px;
}

.due {
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
}

.due.overdue {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 600;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: #9ca3af;
}

.task-main {
  flex: 1;
  min-width: 0;
}

.task-title {
  margin: 0 0 4px;
  word-break: break-word;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
}

.badge.done {
  background: #dcfce7;
  color: #15803d;
}

.badge.pending {
  background: #fef3c7;
  color: #b45309;
}

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.9rem;
  color: #9ca3af;
  padding: 2px 6px;
}

.icon-btn:hover {
  color: #dc2626;
}

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