:root {
  --navy: #1f2a44;
  --navy-light: #2f3e5c;
  --orange: #f28c28;
  --orange-dark: #d9731a;
  --orange-soft: #fff3e6;
  --red: #d9534f;
  --green: #2e8b57;
  --green-soft: #e6f4ec;
  --purple: #6c63c9;
  --bg: #eef1f6;
  --surface: #ffffff;
  --item-bg: #f7f9fc;
  --border: #e2e6ee;
  --text: #1e2533;
  --text-sub: #6b7385;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 50, 0.04), 0 4px 16px rgba(20, 30, 50, 0.06);
}

* {
  box-sizing: border-box;
}

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

/* ヘッダー */
header {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: #fff;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 22px 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.today {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 16px 48px;
}

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

.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--navy-light);
}

.stat-accent::before {
  background: var(--orange);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

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

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

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

.card h2::before {
  content: "";
  width: 4px;
  height: 1.1em;
  border-radius: 2px;
  background: var(--orange);
}

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

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

.inline-form input {
  flex: 1;
}

input,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--item-bg);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input:focus,
textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(242, 140, 40, 0.18);
}

textarea {
  resize: vertical;
}

button {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: var(--orange);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

button:hover {
  background: var(--orange-dark);
}

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

/* 一覧：各項目を背景と区別できるカードにする */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list li {
  background: var(--item-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy-light);
  border-radius: 10px;
  padding: 12px 14px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.list li:hover {
  box-shadow: 0 2px 8px rgba(20, 30, 50, 0.08);
}

.list li.empty {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-sub);
  font-size: 0.9rem;
  text-align: center;
}

.list li.empty:hover {
  box-shadow: none;
}

.memo-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.memo-body {
  white-space: pre-wrap;
  margin: 0 0 6px;
  font-size: 0.92rem;
  color: #3a4252;
}

.meta {
  font-size: 0.78rem;
  color: var(--text-sub);
}

/* タスク */
.list li.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border-left-color: var(--orange);
}

.list li.task-item.done {
  background: #fafbfc;
  border-left-color: var(--green);
}

.task-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--green);
}

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

.task-text {
  font-weight: 600;
  word-break: break-word;
}

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

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  margin-right: 6px;
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.task-item.done .badge {
  background: var(--green-soft);
  color: var(--green);
}

.delete-btn {
  background: transparent;
  color: var(--red);
  border: 1px solid #efc2c0;
  padding: 4px 12px;
  font-size: 0.8rem;
}

.delete-btn:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* 最新の振り返り（ダッシュボード） */
.latest-review {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 22px;
  margin: -12px 0 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.latest-review::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--purple);
}

.latest-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.latest-week {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--purple);
}

.link-btn {
  margin-left: auto;
  padding: 0;
  background: none;
  color: var(--orange-dark);
  font-size: 0.85rem;
}

.link-btn:hover {
  background: none;
  text-decoration: underline;
}

.latest-comment {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-text {
  color: var(--text-sub);
  font-size: 0.9rem;
}

/* 週次の振り返り */
.review-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  background: var(--item-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.nav-btn {
  padding: 2px 14px;
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--border);
  font-size: 1.2rem;
  line-height: 1.4;
}

.nav-btn:hover {
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: #fff;
  color: var(--navy);
}

.week-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.week-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: #ecebfa;
  color: var(--purple);
}

.week-stats {
  margin: 10px 0 12px;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.review-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-actions .meta {
  flex: 1;
}

.review-actions .delete-btn {
  padding: 8px 14px;
}

.sub-heading {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--text-sub);
}

.list li.review-item {
  border-left-color: var(--purple);
  cursor: pointer;
}

.list li.review-item.active {
  background: #f4f3fd;
  border-color: #cfcbf2;
  border-left-color: var(--purple);
}

.review-comment {
  white-space: pre-wrap;
  margin: 0 0 6px;
  font-size: 0.92rem;
  color: #3a4252;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

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

  .dashboard {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat {
    padding: 14px 16px;
  }

  .stat-value {
    font-size: 1.6rem;
  }
}
