:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1f2430;
  --muted: #7a8195;
  --accent: #3b6ef5;
  --danger: #d9534f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
}

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

.site-header h1 {
  margin: 0;
  font-size: 20px;
}

main {
  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: 16px;
  text-align: center;
}

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

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

.stat-accent .stat-value { color: var(--accent); }

/* ダッシュボード内：最新の振り返り */
.latest-review {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 24px;
}

.latest-review-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.latest-review-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.latest-review-week {
  font-size: 13px;
  color: var(--muted);
}

.latest-review-body {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.latest-review-body.is-empty {
  color: var(--muted);
  font-size: 14px;
}

/* パネル */
.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: 16px;
}

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

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

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

.review-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
}

.review-controls label { color: var(--muted); }

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

select {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: inherit;
}

input, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: inherit;
  resize: vertical;
}

input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  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;
}

.item-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

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

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

.item-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eef1f6;
  color: var(--muted);
}

.badge-done {
  background: #e4f5e9;
  color: #2f7d4f;
}

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

.btn-link {
  background: none;
  color: var(--muted);
  padding: 2px 4px;
  font-size: 12px;
}

.btn-link:hover { color: var(--accent); }

.btn-danger { color: var(--danger); font-weight: 600; }
.btn-danger:hover { color: var(--danger); }

.delete-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

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

/* エラー表示 */
.toast {
  background: #fdecea;
  border: 1px solid #f5c2c0;
  color: #a12a26;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* タスク名をクリックしても完了を切り替えられる */
label.item-title { cursor: pointer; }

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

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