:root {
  --bg: #eef1f7;
  --surface: #ffffff;
  --surface-muted: #f4f6fb;
  --surface-muted-hover: #eaeef8;
  --border: #e3e7f0;
  --border-strong: #d6dbe8;
  --text: #1c2233;
  --text-muted: #6b7284;
  --text-faint: #9aa1b4;
  --accent: #4f5fed;
  --accent-dark: #3d4bd6;
  --accent-soft: #eef0fe;
  --success: #17a673;
  --success-dark: #128a5f;
  --success-soft: #e6f7f1;
  --danger: #e34d5c;
  --danger-dark: #c73948;
  --danger-soft: #fdecee;
  --shadow-sm: 0 1px 2px rgba(23, 28, 51, 0.05);
  --shadow-md: 0 8px 24px rgba(23, 28, 51, 0.07);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, #f4f6ff 0%, transparent 45%),
    radial-gradient(circle at 90% 10%, #eef8f4 0%, transparent 40%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px 70px;
}

header {
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
}

header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
}

.header-icon {
  font-size: 1.5rem;
}

/* ---------- ダッシュボード ---------- */

.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

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

.stat-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.25rem;
  background: var(--accent-soft);
}

.stat-icon--task {
  background: var(--success-soft);
}

.stat-icon--completed {
  background: #fff3e2;
}

.stat-icon--pending {
  background: #fde8ea;
}

.stat-number {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

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

/* ---------- 今週の振り返り(ダッシュボード) ---------- */

.latest-reflection-card {
  background: linear-gradient(135deg, var(--accent) 0%, #7b6ef0 100%);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  color: #fff;
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
}

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

.latest-reflection-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.reflection-week {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 10px;
  border-radius: 999px;
}

.latest-reflection-comment {
  margin: 0 0 6px;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: rgba(255, 255, 255, 0.96);
}

.latest-reflection-card .item-meta {
  color: rgba(255, 255, 255, 0.75);
}

/* ---------- レイアウト ---------- */

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

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

.panel-header {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

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

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

/* ---------- フォーム ---------- */

.note-form,
.task-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

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

input[type="text"],
textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.task-form input[type="text"] {
  flex: 1;
}

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

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

button:active {
  transform: scale(0.98);
}

/* ---------- 一覧 ---------- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.list::-webkit-scrollbar {
  width: 6px;
}

.list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
}

.note-item {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.note-item:hover {
  background: var(--surface-muted-hover);
}

.note-item .note-title {
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.note-item .note-body {
  white-space: pre-wrap;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 8px;
}

.item-meta {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-weight: 500;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  transition: background 0.15s ease;
}

.task-item:hover {
  background: var(--surface-muted-hover);
}

.task-item.done {
  border-left-color: var(--border-strong);
}

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

.task-title {
  flex: 1;
  font-weight: 500;
  font-size: 0.93rem;
}

.task-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.task-actions button {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-delete {
  background: var(--danger-soft);
  color: var(--danger-dark);
}

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

.btn-toggle {
  background: var(--success-soft);
  color: var(--success-dark);
}

.btn-toggle:hover {
  background: var(--success);
  color: #fff;
}

.task-item.done .btn-toggle {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}

.reflection-panel {
  margin-top: 20px;
}

.reflection-form {
  flex-direction: column;
}

.reflection-item {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-left: 3px solid #7b6ef0;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: background 0.15s ease;
}

.reflection-item:hover {
  background: var(--surface-muted-hover);
}

.reflection-item-week {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--accent-dark);
  margin-bottom: 4px;
}

.reflection-item-comment {
  white-space: pre-wrap;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 8px;
}

.empty {
  color: var(--text-faint);
  font-size: 0.88rem;
  text-align: center;
  padding: 24px 0;
}
