:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --line: #e3e7ef;
  --accent: #2f6df6;
  --accent-soft: #eaf0ff;
  --danger: #d94848;
  --done: #10a37f;
  --warn: #b45309;
  --warn-soft: #fff7e6;
  --warn-line: #f5d9a8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px 16px 64px;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.65;
}

main { max-width: 1000px; margin: 0 auto; }

.page-header {
  max-width: 1000px;
  margin: 0 auto 20px;
}
.page-header h1 { margin: 0; font-size: 28px; letter-spacing: .02em; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

/* ダッシュボード：左=メモ / 右=タスク系を縦並び */
.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.stat-group {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
}
.stat-done { background: #eef9f5; border-color: #c6e8dc; }
.stat-warn { background: var(--warn-soft); border-color: var(--warn-line); }
.stat-label { font-size: 15px; color: var(--muted); }
.stat-value { font-size: 34px; font-weight: 700; line-height: 1.2; }
.stat-memo .stat-value { font-size: 40px; }
.stat-done .stat-value { color: var(--done); }
.stat-warn .stat-value { color: var(--warn); }

/* 最新の振り返り（ダッシュボードの下段・横幅いっぱい） */
.stat-latest {
  grid-column: 1 / -1;
  align-items: stretch;
  text-align: left;
  gap: 4px;
}
.stat-latest .stat-label { text-align: center; }
.latest-week { font-size: 16px; font-weight: 700; color: var(--accent); text-align: center; }
.latest-comment {
  margin: 4px 0 0;
  font-size: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  /* 長い振り返りはダッシュボードでは3行までにとどめる */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* レイアウト */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.card h2 { margin: 0 0 10px; font-size: 18px; }
.card-wide { margin-top: 16px; }
.list-heading { margin-top: 22px !important; padding-top: 16px; border-top: 1px solid var(--line); }

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

.field-label { font-size: 15px; color: var(--muted); }

/* 保存できたことを伝えるメッセージ（警告ではないので緑系） */
.form-status {
  margin: 0;
  font-size: 15px;
  color: var(--done);
  font-weight: 600;
}

input, textarea, select {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: inherit;
  resize: vertical;
}
select { cursor: pointer; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  background: #fff;
}

/* 振り返りの一覧は2列に並べる（項目が増えても縦に伸びすぎないように） */
#reflectionList { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 760px) {
  #reflectionList { grid-template-columns: 1fr; }
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
button:hover { filter: brightness(1.06); }

/* 一覧 */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  background: #fcfdff;
}
.item-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: space-between;
}
.item-title { font-weight: 600; word-break: break-word; }
.item-body {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 16px;
}
.item-meta { font-size: 14px; color: var(--muted); margin-top: 6px; }

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

.badge {
  font-size: 14px;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--accent-soft);
  color: var(--accent);
}
.badge-done { background: #e3f6ef; color: var(--done); }

.actions { display: flex; gap: 6px; margin-top: 8px; }
.btn-small {
  padding: 5px 12px;
  font-size: 15px;
  font-weight: 500;
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}
.btn-toggle { color: var(--done); border-color: #bfe6d8; }
.btn-delete { color: var(--danger); border-color: #f0cfcf; }

.empty { color: var(--muted); font-size: 16px; padding: 6px 2px; }

.error-bar {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fdeaea;
  border: 1px solid #f3c9c9;
  color: #a02c2c;
  font-size: 16px;
}

@media (max-width: 760px) {
  .columns { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr; }
}
