/* ---------- 色の定義（ライト / ダーク） ---------- */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e6e8ec;
  --text: #1c1f24;
  --muted: #6b7280;
  --faint: #9ca3af;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --success: #15803d;
  --success-soft: #e7f6ec;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1a1d23;
    --border: #2a2e36;
    --text: #e8eaed;
    --muted: #9aa1ac;
    --faint: #6b7280;
    --accent: #8b85ff;
    --accent-soft: #25244a;
    --danger: #f87171;
    --danger-soft: #3a1f22;
    --success: #4ade80;
    --success-soft: #16301f;
    --shadow: none;
  }
}

/* ---------- ベース ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2 { margin: 0; letter-spacing: 0.02em; }
h2 { font-size: 15px; font-weight: 600; }

/* ---------- ヘッダー ---------- */
.header { margin-bottom: 28px; }
.header h1 { font-size: 28px; font-weight: 700; }
.eyebrow {
  margin: 0 0 2px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- ダッシュボード ---------- */
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-value.accent { color: var(--accent); }
.stat-value.success { color: var(--success); }
.stat-sub { font-size: 12px; color: var(--faint); margin-top: 6px; }

/* 最新の振り返り（ダッシュボード横幅いっぱい） */
.latest-review { grid-column: 1 / -1; }
.latest-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.link:hover { text-decoration: underline; }
.latest-week { font-size: 13px; font-weight: 600; }
.latest-comment {
  margin-top: 4px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.latest-empty { font-size: 14px; color: var(--faint); }

/* ---------- 週次振り返り ---------- */
.reviews { margin-top: 40px; scroll-margin-top: 20px; }

.week-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.week-label {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.week-tag:empty { display: none; }
.week-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.btn-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
}
.btn-icon:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.btn-icon:disabled { opacity: 0.3; cursor: default; }

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.hint { font-size: 12px; color: var(--faint); }

.review-week { font-weight: 600; font-size: 14px; }
.review-actions { display: flex; gap: 2px; flex-shrink: 0; }
.btn-ghost.edit:hover { background: var(--accent-soft); color: var(--accent); }

.progress {
  height: 6px;
  background: var(--accent-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ---------- 2カラム ---------- */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 760px) {
  .container { padding-top: 24px; }
  .columns { grid-template-columns: minmax(0, 1fr); }
  .dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 26px; }
}
@media (max-width: 420px) {
  .container { padding: 20px 14px 48px; }
  .dashboard { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .card { padding: 16px; }
}
.column { min-width: 0; }
input, textarea { min-width: 0; width: 100%; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 { margin-bottom: 14px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 28px 0 12px;
}
.chip {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 9px;
}

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

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

button {
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 10px 18px;
}
.btn-primary:hover { opacity: 0.9; }

.btn-ghost {
  background: transparent;
  color: var(--faint);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  flex-shrink: 0;
}
.btn-ghost:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- 一覧 ---------- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.list li.empty {
  justify-content: center;
  color: var(--faint);
  font-size: 13px;
  background: transparent;
  border-style: dashed;
  padding: 24px;
}

.item-main { flex: 1; min-width: 0; }
.date { font-size: 12px; color: var(--faint); margin-top: 4px; }

/* メモ */
.memo-title { font-weight: 600; font-size: 15px; word-break: break-word; }
.memo-body {
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}

/* タスク */
.task { align-items: center; }
.check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  display: grid;
  place-items: center;
}
.check:hover { border-color: var(--accent); }
.check svg { width: 12px; height: 12px; opacity: 0; }
.task.done .check { background: var(--accent); border-color: var(--accent); }
.task.done .check svg { opacity: 1; }

.task-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-text { font-size: 15px; word-break: break-word; }
.task.done .task-text { color: var(--faint); text-decoration: line-through; }

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.task.done .badge { background: var(--success-soft); color: var(--success); }
