/* ===========================================================
   マイ秘書 — デザイントークン
   =========================================================== */
:root {
  /* 面 */
  --bg: #f2f4f8;
  --bg-tint: #e9edf5;
  --surface: #ffffff;
  --surface-sunken: #f4f6fa;

  /* 文字 */
  --ink: #171b23;
  --ink-soft: #4a5361;
  --muted: #7b8494;

  /* 線 */
  --line: #e5e9f0;
  --line-strong: #d5dbe6;

  /* アクセント */
  --accent: #4f5bd5;
  --accent-hover: #4049be;
  --accent-soft: #eceefc;
  --memo: #c2761a;
  --memo-soft: #fbf1e3;
  --done: #12876a;
  --done-soft: #e6f4f0;
  --review: #7c4bbd;
  --review-soft: #f2ecfa;
  --danger: #c8443f;

  /* 影（浅→深の3段階で奥行きを揃える） */
  --shadow-xs: 0 1px 2px rgba(20, 26, 38, .05);
  --shadow-sm: 0 1px 2px rgba(20, 26, 38, .05), 0 2px 6px rgba(20, 26, 38, .05);
  --shadow-md: 0 4px 10px rgba(20, 26, 38, .07), 0 12px 28px rgba(20, 26, 38, .07);

  /* 角丸 */
  --r-lg: 16px;
  --r-md: 11px;
  --r-sm: 8px;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ===========================================================
   ベース
   =========================================================== */
* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 20px 64px;
  font-family: "Segoe UI Variable Text", "Segoe UI", "Yu Gothic UI", "Hiragino Sans",
               "Noto Sans JP", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(1200px 420px at 50% -160px, var(--bg-tint), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* SVGスプライト本体は表示しない */
.sprite { display: none; }

/* アイコンは線画で統一する */
svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

main { max-width: 1040px; margin: 0 auto; }

/* ===========================================================
   ヘッダー
   =========================================================== */
.site-header {
  max-width: 1040px;
  margin: 0 auto;
  padding: 36px 2px 22px;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #5c68e0, #3f4ab8);
  color: #fff;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: 0 4px 12px rgba(79, 91, 213, .32);
}
.site-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: .01em;
}
.brand-sub {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ===========================================================
   ダッシュボード
   =========================================================== */
.dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  position: relative;
  overflow: hidden;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s var(--ease), transform .18s var(--ease);
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* 上端の細い色帯で3枚を色分けする */
.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: currentColor;
  opacity: .85;
}
.stat-memo { color: var(--memo); }
.stat-task { color: var(--accent); }

/* 完了タスクは一覧の「完了」バッジと同じ緑にして、色の意味を揃える */
.stat-done { color: var(--done); }
.stat-done .stat-value { color: var(--done); }

.stat-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-sunken);
  font-size: 17px;
}
.stat-memo .stat-icon { background: var(--memo-soft); }
.stat-task .stat-icon { background: var(--accent-soft); }
.stat-done .stat-icon { background: var(--done-soft); }

.stat-label {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .03em;
}
.stat-figure {
  margin: 2px 0 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--ink);
}
.stat-value {
  font-size: 32px;
  font-weight: 660;
  line-height: 1.15;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;   /* 桁が増えても数字がぶれない */
}
.stat-unit { color: var(--muted); font-size: 12.5px; }

/* ===========================================================
   ダッシュボード: 最新の振り返り
   =========================================================== */
.latest {
  margin-bottom: 22px;
  padding: 16px 20px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--review);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.latest-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 9px;
}
.latest-icon { font-size: 16px; color: var(--review); }
.latest-label {
  font-size: 12.5px;
  font-weight: 620;
  letter-spacing: .04em;
  color: var(--ink-soft);
}
.latest-week {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--review-soft);
  color: var(--review);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.latest-week.is-current::after { content: " ・今週"; }

.latest-body { margin-top: 9px; }
.latest-comment {
  margin: 0;
  color: var(--ink);
  font-size: 14.5px;
  white-space: pre-wrap;
  word-break: break-word;
}
.latest-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.latest-warn {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--memo-soft);
  color: var(--memo);
  font-weight: 600;
}
.latest-none { color: var(--muted); font-size: 13.5px; }

/* ===========================================================
   カード
   =========================================================== */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.card {
  padding: 20px 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 640;
  letter-spacing: .01em;
}
.card-icon { font-size: 17px; }
.card-memo .card-icon { color: var(--memo); }
.card-task .card-icon { color: var(--accent); }
.card-review .card-icon { color: var(--review); }
.card-review { margin-top: 16px; }

.list-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 26px 0 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 620;
  letter-spacing: .04em;
  color: var(--ink-soft);
}
.count {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ===========================================================
   フォーム
   =========================================================== */
.form { display: flex; flex-direction: column; gap: 9px; }
.form-inline { flex-direction: row; }
.form-inline input { flex: 1; min-width: 0; }

input[type="text"], textarea {
  width: 100%;
  padding: 10px 13px;
  font: inherit;
  color: inherit;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
textarea { resize: vertical; min-height: 76px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type="text"]:focus, textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 91, 213, .14);
}

/* ラベル付きの入力欄 */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--ink-soft);
}
.field-hint {
  margin: -3px 0 0;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--review-soft);
  color: #6a3fa6;
  font-size: 12.5px;
}

select {
  width: 100%;
  padding: 10px 13px;
  font: inherit;
  color: inherit;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
select:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--review);
  box-shadow: 0 0 0 3px rgba(124, 75, 189, .14);
}

button { font: inherit; cursor: pointer; border: none; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  font-weight: 550;
  letter-spacing: .02em;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(20, 26, 38, .12);
  transition: background .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 3px 10px rgba(79, 91, 213, .3); }
.btn-primary:active { transform: translateY(1px); box-shadow: none; }
.btn-icon { font-size: 16px; stroke-width: 2; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

/* 白いカードから浮かせるため、沈んだ面色＋左のアクセント帯で分離する */
.item {
  position: relative;
  padding: 12px 14px 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-sunken);
  box-shadow: var(--shadow-xs);
  transition: box-shadow .16s var(--ease), transform .16s var(--ease), background .16s var(--ease);
}
.item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  transition: top .16s var(--ease), bottom .16s var(--ease);
}
.item:hover {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.item:hover::before { top: 5px; bottom: 5px; }

#memo-list .item::before { background: var(--memo); }
#review-list .item::before { background: var(--review); }

.item-head { display: flex; align-items: flex-start; gap: 9px; }
.item-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word;
}
.item-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* 完了タスクは彩度を落として沈ませる */
.task-done { background: #eef0f4; }
.task-done::before { background: var(--done) !important; }
.task-done .item-title { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }

/* バッジ */
.badge {
  align-self: center;
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
.badge-open { background: var(--accent-soft); color: var(--accent); }
.badge-done { background: var(--done-soft); color: var(--done); }
.badge-week {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.badge-current { background: var(--review-soft); color: var(--review); }

/* 振り返りは本文が主役なので、区切り線を省いて読みやすくする */
.item-review .item-body { border-top: none; margin-top: 6px; padding-top: 0; }
.item-review .item-title { flex: 0 0 auto; }
.item-review .item-head { flex-wrap: wrap; }
.item-review .btn-mini { margin-left: auto; }
.item-review .btn-mini + .btn-mini { margin-left: 0; }

/* 補助ボタン（削除） */
.btn-mini {
  align-self: center;
  flex-shrink: 0;
  padding: 4px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  transition: color .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.btn-mini:hover { color: var(--ink); border-color: var(--muted); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* チェックボックス */
.item-head input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--done);
  cursor: pointer;
}

/* 空のとき */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 13.5px;
}
.empty svg { width: 26px; height: 26px; opacity: .55; stroke-width: 1.5; }

/* ===========================================================
   トースト
   =========================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(14px) scale(.97);
  padding: 11px 22px;
  border-radius: 999px;
  background: rgba(23, 27, 35, .94);
  color: #fff;
  font-size: 13.5px;
  letter-spacing: .01em;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

/* ===========================================================
   レスポンシブ
   =========================================================== */
@media (max-width: 860px) {
  .columns { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { padding: 0 14px 48px; }
  .site-header { padding: 26px 2px 18px; }
  .dashboard { grid-template-columns: 1fr; gap: 10px; }
  /* 横1行にまとめる: アイコン / ラベル / 数値 */
  .stat { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
  .stat-label { flex: 1; margin-top: 0; font-size: 13.5px; }
  .stat-figure { margin: 0; }
  .stat-value { font-size: 25px; }
  .card { padding: 18px 16px 20px; }
}

/* 動きを減らす設定を尊重する */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .stat:hover, .item:hover { transform: none; }
}
