:root {
  --bg: #eef1f7;
  --bg-grad-1: #6366f1;
  --bg-grad-2: #8b5cf6;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --border: #e8ebf2;
  --text: #1f2430;
  --text-soft: #6b7280;
  --text-faint: #9aa1ad;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-soft: #eef0fe;
  --danger: #ef4444;
  --success: #10b981;
  --warn: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 6px 24px rgba(31, 36, 48, 0.08);
  --shadow-sm: 0 2px 8px rgba(31, 36, 48, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo",
    system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== ヘッダー ===== */
.app-header {
  background: linear-gradient(135deg, var(--bg-grad-1), var(--bg-grad-2));
  color: #fff;
  padding: 28px 24px 56px;
  position: relative;
}

.app-header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  font-size: 34px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.18);
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  backdrop-filter: blur(4px);
}

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

.brand-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
}

.mode-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.16);
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ===== コンテナ ===== */
.container {
  max-width: 960px;
  margin: -36px auto 0;
  padding: 0 24px 48px;
  /* ヘッダー(position:relative)より前面に置き、
     浮かせたカードの上部がヘッダーに隠れないようにする */
  position: relative;
  z-index: 1;
}

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

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

.stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(31, 36, 48, 0.12);
}

.stat-icon {
  font-size: 22px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-memo .stat-icon {
  background: #eef2ff;
}
.stat-task .stat-icon {
  background: #ecfdf5;
}
.stat-done .stat-icon {
  background: #fff7ed;
}
.stat-pending .stat-icon {
  background: #fef2f2;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-soft);
  margin-top: 2px;
}

/* ===== 最新の振り返り（ダッシュボード） ===== */
.latest-review {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

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

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

.latest-review-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 0.02em;
}

.latest-review-week {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

.latest-review-body {
  font-size: 15px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.7;
}

.latest-review-body.is-empty {
  color: var(--text-faint);
  font-size: 14px;
}

/* ===== パネル ===== */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

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

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

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

.panel-icon {
  font-size: 18px;
}

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

.inline-form {
  display: flex;
  gap: 10px;
}

.inline-form input {
  flex: 1;
}

.form input,
.form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px 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;
}

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

.form input:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}

/* ===== ボタン ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.32);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.42);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary span {
  font-size: 16px;
  line-height: 1;
}

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

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

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}

.review-form-row input[type="week"] {
  padding: 10px 12px;
  border: 1.5px 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;
}

.review-form-row input[type="week"]:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}

.field-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-faint);
}

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

.badge-week {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.review-comment {
  white-space: pre-wrap;
  font-size: 14.5px;
  color: #374151;
  line-height: 1.7;
  margin-bottom: 8px;
}

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

.list li {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--surface-soft);
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
  animation: fadeIn 0.25s ease;
}

.list li:hover {
  box-shadow: var(--shadow-sm);
  border-color: #dfe3ee;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* メモ */
.memo-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.memo-content {
  white-space: pre-wrap;
  font-size: 14px;
  color: #374151;
  margin-bottom: 8px;
}

.meta {
  font-size: 12px;
  color: var(--text-faint);
}

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

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

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

.task-text {
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

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

.task-done {
  background: #fbfdfb;
}

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

.badge-todo {
  background: #fef2f2;
  color: var(--danger);
}

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

/* 削除ボタン */
.del-btn {
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}

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

.list-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

/* 空表示 */
.empty {
  color: var(--text-faint);
  font-size: 14px;
  text-align: center;
  padding: 28px 10px;
  background: var(--surface-soft) !important;
  border: 1px dashed var(--border) !important;
}

/* フッター */
.app-footer {
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 32px;
}

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