:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e2e6ec;
  --text: #22272e;
  --muted: #6b7684;
  --accent: #2f6fed;
  --accent-dark: #2559c4;
  --danger: #d94848;
  --done: #12996b;
}

* { box-sizing: border-box; }

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

.site-header {
  background: var(--accent);
  color: #fff;
  padding: 18px 24px;
}
.site-header h1 { margin: 0; font-size: 20px; letter-spacing: .04em; }

main { max-width: 1000px; margin: 0 auto; padding: 24px 16px 60px; }

/* ダッシュボード */
.dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.stat-label { display: block; font-size: 13px; color: var(--muted); }
.stat-value { font-size: 32px; font-weight: 700; }
.stat-unit { font-size: 13px; color: var(--muted); margin-left: 2px; }
.stat-done .stat-value { color: var(--done); }

/* ダッシュボード：最新の振り返り */
.latest {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 24px;
}
.latest-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.latest-label { font-size: 13px; font-weight: 700; color: var(--accent); }
.latest-week { font-size: 13px; color: var(--muted); }
.latest-comment {
  margin: 4px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.latest-comment.is-empty { color: var(--muted); font-size: 14px; }

/* レイアウト */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 760px) {
  .dashboard { grid-template-columns: 1fr; }
  .columns { grid-template-columns: 1fr; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px 20px;
}
.panel h2 {
  font-size: 15px;
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
}
.panel h2:first-child { margin-top: 0; }
.panel-wide { margin-top: 16px; }

.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  border-radius: 10px;
  padding: 0 8px;
  vertical-align: middle;
}

/* フォーム */
.form { display: flex; flex-direction: column; gap: 8px; }
.form input, .form textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}
.form input:focus, .form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.form textarea { resize: vertical; }

/* 日付入力の行 */
.field { display: flex; align-items: center; gap: 8px; }
.field-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.field input[type="date"] { flex: 1; min-width: 0; }

.link-btn {
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 8px;
  cursor: pointer;
}
.link-btn:hover { background: #eef1f5; }
.form button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 9px;
  cursor: pointer;
}
.form button:hover { background: var(--accent-dark); }

/* 一覧 */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fdfdfe;
}
.item-title { font-weight: 600; word-break: break-word; }
.item-body {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 4px 0 0;
  color: #39414c;
}
.item-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* タスク行 */
.task-row { display: flex; align-items: flex-start; gap: 10px; }
.task-row input[type="checkbox"] { width: 18px; height: 18px; margin-top: 3px; cursor: pointer; }
.task-main { flex: 1; min-width: 0; }
.task-done .item-title { text-decoration: line-through; color: var(--muted); }
.status { font-weight: 600; }
.status-done { color: var(--done); }
.status-open { color: var(--danger); }

/* 期限 */
.due { font-weight: 600; }
.due-none { color: var(--muted); font-weight: normal; }
.due-flag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
}
.due-over { background: var(--danger); }
.due-today { background: #e08a1e; }

.delete-btn {
  font: inherit;
  font-size: 12px;
  color: var(--danger);
  background: transparent;
  border: 1px solid var(--danger);
  border-radius: 5px;
  padding: 3px 9px;
  cursor: pointer;
}
.delete-btn:hover { background: var(--danger); color: #fff; }

.empty { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.hint { color: var(--muted); font-size: 12px; margin: -2px 0 0; }

/* 添付ファイル */
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.thumb {
  display: block;
  width: 84px;
  height: 84px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #f0f2f5;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { border-color: var(--accent); }

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  background: #f7f9fc;
  word-break: break-all;
}
.file-link:hover { border-color: var(--accent); background: #eef3fd; }

/* 振り返り */
.review-week { font-weight: 700; }
.review-comment {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 4px 0 0;
}
.form button:disabled { background: #9db6ea; cursor: progress; }

.error {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  margin: 0;
}
