:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e6eaf0;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --green: #10b981;
  --green-soft: #ecfdf5;
  --orange: #f97316;
  --orange-soft: #fff7ed;
  --danger: #ef4444;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "BIZ UDPGothic", "Meiryo", "Hiragino Kaku Gothic ProN", "YuGothic UI",
               "Yu Gothic Medium", system-ui, -apple-system, sans-serif;
  font-weight: 500;
  background: var(--bg);
  background-image: radial-gradient(circle at 20% 0%, #e7ecf6 0%, transparent 45%),
                    radial-gradient(circle at 100% 0%, #e9f6f1 0%, transparent 40%);
  color: var(--text);
  line-height: 1.7;
}

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

.app-header-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-logo {
  font-size: 1.9rem;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  backdrop-filter: blur(4px);
  flex-shrink: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app-subtitle {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.82);
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 18px 72px;
}

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

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

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

.stat-icon {
  font-size: 1.5rem;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  flex-shrink: 0;
}

.stat-card.accent {
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 70%);
  border-color: #fed7aa;
}

.stat-card.accent .stat-icon {
  background: var(--orange-soft);
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

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

.stat-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 2px;
}

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

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

.latest-review-icon {
  font-size: 1.2rem;
}

.latest-review-title {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
}

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

.latest-review-body {
  font-size: 0.97rem;
  font-weight: 500;
  white-space: pre-wrap;
  word-break: break-word;
  color: rgba(255, 255, 255, 0.95);
}

.latest-review-body.is-empty {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 500;
}

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

.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: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.panel-icon {
  font-size: 1.1rem;
}

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

.add-form input,
.add-form textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface-soft);
  color: var(--text);
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

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

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

.add-form button {
  align-self: flex-start;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
}

.add-form button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.32);
}

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

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

.list .empty {
  color: var(--text-faint);
  font-size: 0.9rem;
  text-align: center;
  padding: 28px 0;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

/* メモ項目 */
.memo-item {
  position: relative;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px 14px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s;
}

.memo-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: var(--primary);
}

.memo-item:hover,
.task-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #d9dfe8;
}

.memo-item .memo-title {
  font-weight: 700;
  margin-bottom: 4px;
  word-break: break-word;
}

.memo-item .memo-content {
  white-space: pre-wrap;
  word-break: break-word;
  color: #475569;
  font-size: 0.95rem;
  font-weight: 500;
}

.item-meta {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* タスク項目 */
.task-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px 14px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s;
}

.task-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: var(--green);
}

.task-item.done {
  background: #fbfcfe;
}

.task-item.done::before {
  background: var(--text-faint);
}

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

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

.task-item .task-title {
  word-break: break-word;
  font-weight: 700;
  font-size: 0.98rem;
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--text-faint);
  font-weight: 400;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.badge.open {
  background: var(--orange-soft);
  color: #c2410c;
}

.badge.done {
  background: var(--green-soft);
  color: #047857;
}

/* 削除ボタン */
.del-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 7px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.del-btn:hover {
  color: var(--danger);
  background: #fef2f2;
}

/* ===== 週次振り返り ===== */
.review-panel {
  margin-top: 22px;
}

.review-form .review-week-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-form .review-week-row label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.review-form input[type="week"] {
  width: auto;
  flex: 0 0 auto;
}

.review-hint {
  margin: 2px 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-faint);
}

.review-item {
  position: relative;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px 14px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s;
}

.review-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: #7c3aed;
}

.review-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #d9dfe8;
}

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

.review-week-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: #6d28d9;
  background: #f3e8ff;
  padding: 3px 12px;
  border-radius: 999px;
}

.review-comment {
  white-space: pre-wrap;
  word-break: break-word;
  color: #475569;
  font-size: 0.95rem;
  font-weight: 500;
}

/* ===== レスポンシブ ===== */
@media (max-width: 720px) {
  .columns {
    grid-template-columns: 1fr;
  }
  .dashboard {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .app-header h1 {
    font-size: 1.3rem;
  }
}
