* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  background: #f0f9f3;
  color: #2b2f36;
}

header {
  background: #22a861;
  color: #fff;
  padding: 16px 24px;
}

header h1 {
  margin: 0;
  font-size: 22px;
}

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ダッシュボード */
.dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  color: #dc2626;
}

.stat {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 14px;
  color: #dc2626;
}

.stat-value {
  font-size: 32px;
  font-weight: bold;
  margin-top: 4px;
}

.stat.highlight .stat-value {
  color: #dc2626;
}

/* ダッシュボードの最新の振り返り（横いっぱいに表示） */
.latest-review {
  grid-column: 1 / -1;
  text-decoration: none;
  color: inherit;
  border-left: 4px solid #22a861;
}

.latest-review:hover {
  background: #f7fcf9;
}

.latest-review-text {
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* レイアウト */
.columns {
  display: grid;
  grid-template-columns: 1fr;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
  border-left: 4px solid #22a861;
  padding-left: 8px;
}

/* フォーム */
form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

input,
textarea {
  font: inherit;
  padding: 10px;
  border: 1px solid #c5e3cf;
  border-radius: 6px;
  width: 100%;
}

textarea {
  resize: vertical;
}

button {
  font: inherit;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #ea580c;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background: #c2410c;
}

/* 一覧 */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  border-bottom: 1px solid #e3f2e8;
  padding: 12px 0;
}

.list li:last-child {
  border-bottom: none;
}

.empty {
  color: #9aa1ab;
}

.memo-title {
  font-weight: bold;
}

.memo-body {
  margin: 6px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.meta {
  font-size: 12px;
  color: #8a919b;
}

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

.task-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

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

.task-title {
  word-break: break-word;
}

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

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  background: #fff4e6;
  color: #d9480f;
}

.task-item.done .badge {
  background: #e6f4ea;
  color: #2b8a3e;
}

/* 締切・残り時間 */
.deadline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 4px 0 2px;
}

.remain {
  font-weight: bold;
  padding: 1px 8px;
  border-radius: 4px;
}

.remain-ok {
  background: #e6f4ea;
  color: #1c7a44;
}

.remain-soon {
  background: #fff4e6;
  color: #d9480f;
}

.remain-over {
  background: #ffe3e3;
  color: #c92a2a;
}

.remain-done {
  background: #f1f3f5;
  color: #868e96;
}

.delete-btn {
  background: #fff;
  color: #c92a2a;
  border: 1px solid #f1c0c0;
  padding: 6px 12px;
  font-size: 13px;
}

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

/* カレンダー */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.cal-title {
  font-weight: bold;
  font-size: 16px;
  min-width: 110px;
  text-align: center;
}

.nav-btn {
  padding: 4px 12px;
  font-size: 16px;
}

.today-btn {
  margin-left: auto;
  font-size: 13px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.cal-weekday {
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  padding: 4px 0;
}

.cal-day {
  min-height: 72px;
  border: 1px solid #e3f2e8;
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
  overflow: hidden;
}

.cal-day:hover {
  background: #f0f9f3;
}

.cal-day.empty-day {
  border: none;
  cursor: default;
  background: none;
}

.cal-day.today {
  border: 2px solid #22a861;
}

.cal-date {
  font-size: 12px;
  font-weight: bold;
}

.sun,
.sun .cal-date {
  color: #c92a2a;
}

.sat,
.sat .cal-date {
  color: #1971c2;
}

.cal-task {
  font-size: 11px;
  border-radius: 3px;
  padding: 1px 4px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-task.remain-done {
  text-decoration: line-through;
}

/* 週次の振り返り */
.week-title {
  min-width: 0;
  flex: 1;
  font-size: 14px;
}

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

.week-stat {
  background: #f0f9f3;
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.week-stat-value {
  font-size: 20px;
  font-weight: bold;
  color: #1c7a44;
}

.week-stat-label {
  font-size: 12px;
  color: #6b7280;
}

.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.edit-btn {
  background: #fff;
  color: #1c7a44;
  border: 1px solid #c5e3cf;
  padding: 4px 12px;
  font-size: 13px;
}

.edit-btn:hover {
  background: #f0f9f3;
}

.cal-hint {
  font-size: 12px;
  color: #8a919b;
  margin: 8px 0 0;
}

@media (max-width: 760px) {
  .stat-value {
    font-size: 24px;
  }
  .cal-day {
    min-height: 56px;
    padding: 2px;
  }
}
