:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --border: #e8eaf1;
  --border-strong: #d6dae6;
  --text: #1f2733;
  --text-muted: #6b7385;
  --text-faint: #9aa1b2;
  --brand: #4f46e5;
  --brand-strong: #4338ca;
  --brand-soft: #eef0fe;
  --success: #16a34a;
  --success-soft: #e7f6ec;
  --warn: #e11d48;
  --warn-soft: #fdecef;
  --shadow-sm: 0 1px 2px rgba(23, 31, 51, 0.06);
  --shadow-md: 0 6px 20px rgba(23, 31, 51, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* ヘッダー */
.site-header {
  background: linear-gradient(120deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  padding: 26px 24px;
  box-shadow: var(--shadow-md);
}

.site-header h1 {
  max-width: 960px;
  margin: 0 auto;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

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

.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), #7c3aed);
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-num {
  font-size: 38px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--brand), #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* 2カラム */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

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

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

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel h2 {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

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

.form input,
.form textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease;
}

.form input::placeholder,
.form textarea::placeholder {
  color: var(--text-faint);
}

.form textarea {
  min-height: 160px;
  line-height: 1.7;
}

.form input:focus,
.form textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}

.form button {
  align-self: flex-start;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.28);
  transition: background 0.15s ease, transform 0.12s ease,
    box-shadow 0.15s ease;
}

.form button:hover {
  background: var(--brand-strong);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.34);
}

.form button:active {
  transform: translateY(1px);
}

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

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  background: var(--surface-2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.12s ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.card-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
}

.card-body {
  font-size: 14px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.card-meta {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.empty {
  color: var(--text-faint);
  font-size: 14px;
  text-align: center;
  padding: 28px 0;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

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

.task input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  margin-top: 2px;
  width: 20px;
  height: 20px;
  flex: none;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.task input[type="checkbox"]:checked {
  background: var(--success);
  border-color: var(--success);
}

.task input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-main {
  flex: 1;
}

.task-text {
  font-weight: 600;
  font-size: 14.5px;
}

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

.badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: 8px;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.badge.open {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.done {
  background: var(--success-soft);
  color: var(--success);
}

.btn-del {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  flex: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-del:hover {
  background: var(--warn-soft);
  color: var(--warn);
}

/* 最新の振り返り（ダッシュボード下） */
.latest-review {
  margin-bottom: 30px;
  padding: 20px 22px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(120deg, #4f46e5 0%, #7c3aed 100%);
  box-shadow: var(--shadow-md);
}

.latest-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.latest-review-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.latest-review-week {
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.latest-review-body {
  font-size: 14.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.latest-review-body.is-empty {
  opacity: 0.85;
  font-size: 13.5px;
}

/* 振り返りパネル */
.review-panel {
  margin-top: 22px;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: -4px;
}

.form input[type="week"] {
  align-self: flex-start;
  min-width: 200px;
}
