:root {
  --navy: #23365c;
  --accent: #3f6bb5;
  --ink: #1c2536;
  --ink-soft: #5b6779;
  --ink-faint: #8a95a5;
  --line: #dde4ee;
  --panel: #ffffff;
  --card: #f1f5fa;
  --amber: #b4740f;
  --amber-bg: #fdf3e1;
  --green: #1f7a4d;
  --green-bg: #e6f5ec;
  --red: #b3374a;
  --violet: #6a4fa3;
  --violet-bg: #f0ebfa;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Yu Gothic UI", "Hiragino Sans", sans-serif;
  background: #eaeef5;
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ヘッダー */
header {
  background: linear-gradient(120deg, var(--navy), #35507f);
  color: #fff;
  padding: 22px 24px;
}

header h1 {
  max-width: 880px;
  margin: 0 auto;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 16px 72px;
}

/* ダッシュボード */
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.stat {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 14px 18px;
  text-align: center;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(35, 54, 92, 0.05);
}

/* カード上端のアクセントライン */
.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
}

/* 上端ラインの色はカードの種類に合わせる（完了=緑、未完了=赤） */
.stat:has(.stat-value.done)::before { background: var(--green); }
.stat:has(.stat-value.alert)::before { background: var(--red); }

.stat-value {
  display: block;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.stat-value.done { color: var(--green); }
.stat-value.alert { color: var(--red); }

.stat-label {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

/* デモモードの注意書き */
.demo-banner {
  margin: 0 0 20px;
  padding: 11px 15px;
  font-size: 13px;
  color: var(--amber);
  background: var(--amber-bg);
  border: 1px solid #f0dcae;
  border-radius: var(--radius);
}

.demo-banner strong { font-weight: 700; }

/* ダッシュボード内の「最新の振り返り」 */
.latest {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--violet);
  border-radius: var(--radius);
  padding: 15px 18px;
  margin-bottom: 28px;
  box-shadow: 0 1px 2px rgba(35, 54, 92, 0.05);
}

.latest-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--violet);
}

.latest-week {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.latest-comment {
  margin: 5px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.latest-empty {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--ink-faint);
}

/* パネル */
.columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px 24px;
  box-shadow: 0 1px 2px rgba(35, 54, 92, 0.05);
}

.panel h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 30px 0 12px;
}

.panel h2::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
}

.panel h2:first-child { margin-top: 0; }

/* フォーム */
form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

input[type="text"], textarea, select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

input[type="text"]::placeholder, textarea::placeholder { color: var(--ink-faint); }

input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(63, 107, 181, 0.15);
}

select { cursor: pointer; }

/* 入力欄の下の補足文 */
.hint {
  margin: -2px 0 0;
  font-size: 12px;
  color: var(--amber);
}

.hint:empty { display: none; }

button {
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  background: var(--navy);
  color: #fff;
  transition: background 0.15s, transform 0.05s;
}

button:hover { background: var(--accent); }
button:active { transform: translateY(1px); }

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 一覧 */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 13px 15px;
  margin-bottom: 9px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.list li:last-child { margin-bottom: 0; }

.list li:hover {
  box-shadow: 0 2px 8px rgba(35, 54, 92, 0.09);
}

/* タスクは状態で左端の色を変える */
#taskList li { border-left-color: var(--amber); }
#taskList li.task-done { border-left-color: var(--green); }
#reviewList li { border-left-color: var(--violet); }

.item-title {
  font-weight: 600;
  font-size: 15px;
  word-break: break-word;
}

.item-body {
  margin: 7px 0 0;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
}

.item-meta {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--amber-bg);
  color: var(--amber);
}

.badge.done {
  background: var(--green-bg);
  color: var(--green);
}

.badge.week {
  background: var(--violet-bg);
  color: var(--violet);
}

.task-done .item-title {
  text-decoration: line-through;
  text-decoration-color: var(--ink-faint);
  color: var(--ink-faint);
}

/* 操作ボタンは右端にまとめる */
.item-meta button {
  padding: 4px 12px;
  font-size: 12px;
  background: #fff;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.item-meta button:first-of-type { margin-left: auto; }

.item-meta button:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.item-meta button.danger:hover {
  background: var(--red);
  border-color: var(--red);
}

/* 空のとき（.list li より詳細度を上げて上書きする） */
.list li.empty {
  color: var(--ink-faint);
  font-size: 13px;
  text-align: center;
  padding: 22px 10px;
  background: var(--card);
  border: 1px dashed #d5dce7;
  border-radius: 8px;
}

@media (max-width: 560px) {
  .dashboard { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 16px 8px 14px; }
  .stat-value { font-size: 27px; }
  .panel { padding: 18px 16px 20px; }
  form { align-items: stretch; }
}
