/* ===== デザイントークン ===== */
:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --text: #1f2733;
  --text-sub: #6b7684;
  --text-faint: #9aa4b2;
  --border: #e3e8ef;
  --primary: #4f7cff;
  --primary-dark: #3a63e0;
  --accent: #f5a623;
  --danger: #ef5350;
  --success: #2fb673;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 50, 0.06);
  --shadow: 0 6px 20px rgba(20, 30, 50, 0.08);
  --shadow-hover: 0 10px 28px rgba(20, 30, 50, 0.12);
  --ring: 0 0 0 3px rgba(79, 124, 255, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic",
    "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 50% -200px, #f4f7ff 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== ヘッダー ===== */
.app-header {
  padding: 28px 24px 22px;
  text-align: center;
}

.app-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

/* ===== ダッシュボード ===== */
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 24px 4px;
}

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

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--primary);
}

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

/* メモの件数カードは紫（他のブルーと区別） */
.stat-card.stat-memo::before {
  background: #8b5cf6;
}

.stat-card.stat-memo .stat-num {
  color: #8b5cf6;
}

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

.stat-num {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-card.highlight .stat-num {
  color: var(--accent);
}

.stat-label {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-sub);
}

/* ===== 最新の振り返り（ダッシュボード） ===== */
.latest-review-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 24px 0;
}

.latest-review {
  background: linear-gradient(135deg, #4f7cff 0%, #6a5cff 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: 0 8px 22px rgba(79, 124, 255, 0.28);
}

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

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

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

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

.latest-review-comment {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.latest-review-empty {
  font-size: 14px;
  opacity: 0.9;
}

/* ===== 週次振り返りセクション ===== */
.review-section {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px 56px;
}

.week-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
}

.week-label input[type="week"] {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-soft);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.week-label input[type="week"]:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: var(--ring);
}

#reviewList .item {
  border-left-color: #6a5cff;
}

/* ===== カラム ===== */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 24px 56px;
}

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

.panel h2 {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

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

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

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

.add-form input:focus,
.add-form textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.add-form button {
  align-self: flex-start;
  padding: 11px 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(79, 124, 255, 0.35);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.add-form button:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(79, 124, 255, 0.45);
}

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

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

.item {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* メモは青、未完了タスクはオレンジ、完了タスクはグレー */
#taskList .item {
  border-left-color: var(--accent);
}

.task-done {
  background: #f2f4f7;
  border-left-color: #c3cbd6 !important;
  opacity: 0.85;
}

.item-title {
  font-weight: 700;
  font-size: 15px;
  word-break: break-word;
}

.item-body {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--text-sub);
  white-space: pre-wrap;
  word-break: break-word;
}

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

.item-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.item-actions button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.item-actions button:hover {
  background: #f0f3f8;
}

.btn-danger {
  color: var(--danger);
  border-color: #f6c9c8 !important;
}

.btn-danger:hover {
  background: #fdecec !important;
}

.btn-done {
  color: var(--success);
  border-color: #b9e5cf !important;
}

.btn-done:hover {
  background: #e9f8f0 !important;
}

/* 完了済みタスク */
.task-done .item-title {
  text-decoration: line-through;
  color: var(--text-faint);
}

/* ===== バッジ ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-open {
  background: #fff1e0;
  color: #c9731a;
}

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

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

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

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