:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c1e26;
  --text-sub: #5b6070;
  --muted: #9298a8;
  --line: #eceef2;
  --line-strong: #dfe2e8;

  --memo: #6366f1;        /* インディゴ */
  --memo-soft: #eef0ff;
  --task: #10a37f;        /* エメラルド */
  --task-soft: #e7f6f1;
  --pending: #f59e0b;     /* アンバー */
  --pending-soft: #fef5e4;
  --review: #e0567f;      /* ローズ */
  --review-soft: #fdedf2;
  --danger: #e5484d;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", 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(--line);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--memo), var(--task));
}
header h1 { margin: 0; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.today { margin: 0; color: var(--text-sub); font-size: 0.875rem; }

main { max-width: 1100px; margin: 0 auto; padding: 28px 20px 56px; }

/* ダッシュボード */
.dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 18px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--c);
}
.stat-memo { --c: var(--memo); }
.stat-task { --c: var(--task); }
.stat-pending { --c: var(--pending); }
.stat-label { color: var(--text-sub); font-size: 0.8rem; font-weight: 500; }
.stat-value {
  font-family: "Inter", sans-serif;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

/* レイアウト */
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.column { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.theme-memo { --accent: var(--memo); --accent-soft: var(--memo-soft); }
.theme-task { --accent: var(--task); --accent-soft: var(--task-soft); }
.theme-review { --accent: var(--review); --accent-soft: var(--review-soft); }

/* ダッシュボード: 最新の振り返り */
.latest-review {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  margin: -12px 0 28px;
  border-left: 4px solid var(--accent);
}
.latest-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.latest-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.latest-week { font-size: 0.85rem; color: var(--text-sub); font-weight: 500; }
.latest-comment {
  margin: 8px 0 10px;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.latest-empty { margin: 8px 0 6px; color: var(--muted); font-size: 0.9rem; }
.latest-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.week-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
}

.link-btn {
  background: transparent;
  color: var(--accent);
  padding: 4px 0;
  font-size: 0.85rem;
}
.link-btn:hover { filter: none; text-decoration: underline; }

/* 週次振り返りセクション */
.review-section { margin-top: 24px; align-items: start; }
select {
  font: inherit;
  font-size: 0.925rem;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  width: 100%;
  cursor: pointer;
}
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.review-head { display: flex; align-items: center; gap: 8px; }
.review-week { font-weight: 600; font-size: 0.9rem; }
.review-comment {
  margin: 4px 0 6px;
  color: var(--text-sub);
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.edit-btn {
  margin-left: auto;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 8px;
}
.edit-btn:hover { color: var(--accent); background: var(--accent-soft); filter: none; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 0.95rem;
  font-weight: 700;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

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

input[type="text"], textarea {
  font: inherit;
  font-size: 0.925rem;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  width: 100%;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  white-space: nowrap;
  transition: filter 0.15s, transform 0.1s;
}
button:hover { filter: brightness(0.92); }
button:active { transform: translateY(1px); }
form button { align-self: flex-end; }

/* 一覧 */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 14px 2px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: none; padding-top: 4px; }
.list li.empty {
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
  padding: 24px 0;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
}

.memo-title { font-weight: 600; font-size: 0.95rem; }
.memo-body {
  margin: 4px 0 6px;
  color: var(--text-sub);
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.meta { color: var(--muted); font-size: 0.775rem; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }

/* タスク */
.task { display: flex; align-items: center; gap: 12px; }
.task input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  flex-shrink: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.task input[type="checkbox"]:hover { border-color: var(--task); }
.task input[type="checkbox"]::after {
  content: "";
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
  opacity: 0;
}
.task input[type="checkbox"]:checked { background: var(--task); border-color: var(--task); }
.task input[type="checkbox"]:checked::after { opacity: 1; }

.task-main { flex: 1; min-width: 0; }
.task-text { font-size: 0.95rem; font-weight: 500; word-break: break-word; }
.task.done .task-text { text-decoration: line-through; color: var(--muted); font-weight: 400; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  margin-right: 6px;
  color: #b45309;
  background: var(--pending-soft);
}
.task.done .badge { color: #0b7a5e; background: var(--task-soft); }

.delete-btn {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.task:hover .delete-btn, .delete-btn:focus-visible { opacity: 1; }
.delete-btn:hover { color: var(--danger); background: #fdecec; filter: none; }

/* タッチ端末ではホバーできないので削除ボタンを常に表示 */
@media (hover: none) {
  .delete-btn { opacity: 1; }
}

@media (max-width: 760px) {
  .columns { grid-template-columns: 1fr; }
  .dashboard { gap: 10px; margin-bottom: 20px; }
  .stat { padding: 14px 12px 14px 16px; }
  .stat-value { font-size: 1.5rem; }
  main { padding: 20px 16px 40px; }
  .header-inner { padding: 14px 16px; }
}
