* {
  box-sizing: border-box;
}

:root {
  --bg: #eef1fa;
  --bg-accent1: #dfe7fb;
  --bg-accent2: #fde8f3;
  --surface: #ffffff;
  --text: #1f2333;
  --text-muted: #6b7280;
  --border: #e6e8f0;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef0ff;
  --accent-green: #10b981;
  --accent-green-light: #ecfdf5;
  --accent-amber: #f59e0b;
  --accent-amber-light: #fffbeb;
  --danger: #ef4444;
  --shadow: 0 4px 16px rgba(76, 81, 148, 0.08);
  --shadow-hover: 0 8px 24px rgba(76, 81, 148, 0.14);
  --radius: 14px;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", -apple-system, sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--bg-accent1), transparent),
    radial-gradient(1000px 500px at 100% 0%, var(--bg-accent2), transparent),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.header-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

header h1 {
  font-size: 26px;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--primary-dark), #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.header-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

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

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

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

.stat-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 20px;
}

.stat-notes .stat-icon {
  background: var(--primary-light);
}

.stat-tasks .stat-icon {
  background: var(--accent-green-light);
}

.stat-pending .stat-icon {
  background: var(--accent-amber-light);
}

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

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

.latest-reflection {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #f5f3ff, #fdf2f8);
  border: 1px solid #e9defc;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}

.latest-reflection-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 12px;
  background: #fff;
}

.latest-reflection-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.latest-reflection-week {
  font-size: 15px;
  font-weight: 700;
  margin-top: 2px;
  color: var(--text);
}

.latest-reflection-comment {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.panel-wide {
  grid-column: 1 / -1;
}

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

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

.panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  font-size: 17px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

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

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

.form input,
.form textarea {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: #fafbff;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.form input:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.form button {
  align-self: flex-start;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

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

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
}

.item {
  border: 1px solid var(--border);
  background: #fbfcff;
  border-radius: 12px;
  padding: 12px 14px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.item:hover {
  box-shadow: 0 2px 10px rgba(76, 81, 148, 0.1);
  border-color: #d9dcf5;
}

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

.item-body {
  font-size: 13px;
  color: #4b5060;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 8px;
  line-height: 1.5;
}

.item-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.task-item input[type="checkbox"] {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
}

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

.task-item.done .item-title {
  text-decoration: line-through;
  color: #a3a7b7;
}

.task-body {
  flex: 1;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-amber-light);
  color: #b45309;
}

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

.delete-btn {
  border: none;
  background: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  transition: background 0.12s ease;
}

.delete-btn:hover {
  background: #fef2f2;
  text-decoration: none;
}

.edit-btn {
  border: none;
  background: none;
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  transition: background 0.12s ease;
}

.edit-btn:hover {
  background: var(--primary-light);
}

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-form .edit-title,
.edit-form .edit-body {
  padding: 8px 10px;
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: #fff;
}

.edit-form .edit-title:focus,
.edit-form .edit-body:focus {
  outline: none;
}

.edit-actions {
  display: flex;
  gap: 8px;
}

.edit-actions button {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  border: none;
}

.edit-actions button[type="submit"] {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

.cancel-btn {
  background: #f1f2f6;
  color: var(--text-muted);
}

.cancel-btn:hover {
  background: #e5e7f0;
}

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