:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #6e7681;
  --subtle: #a1a7ae;
  --border: #e6e3dd;
  --border-strong: #d4d0c8;
  --accent: #2f5d50;
  --accent-hover: #264c41;
  --accent-soft: #e6efeb;
  --danger: #b4443a;
  --danger-soft: #f8e9e7;
  --shadow: 0 1px 2px rgba(31, 35, 40, 0.04), 0 4px 16px rgba(31, 35, 40, 0.04);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151719;
    --surface: #1d2023;
    --text: #e8e6e3;
    --muted: #9ba1a8;
    --subtle: #6b7178;
    --border: #2c3035;
    --border-strong: #3a3f45;
    --accent: #7fb8a4;
    --accent-hover: #95c7b5;
    --accent-soft: #23332d;
    --danger: #e0877e;
    --danger-soft: #3a2523;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Sans", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ヘッダー */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}

/* ダッシュボード */
.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
}
.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}
.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.stat-value small {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}
.stat-accent .stat-value { color: var(--accent); }
.progress {
  height: 6px;
  background: var(--accent-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.stat-note {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

/* パネル */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

/* フォーム */
input, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  transition: border-color 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--subtle); }
input:focus, textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 84px; }

.task-form { display: flex; gap: 8px; margin-bottom: 8px; }
.memo-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.form-actions { display: flex; justify-content: flex-end; }

.btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--surface); }
.btn-primary:hover { background: var(--accent-hover); }

/* 空状態 */
.empty {
  color: var(--subtle);
  font-size: 0.88rem;
  text-align: center;
  padding: 28px 0 12px;
}

/* タスク一覧 */
.task-list, .memo-list { list-style: none; margin: 0; padding: 0; }
.task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  border-top: 1px solid var(--border);
}
.task:first-child { border-top: none; }

.check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: all 0.15s;
}
.check:hover { border-color: var(--accent); }
.check svg { width: 12px; height: 12px; opacity: 0; color: var(--surface); }
.task.completed .check { background: var(--accent); border-color: var(--accent); }
.task.completed .check svg { opacity: 1; }

.task-body { flex: 1; min-width: 0; }
.task-title { word-break: break-word; }
.task.completed .task-title { color: var(--subtle); text-decoration: line-through; }
.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 0.76rem;
  color: var(--muted);
}
.status {
  font-weight: 500;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
}
.task.completed .status { background: var(--accent-soft); color: var(--accent); }

.icon-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.icon-btn svg { width: 16px; height: 16px; }
.task:hover .icon-btn, .icon-btn:focus-visible { opacity: 1; }
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }
@media (hover: none) { .icon-btn { opacity: 1; } }

/* メモ一覧 */
.memo-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.memo {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
}
.memo-title { font-weight: 700; word-break: break-word; }
.memo-content {
  margin-top: 4px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
}
.memo-date { margin-top: 8px; font-size: 0.76rem; color: var(--muted); }

/* ダッシュボード：最新の振り返り */
.stat-review { grid-column: 1 / -1; }
.stat-review-head { display: flex; align-items: baseline; gap: 10px; }
.stat-review-head .stat-note { margin-top: 0; }
.latest-review {
  margin: 8px 0 10px;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.latest-review.is-empty { color: var(--subtle); font-size: 0.9rem; }
.link {
  align-self: flex-start;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
}
.link:hover { text-decoration: underline; }

/* 週次の振り返り */
.review-panel { margin-top: 24px; scroll-margin-top: 24px; }
.review-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.field-label { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.memo-form .form-actions { align-items: center; gap: 12px; }
.form-hint { flex: 1; font-size: 0.78rem; color: var(--muted); }
.review-list { margin-top: 0; }
.review { cursor: pointer; transition: background 0.15s; }
.review:hover { background: var(--bg); }
.review.selected { background: var(--accent-soft); }

/* アニメーション */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.task.new, .memo.new { animation: fadeIn 0.25s ease; }

/* レスポンシブ */
@media (max-width: 800px) {
  .container { padding: 24px 16px 48px; }
  .columns, .review-layout { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr 1fr; }
  .stat-accent { grid-column: 1 / -1; }
  .brand { display: none; }
}
