:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e6e8ef;
  --text: #1f2330;
  --text-sub: #6b7185;
  --text-mute: #9aa0b2;
  --accent: #4f5bd5;
  --accent-hover: #3f4ac0;
  --accent-soft: #eef0fc;
  --orange: #e8912d;
  --orange-soft: #fdf4e8;
  --green: #2f9e6b;
  --green-soft: #e9f6ef;
  --red: #d64545;
  --shadow: 0 1px 2px rgba(20, 24, 40, .04), 0 4px 16px rgba(20, 24, 40, .05);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ヘッダー */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .02em;
}
header h1 .logo {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-right: 10px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: .95rem;
  vertical-align: middle;
}
.today { color: var(--text-sub); font-size: .9rem; }

main { max-width: 1100px; margin: 0 auto; padding: 28px 24px 48px; }

/* ダッシュボード */
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  background: var(--accent-soft);
}
.stat.tasks .stat-icon { background: var(--green-soft); }
.stat.open .stat-icon { background: var(--orange-soft); }
.stat-label { display: block; font-size: .82rem; color: var(--text-sub); }
.stat-value {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-value small { font-size: .85rem; font-weight: 500; color: var(--text-sub); margin-left: 3px; }
.stat.open .stat-value { color: var(--orange); }
.stat.done .stat-icon { background: var(--green-soft); }
.stat.done .stat-value { color: var(--green); }

/* 画面幅が中くらいのときは2列ずつ */
@media (max-width: 960px) {
  .dashboard { grid-template-columns: repeat(2, 1fr); }
}

/* レイアウト */
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.column { min-width: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 .count {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-sub);
  background: var(--bg);
  border-radius: 999px;
  padding: 1px 9px;
}

/* フォーム */
form { display: flex; flex-direction: column; gap: 10px; }
.inline-form { flex-direction: row; }
.inline-form input { flex: 1; min-width: 0; }

input[type="text"], textarea {
  font: inherit;
  font-size: .95rem;
  color: var(--text);
  padding: 10px 14px;
  background: #fbfbfd;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input[type="text"]::placeholder, textarea::placeholder { color: var(--text-mute); }
input[type="text"]:focus, textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 91, 213, .15);
}
textarea { resize: vertical; }

button {
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
button:hover { background: var(--accent-hover); }
button:active { transform: translateY(1px); }

button.danger {
  background: transparent;
  color: var(--text-mute);
  font-weight: 500;
  font-size: .82rem;
  padding: 6px 10px;
  border-radius: 8px;
}
button.danger:hover { background: #fdecec; color: var(--red); }

/* 一覧 */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list li {
  background: #fbfbfd;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
  transition: box-shadow .15s, border-color .15s;
}
.list li:hover { box-shadow: 0 2px 10px rgba(20, 24, 40, .06); }
.list li.empty {
  background: none;
  border: 1px dashed var(--border);
  text-align: center;
  color: var(--text-mute);
  font-size: .88rem;
  padding: 22px;
}
.list li.empty:hover { box-shadow: none; }

.memo-title { font-weight: 700; font-size: 1rem; }
.memo-body { white-space: pre-wrap; margin: 6px 0 8px; color: #444a5c; font-size: .93rem; }
.meta { font-size: .76rem; color: var(--text-mute); margin-top: 2px; }

/* タスク */
.list li.task { display: flex; align-items: center; gap: 12px; border-left-color: var(--orange); }
.list li.task.done { border-left-color: var(--green); background: #f8fbf9; }
.task-main { flex: 1; min-width: 0; }
.task-text { font-weight: 500; }
.task.done .task-text { text-decoration: line-through; color: var(--text-mute); }

.task input[type="checkbox"] {
  appearance: none;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 2px solid #c9cdd9;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s, border-color .15s;
}
.task input[type="checkbox"]:hover { border-color: var(--green); }
.task input[type="checkbox"]:checked { background: var(--green); border-color: var(--green); }
.task input[type="checkbox"]:checked::after {
  content: "";
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}

.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  padding: 1px 9px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: 1px;
  background: var(--orange-soft);
  color: var(--orange);
}
.task.done .badge { background: var(--green-soft); color: var(--green); }


/* ダッシュボード：最新の振り返り */
.latest-review {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin: -12px 0 28px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.latest-review:hover { border-color: #c8ccf2; box-shadow: 0 4px 18px rgba(79, 91, 213, .12); }
.latest-review .stat-icon { background: #f3eefc; }
.latest-review-main { flex: 1; min-width: 0; }
.latest-review-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.latest-review-week { font-weight: 700; font-size: .95rem; }
.latest-review-link { font-size: .8rem; color: var(--accent); white-space: nowrap; }
.latest-review-text {
  margin-top: 4px;
  color: #444a5c;
  font-size: .92rem;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.latest-review.empty .latest-review-text { color: var(--text-mute); }

/* 週次の振り返り */
.review-card { scroll-margin-top: 20px; }
.review-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.review-layout > * { min-width: 0; }

.week-nav { display: flex; align-items: center; gap: 8px; }
.week-label { flex: 1; text-align: center; font-weight: 700; }
.week-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: .7rem;
  font-weight: 600;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: 1px;
}
.week-tag:empty { display: none; }

button.ghost {
  background: #fbfbfd;
  color: var(--text-sub);
  border: 1px solid var(--border);
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
}
button.ghost:hover { background: var(--accent-soft); color: var(--accent); }
button.ghost:disabled { opacity: .35; cursor: default; background: #fbfbfd; color: var(--text-sub); }

.week-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: .8rem;
  color: var(--text-sub);
}
.week-summary span { background: var(--bg); border-radius: 999px; padding: 2px 10px; }

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

.sub-heading { margin: 0 0 12px; font-size: .88rem; color: var(--text-sub); font-weight: 600; }

.list li.review { border-left-color: #8a63d2; cursor: pointer; }
.list li.review.selected { background: #f6f3fd; border-color: #d9cdf3; border-left-color: #8a63d2; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.review-week { font-weight: 700; font-size: .92rem; }
.review-comment { white-space: pre-wrap; margin: 6px 0 4px; color: #444a5c; font-size: .92rem; }

/* スマホ */
@media (max-width: 760px) {
  .columns { grid-template-columns: 1fr; gap: 0; }
  .dashboard { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px 16px; gap: 12px; }
  .stat-icon { width: 38px; height: 38px; font-size: 1.1rem; }
  main { padding: 20px 16px 40px; }
  .header-inner { padding: 14px 16px; }
  .review-layout { grid-template-columns: 1fr; }
  .latest-review { margin-top: -18px; }
}

/* とても狭い画面では1列 */
@media (max-width: 480px) {
  .dashboard { grid-template-columns: 1fr; }
}
