:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1f2430;
  --muted: #7c8595;
  --accent: #3b6ef5;
  --accent-soft: #eaf0ff;
  --danger: #d9534f;
  /* 入力欄は背景と見分けがつくよう、少し濃い色と枠線にする */
  --field-bg: #f2f4f8;
  --field-border: #b9c1cf;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  line-height: 1.6;
}

.header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
}

.header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.04em;
}

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

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

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-accent {
  background: var(--accent-soft);
  border-color: #cfdcff;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

/* 最新の振り返りカード（ダッシュボード内で横幅いっぱい） */
.stat-review {
  grid-column: 1 / -1;
}

.latest-week {
  font-size: 15px;
  font-weight: 700;
}

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

/* パネル */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
}

/* フォーム */
.form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-inline {
  flex-direction: row;
}

.form-inline input { flex: 1; }

.form-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.form-row input[type="week"] { width: auto; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.panel-wide { margin-top: 16px; }

input[type="text"], input[type="week"], textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: var(--field-bg);
  color: inherit;
  resize: vertical;
}

input::placeholder, textarea::placeholder {
  color: #98a1b0;
}

/* 入力中の欄は白くして、今どこに入力しているかを分かりやすくする */
input[type="text"]:focus, input[type="week"]:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
  background: #fff;
}

button {
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  white-space: nowrap;
}

button:hover { filter: brightness(1.08); }

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

.item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fcfcfd;
}

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

.item-body {
  margin: 4px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
}

.item-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* メモ行 */
.memo {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.memo-main { flex: 1; min-width: 0; }

/* タスク行 */
.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.task input[type="checkbox"] {
  margin-top: 4px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex: none;
}

.task-main { flex: 1; min-width: 0; }

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

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  line-height: 18px;
  border: 1px solid var(--border);
  background: #fff;
}

.badge-done {
  border-color: #bfe3c6;
  background: #eaf7ec;
  color: #2e7d3a;
}

.badge-open {
  border-color: #ffd9a8;
  background: #fff5e6;
  color: #a2610a;
}

/* 編集・削除ボタン */
.item-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}

.btn-edit, .btn-delete {
  background: #fff;
  border-color: var(--border);
  padding: 4px 10px;
  font-size: 12px;
  flex: none;
}

.btn-edit { color: var(--accent); }
.btn-delete { color: var(--danger); }

.btn-edit:hover {
  border-color: var(--accent);
  filter: none;
}

.btn-delete:hover {
  border-color: var(--danger);
  filter: none;
}

/* 編集中の行 */
.item.editing {
  background: #fff;
  border-color: var(--accent);
}

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-actions {
  display: flex;
  gap: 8px;
}

.edit-form button {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-cancel {
  background: #fff;
  color: var(--muted);
  border-color: var(--border);
}

.btn-cancel:hover {
  border-color: var(--muted);
  filter: none;
}

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

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