* {
  box-sizing: border-box;
}

:root {
  --indigo: #4c56d6;
  --indigo-dark: #3a43b0;
  --blue: #2f56e0;
  --red: #e23b52;
  --green: #23a559;
  --ink: #1c2140;
  --muted: #6b7186;
  --line: #e7eaf3;
  --card: #ffffff;
  --bg: #eef1f8;
  --shadow-sm: 0 1px 2px rgba(28, 33, 64, 0.06);
  --shadow-md: 0 6px 18px rgba(28, 33, 64, 0.08);
  --shadow-lg: 0 14px 34px rgba(28, 33, 64, 0.12);
  --radius: 16px;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    Meiryo, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, #e9ecfb 0%, rgba(233, 236, 251, 0) 55%),
    radial-gradient(1000px 500px at -10% 0%, #eef0fc 0%, rgba(238, 240, 252, 0) 50%),
    var(--bg);
  min-height: 100vh;
}

/* ───────── ヘッダー ───────── */
.site-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(8px);
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.site-header h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-header .subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.container {
  max-width: 840px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

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

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

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

.stat-card:nth-child(3)::before {
  background: linear-gradient(90deg, var(--red), #f08a8a);
}

.stat-card:nth-child(4)::before {
  background: linear-gradient(90deg, var(--green), #57c98a);
}

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

.stat-value {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

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

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

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

.stat-label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 10px;
}

/* ───────── 最新の振り返り（ダッシュボード） ───────── */
.latest-review {
  position: relative;
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 30px;
  color: #fff;
  background: linear-gradient(135deg, #4c56d6 0%, #6b74e8 55%, #8a7bf0 100%);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.latest-review::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.latest-review-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.latest-review-icon {
  font-size: 16px;
}

.latest-review-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.95;
}

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

.latest-review-body {
  position: relative;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  z-index: 1;
}

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

/* ───────── カード（メモ追加・タスク追加） ───────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-md);
}

.card h2 {
  margin: 0 0 18px;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* セクション見出し（メモ一覧・タスク一覧） */
.section-title {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ───────── フォーム ───────── */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form input[type="week"] {
  max-width: 220px;
}

.form input,
.form textarea,
.form-inline input {
  padding: 12px 14px;
  border: 1px solid #d7dced;
  border-radius: 11px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  background: #fbfcff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form textarea {
  resize: vertical;
  min-height: 84px;
}

.form input::placeholder,
.form textarea::placeholder,
.form-inline input::placeholder {
  color: #9aa1b6;
}

.form input:focus,
.form textarea:focus,
.form-inline input:focus {
  outline: none;
  background: #fff;
  border-color: var(--indigo);
  box-shadow: 0 0 0 4px rgba(76, 86, 214, 0.14);
}

.actions {
  display: flex;
  justify-content: flex-end;
}

button {
  background: linear-gradient(180deg, var(--indigo), var(--indigo-dark));
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(76, 86, 214, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 6px 16px rgba(76, 86, 214, 0.34);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 3px 9px rgba(76, 86, 214, 0.28);
}

/* タスク追加（横並び） */
.form-inline {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form-inline input {
  flex: 1;
}

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

.list li {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 18px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--indigo), #7b83f0);
}

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

.memo-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 5px;
}

.memo-body {
  white-space: pre-wrap;
  font-size: 14px;
  color: #3b4160;
  margin-bottom: 8px;
  line-height: 1.6;
}

.meta {
  font-size: 12px;
  color: #9198ae;
}

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

.list li.task-item::before {
  background: linear-gradient(180deg, var(--green), #57c98a);
}

.list li.task-item.done::before {
  background: linear-gradient(180deg, #b7bdcf, #cdd2df);
}

.task-item input[type="checkbox"] {
  margin-top: 2px;
  width: 19px;
  height: 19px;
  cursor: pointer;
  accent-color: var(--indigo);
  flex: none;
}

.task-main {
  flex: 1;
}

.task-text {
  font-size: 15px;
  font-weight: 500;
}

.task-item.done .task-text {
  text-decoration: line-through;
  color: #9aa0b4;
  font-weight: 400;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.badge.done {
  background: #e4f6ec;
  color: #1f8a4c;
}

.badge.todo {
  background: #fdefe1;
  color: #c26a17;
}

.delete-btn {
  background: transparent;
  border: none;
  color: #b9bfd0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
  box-shadow: none;
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.delete-btn:hover {
  color: var(--red);
  background: #fdecef;
  transform: none;
  box-shadow: none;
  filter: none;
}

/* 振り返り項目 */
.list li.review-item::before {
  background: linear-gradient(180deg, #7b83f0, #b39bf2);
}

.review-week {
  font-weight: 700;
  font-size: 15px;
  color: var(--indigo-dark);
  margin-bottom: 6px;
}

.review-comment {
  white-space: pre-wrap;
  font-size: 14px;
  color: #3b4160;
  line-height: 1.65;
  margin-bottom: 8px;
}

/* 空表示 */
.empty {
  border: 1px dashed #cfd5e6 !important;
  background: rgba(255, 255, 255, 0.5) !important;
  box-shadow: none !important;
  padding: 20px !important;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.empty::before {
  display: none;
}

/* ───────── レスポンシブ ───────── */
@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .dashboard {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .container {
    padding: 24px 16px 48px;
  }
}
