:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 4px 16px rgba(17, 24, 39, 0.04);
}

* { 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;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

/* ---------- ヘッダー ---------- */
.app-header { margin-bottom: 28px; }
.eyebrow {
  margin: 0 0 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.app-header h1 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---------- ダッシュボード ---------- */
.dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.stat-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.stat-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stat-icon.memo { background: var(--accent-soft); color: var(--accent); }
.stat-icon.task { background: var(--success-soft); color: var(--success); }
.stat-icon.done { background: #f0fdfa; color: #0d9488; }
.stat-icon.review { background: #f5f3ff; color: #7c3aed; }
.stat-label { font-size: 0.82rem; color: var(--text-muted); }

/* ---------- 最新の振り返り（ダッシュボード） ---------- */
.latest-review {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin: -12px 0 28px;
}
.latest-review-head { display: flex; align-items: center; gap: 16px; }
.latest-review-head > div { flex: 1; min-width: 0; }
.latest-review-week { font-weight: 600; }
.latest-review.is-empty .latest-review-week { color: var(--text-faint); font-weight: 500; }
.latest-review-comment {
  margin: 14px 0 0;
  padding: 12px 16px;
  background: var(--surface-soft);
  border-left: 3px solid #7c3aed;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  white-space: pre-wrap;
  font-size: 0.93rem;
  color: #374151;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.latest-review.is-empty .latest-review-comment { display: none; }
.link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.link:hover { text-decoration: underline; }

/* ---------- 週次振り返り ---------- */
.review-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
  scroll-margin-top: 16px;
}
.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.week-nav button { padding: 6px 12px; font-weight: 500; }
.week-nav button:disabled { opacity: 0.4; cursor: default; }
.week-label { flex: 1; text-align: center; font-weight: 600; font-size: 0.95rem; }
.week-tag {
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.week-tag:empty { display: none; }
.week-summary { margin: 0 0 12px; font-size: 0.82rem; color: var(--text-muted); text-align: center; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.list li.review-item.selected { border-color: #7c3aed; background: #faf8ff; }
.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

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

@media (max-width: 800px) {
  .container { padding: 24px 16px 48px; }
  main, .review-area { grid-template-columns: 1fr; }
  .latest-review-head .link { display: none; }
  .dashboard { gap: 8px; }
  .stat { padding: 14px; }
  .stat-icon { display: none; }
  .stat-value { font-size: 1.5rem; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

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

input, textarea {
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
textarea { resize: vertical; }

button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button:hover { background: var(--accent-hover); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 一覧内の小さいボタン */
.list button {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 12px;
}
button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
button.secondary:hover { background: var(--surface-soft); border-color: var(--text-faint); }
button.danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}
button.danger:hover { background: var(--danger-soft); }

/* ---------- 一覧 ---------- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.list li {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.list li:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.05);
}
.list li.empty {
  background: transparent;
  border: 1px dashed var(--border-strong);
  text-align: center;
  padding: 24px;
  box-shadow: none;
}
.empty { color: var(--text-faint); font-size: 0.88rem; }

.memo-title { font-weight: 600; }
.memo-body {
  white-space: pre-wrap;
  margin: 4px 0 8px;
  color: #374151;
  font-size: 0.93rem;
}
.meta { font-size: 0.76rem; color: var(--text-faint); }

/* タスク */
.task-row { display: flex; align-items: center; gap: 8px; }
.task-main { flex: 1; min-width: 0; }
.task-text { font-weight: 500; }
.task-row.done { background: var(--surface); }
.task-row.done .task-text { text-decoration: line-through; color: var(--text-faint); }

.badge {
  display: inline-block;
  vertical-align: middle;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
  background: var(--warning-soft);
  color: var(--warning);
}
.task-row.done .badge { background: var(--success-soft); color: var(--success); }
