:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --surface: #f7f9fc;   /* 一覧の各項目・入力欄まわりの下地 */
  --text: #17202e;
  --muted: #6b7688;
  --border: #dfe4ec;
  --border-soft: #e9edf3;
  --accent: #3358e0;
  --accent-soft: #eaefff;
  --danger: #c9414a;
  --done: #12885a;
  --done-soft: #e9f7f0;
  --shadow-sm: 0 1px 2px rgba(23, 32, 46, 0.05);
  --shadow-md: 0 6px 20px rgba(23, 32, 46, 0.07);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 40px 20px 80px;
  background:
    radial-gradient(1100px 480px at 50% -220px, #ffffff 0%, rgba(255, 255, 255, 0) 70%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

main, .page-header { max-width: 1040px; margin: 0 auto; }

/* ヘッダー */
.page-header { margin-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(140deg, #4a6df0, #2c46b8);
  color: #fff;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(51, 88, 224, 0.32);
}
.page-header h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.page-header .sub { margin: 0; color: var(--muted); font-size: 13px; }

/* ダッシュボード */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 44px;   /* 追加欄との間隔 */
}
.stat {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #c8d1e2;
}
.stat-accent::before { background: linear-gradient(180deg, #4a6df0, #2c46b8); }
.stat-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.stat-value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.stat-accent .stat-value { color: var(--accent); }

/* ダッシュボードの「最新の振り返り」 */
.stat-review {
  grid-column: 1 / -1;
  gap: 6px;
}
.stat-review::before { background: linear-gradient(180deg, #12885a, #0d6e48); }
.review-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.review-week {
  font-size: 13px;
  font-weight: 700;
  color: var(--done);
  font-variant-numeric: tabular-nums;
}
.review-comment {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14.5px;
  color: #2c3646;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.review-comment.is-empty { color: var(--muted); font-size: 14px; }
.review-meta { margin-top: 0 !important; }

.notice {
  background: #fff8e8;
  border: 1px solid #ecd9a8;
  color: #6b5320;
  border-radius: 10px;
  padding: 11px 15px;
  margin: -28px 0 24px;
  font-size: 13px;
  line-height: 1.7;
}
.notice strong { display: block; color: #8a6516; }
.notice code {
  background: #f4ead3;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
}

.error {
  background: #fdeced;
  border: 1px solid #f2c2c5;
  color: var(--danger);
  border-radius: 10px;
  padding: 11px 15px;
  margin: -24px 0 24px;
  font-size: 14px;
}

/* カード */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 20px 22px 24px;
}
.card-head {
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}
.card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* 追加欄 */
.compose {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px;
}
.card-wide { grid-column: 1 / -1; }

.form { display: flex; flex-direction: column; gap: 10px; }
.form-inline { flex-direction: row; }
.form-inline input { flex: 1; }

.field { display: flex; align-items: center; gap: 10px; }
.field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
select {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  min-width: 260px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(51, 88, 224, 0.14);
}

.form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hint { font-size: 12px; color: var(--muted); }

input[type="text"], textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  width: 100%;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]::placeholder, textarea::placeholder { color: #9aa4b5; }
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(51, 88, 224, 0.14);
}

button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #4a6df0, #3358e0);
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(51, 88, 224, 0.25);
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}
button:hover { box-shadow: 0 4px 12px rgba(51, 88, 224, 0.32); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 一覧 */
.list-heading {
  margin: 26px 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.count { font-weight: 400; font-size: 12px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item {
  position: relative;
  background: var(--surface);          /* 白いカードの上でも輪郭が分かる下地 */
  border: 1px solid var(--border);
  border-left: 3px solid #c8d1e2;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.item:hover {
  background: #fff;
  border-color: #cfd7e5;
  box-shadow: var(--shadow-sm);
}
.item.done {
  background: var(--done-soft);
  border-left-color: var(--done);
}
.item.done:hover { background: #f2fbf6; }
.item-review { border-left-color: #8fb8a5; }
.item-review .item-title {
  color: #0f5f42;
  font-variant-numeric: tabular-nums;
}

.item-body { flex: 1; min-width: 0; }
.item-title {
  font-weight: 600;
  word-break: break-word;
  letter-spacing: 0.01em;
}
.item.done .item-title { text-decoration: line-through; color: var(--muted); }
.item-text {
  margin: 6px 0 0;
  padding-top: 6px;
  border-top: 1px dashed #dde3ec;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  color: #465162;
}
.meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.badge-done { color: var(--done); background: #d8f0e4; }
.badge-todo { color: var(--accent); background: var(--accent-soft); }

.actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-small {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 8px;
  box-shadow: none;
}
.btn-small:hover { box-shadow: 0 2px 8px rgba(51, 88, 224, 0.22); }
.btn-ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: #f2f5fa; box-shadow: none; }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: #e6cbcd;
}
.btn-danger:hover { background: #fdeced; box-shadow: none; }

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 18px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface);
}

@media (max-width: 760px) {
  body { padding: 28px 14px 64px; }
  .columns { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr; margin-bottom: 32px; }
  .stat-value { font-size: 28px; }
  .field { flex-direction: column; align-items: stretch; gap: 6px; }
  select { min-width: 0; width: 100%; }
  .form-foot { flex-direction: column; align-items: stretch; }
  .form-foot button { width: 100%; }
}
