:root {
  --bg: #eef1f8;
  --bg-grad-1: #6366f1;
  --bg-grad-2: #8b5cf6;
  --surface: #ffffff;
  --surface-muted: #f7f8fc;
  --border: #e7e9f2;
  --text: #1f2440;
  --text-soft: #5b6178;
  --text-faint: #9aa0b5;
  --primary: #5b5bf0;
  --primary-dark: #4544d6;
  --accent: #ef6c3b;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #e11d48;
  --danger-bg: #ffe4e6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(31, 36, 64, 0.06), 0 2px 8px rgba(31, 36, 64, 0.05);
  --shadow-md: 0 8px 24px rgba(31, 36, 64, 0.10);
  --ring: 0 0 0 3px rgba(91, 91, 240, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(139, 92, 246, 0.10), transparent 60%),
    radial-gradient(1000px 500px at -10% 0%, rgba(99, 102, 241, 0.10), transparent 55%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- ヘッダー ---- */
.app-header {
  background: linear-gradient(120deg, var(--bg-grad-1), var(--bg-grad-2));
  color: #fff;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.25);
}

.app-header__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand__mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  font-size: 1.5rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.brand__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand__subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  opacity: 0.85;
  font-weight: 400;
}

.clock {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
  text-align: right;
  line-height: 1.4;
}

/* ---- レイアウト ---- */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

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

.stat {
  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:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat__icon--notes { background: #eef0ff; }
.stat__icon--tasks { background: #e7f3ff; }
.stat__icon--todo  { background: #fff0e8; }
.stat__icon--done  { background: #e7f8ee; }

.stat__value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text-soft);
}

/* ---- ダッシュボード：最新の振り返り ---- */
.latest-review {
  position: relative;
  overflow: hidden;
  margin-bottom: 30px;
  padding: 20px 24px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(120deg, #4f46e5, #7c3aed 60%, #9333ea);
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.28);
}

.latest-review::after {
  content: "🪞";
  position: absolute;
  right: -8px;
  bottom: -18px;
  font-size: 6rem;
  opacity: 0.12;
  transform: rotate(-8deg);
}

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

.latest-review__icon {
  font-size: 1.15rem;
}

.latest-review__title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
}

.latest-review__week {
  margin-left: auto;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.20);
  backdrop-filter: blur(4px);
}

.latest-review__body {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.7;
  white-space: pre-wrap;
  opacity: 0.96;
}

.latest-review--empty .latest-review__body {
  opacity: 0.8;
}

/* ---- 週次振り返りフォーム ---- */
.review-form__row {
  display: flex;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field--grow {
  flex: 1;
}

.field__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
}

.field .input {
  margin-bottom: 0;
}

input[type="week"].input {
  min-width: 168px;
}

.review-week-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  background: #eef0ff;
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 6px;
}

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

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

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card__title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  position: relative;
  padding-left: 12px;
}

.card__title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(var(--bg-grad-1), var(--bg-grad-2));
}

.count-pill {
  min-width: 26px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ---- フォーム ---- */
.form__inline {
  display: flex;
  gap: 10px;
}

.form__inline .input {
  margin: 0;
}

.form__inline .btn {
  flex-shrink: 0;
}

.form__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-muted);
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

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

.input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: var(--ring);
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  color: #fff;
  background: linear-gradient(120deg, var(--bg-grad-1), var(--bg-grad-2));
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.30);
}

.btn--primary:hover {
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.40);
}

.error {
  color: var(--danger);
  font-size: 0.82rem;
  margin: 8px 0 0;
  min-height: 1em;
}

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

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

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

.empty {
  border: 1px dashed var(--border) !important;
  background: transparent !important;
  color: var(--text-faint);
  font-size: 0.9rem;
  text-align: center;
  padding: 26px 12px !important;
}

.row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.note-title {
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.note-body {
  white-space: pre-wrap;
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.6;
  margin-bottom: 8px;
}

.meta {
  font-size: 0.74rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

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

.task-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 2px 0 0;
  width: 20px;
  height: 20px;
  border: 2px solid #c7cbdd;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}

.task-row input[type="checkbox"]:hover {
  border-color: var(--primary);
}

.task-row input[type="checkbox"]:checked {
  background: var(--success);
  border-color: var(--success);
}

.task-row input[type="checkbox"]:checked::after {
  content: "✓";
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

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

.task-title {
  font-weight: 500;
  font-size: 0.95rem;
}

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

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
  white-space: nowrap;
}

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

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

.delete-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 4px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

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

/* ---- レスポンシブ ---- */
@media (max-width: 760px) {
  .columns {
    grid-template-columns: 1fr;
  }
  .dashboard {
    grid-template-columns: 1fr;
  }
  .review-form__row {
    flex-direction: column;
  }
  .clock {
    display: none;
  }
}
