:root {
  --bg: #f7f8fb;
  --bg-accent: #eef0f8;
  --panel-bg: #ffffff;
  --border: #e6e8ef;
  --border-strong: #d6dae4;

  --text: #171a21;
  --text-soft: #4b5261;
  --text-muted: #858c9a;

  --accent: #5b5bd6;
  --accent-hover: #4a4ac4;
  --accent-soft: #eeeefc;

  --danger: #d9455f;
  --danger-soft: #fdeef1;
  --success: #1f9d63;
  --success-soft: #e8f7ef;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 8px;

  --shadow-sm: 0 1px 2px rgba(23, 26, 33, 0.05);
  --shadow-md: 0 4px 16px rgba(23, 26, 33, 0.06);
  --shadow-lg: 0 10px 30px rgba(23, 26, 33, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI",
    "Yu Gothic", "Meiryo", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 15% -10%, var(--bg-accent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

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

/* ---------- ヘッダー ---------- */

.site-header {
  margin-bottom: 28px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--accent), #7b6ef0);
  color: #fff;
  box-shadow: 0 6px 16px rgba(91, 91, 214, 0.28);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.brand-text h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-sub {
  margin: 1px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

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

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

.dashboard-card {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

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

.dashboard-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
}

.dashboard-icon svg {
  width: 21px;
  height: 21px;
}

.icon-note {
  background: var(--accent-soft);
  color: var(--accent);
}

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

.icon-open {
  background: #fff3e6;
  color: #c9741d;
}

.icon-done {
  background: var(--success-soft);
  color: var(--success);
}

.dashboard-body {
  min-width: 0;
}

.dashboard-value {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.dashboard-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---------- 最新の振り返り ---------- */

.latest-review {
  margin-bottom: 26px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #ffffff, #f6f6fe);
  box-shadow: var(--shadow-sm);
}

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

.latest-review-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.latest-review-icon svg {
  width: 15px;
  height: 15px;
}

.latest-review-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.latest-review-week {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.latest-review-comment {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.latest-review-comment.is-empty {
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- パネル ---------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.panel-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-soft);
}

.panel-title::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: var(--accent);
}

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

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

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

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="datetime-local"],
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 13px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  color: var(--text);
  background: #fcfcfe;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  resize: vertical;
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: #a9afbb;
}

input[type="text"]:focus,
input[type="datetime-local"]:focus,
textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.14);
}

.btn-primary {
  align-self: flex-start;
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(91, 91, 214, 0.24);
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(91, 91, 214, 0.3);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(91, 91, 214, 0.24);
}

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

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

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

.list::-webkit-scrollbar-thumb {
  background: #d8dbe4;
  border-radius: 4px;
}

.list::-webkit-scrollbar-track {
  background: transparent;
}

.empty {
  display: grid;
  place-items: center;
  padding: 28px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  background: #fbfbfd;
}

.note-item,
.task-item {
  position: relative;
  background: #fafbfd;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.task-item.completed {
  border-left-color: var(--success);
  background: #fafafb;
}

.note-item:hover,
.task-item:hover {
  background: #fff;
  box-shadow: var(--shadow-md);
  transform: translateX(1px);
}

.note-title {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.5;
  margin-bottom: 3px;
  word-break: break-word;
}

.note-content {
  font-size: 13.5px;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.item-meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.task-text {
  font-size: 14.5px;
  line-height: 1.5;
  word-break: break-word;
}

.task-item.completed .task-text {
  text-decoration: line-through;
  text-decoration-color: rgba(133, 140, 154, 0.6);
  color: var(--text-muted);
}

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

.task-actions button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: #fff;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-complete {
  color: var(--success);
  border-color: rgba(31, 157, 99, 0.35);
}

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

.btn-delete {
  color: var(--danger);
  border-color: rgba(217, 69, 95, 0.3);
}

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

.status-badge {
  display: inline-block;
  vertical-align: 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 9px;
  border-radius: 999px;
  margin-left: 8px;
  white-space: nowrap;
}

.status-badge.done {
  background: var(--success-soft);
  color: #157a4c;
}

.status-badge.open {
  background: var(--danger-soft);
  color: #b73450;
}

.status-badge.current {
  background: var(--accent-soft);
  color: var(--accent);
  margin-left: 0;
}

/* ---------- 週次振り返り ---------- */

.field-hint {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

input[type="week"] {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 13px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fcfcfe;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input[type="week"]:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.14);
}

.review-item {
  background: #fafbfd;
  border: 1px solid var(--border);
  border-left: 3px solid #7b6ef0;
  border-radius: var(--radius-md);
  padding: 13px 16px;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.review-item:hover {
  background: #fff;
  box-shadow: var(--shadow-md);
  transform: translateX(1px);
}

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

.review-week {
  font-size: 14px;
  font-weight: 700;
}

.review-range {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.review-delete {
  margin-left: auto;
}

.review-comment {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- レスポンシブ ---------- */

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

@media (max-width: 720px) {
  .app {
    padding: 28px 14px 56px;
  }

  .dashboard {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .panel {
    padding: 18px 16px 20px;
  }

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

  .task-actions {
    align-self: flex-end;
  }
}
