/* ============================================================
   マイ秘書 - スタイル
   色は :root にまとめてあるので、ここを変えれば全体の印象が変わります
   ============================================================ */

:root {
  --bg: #f4f5f7;
  --bg-glow: #e8ecf7;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --border: #e6e8ee;
  --border-strong: #d6dae3;

  --text: #1a1d26;
  --text-soft: #5c6270;
  --text-faint: #9aa0ad;

  --accent: #4361ee;
  --accent-hover: #3550dc;
  --accent-soft: #eef1fe;
  --accent-ring: rgba(67, 97, 238, .22);

  --success: #17915c;
  --success-soft: #e7f5ee;
  --warn: #a8690a;
  --warn-soft: #fdf3e3;
  --danger: #cf4444;
  --danger-soft: #fdefef;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, .05);
  --shadow: 0 2px 4px rgba(20, 24, 40, .04), 0 8px 24px -12px rgba(20, 24, 40, .16);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c;
    --bg-glow: #1b2030;
    --surface: #1c1f27;
    --surface-soft: #22262f;
    --border: #2b303b;
    --border-strong: #3a4150;

    --text: #e9ebf0;
    --text-soft: #a3aab8;
    --text-faint: #6f7787;

    --accent: #7a92ff;
    --accent-hover: #8fa2ff;
    --accent-soft: #232a44;
    --accent-ring: rgba(122, 146, 255, .28);

    --success: #4ecb8f;
    --success-soft: #1b2f26;
    --warn: #e0ac5d;
    --warn-soft: #2e2618;
    --danger: #f08585;
    --danger-soft: #332121;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 2px 4px rgba(0, 0, 0, .2), 0 10px 28px -14px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
               "Yu Gothic", "Segoe UI", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 50% -180px, var(--bg-glow), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

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

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px -6px var(--accent-ring);
}
.brand-mark svg { width: 22px; height: 22px; }

.brand-text h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.3;
}
.subtitle { margin: 0; font-size: 12.5px; color: var(--text-faint); }

.today {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-soft);
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-variant-numeric: tabular-nums;
}

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

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

.stat {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.stat:hover { transform: translateY(-1px); border-color: var(--border-strong); }

.stat-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text-soft);
}
.stat-icon svg { width: 19px; height: 19px; }

.stat-accent { border-color: var(--accent); }
.stat-accent .stat-icon { background: var(--accent-soft); color: var(--accent); }
.stat-accent .stat-value { color: var(--accent); }

.stat-body { min-width: 0; }
.stat-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text-faint);
}
.stat-value {
  margin: 0;
  font-size: 27px;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.stat-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  margin-left: 3px;
}

/* 達成率バー */
.progress-card {
  grid-column: 1 / -1;
  padding: 15px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.progress-rate {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.progress-track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width .5s var(--ease);
}
.progress-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-faint);
}

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

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

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

.panel-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
}
.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
}
.pill {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------- 入力欄 ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  margin-bottom: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.form-row { flex-direction: row; align-items: center; }
.form-row input { flex: 1; min-width: 0; }

input[type="text"], textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.65; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

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

/* ---------- ボタン ---------- */

.btn {
  flex: none;
  padding: 9px 17px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease),
              color .16s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--surface-soft); border-color: var(--text-faint); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

.btn-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 12px -6px var(--accent-ring);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  background: transparent;
  border-color: var(--border-strong);
}

/* アイコンだけのボタン（削除） */
.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--text-faint);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  opacity: .55;
  transition: all .16s var(--ease);
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover {
  opacity: 1;
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-soft);
}
.icon-btn:focus-visible { outline: none; opacity: 1; box-shadow: 0 0 0 3px var(--accent-ring); }

/* 丸いチェックボタン */
.check {
  display: grid;
  place-items: center;
  flex: none;
  width: 21px;
  height: 21px;
  margin-top: 2px;
  padding: 0;
  color: transparent;
  background: transparent;
  border: 1.8px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
  transition: all .18s var(--ease);
}
.check svg { width: 12px; height: 12px; }
.check:hover { border-color: var(--accent); color: var(--accent); }
.check:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.check[aria-checked="true"] {
  color: #fff;
  background: var(--success);
  border-color: var(--success);
}

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

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.item {
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
  animation: rise .28s var(--ease) both;
}
.item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

@keyframes rise {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}

.item-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.item-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.55;
  word-break: break-word;
}
.item-body {
  margin: 5px 0 0;
  font-size: 13.5px;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}
.item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.item-meta .sep { color: var(--border-strong); }

/* タスク */
.task-head { align-items: flex-start; }
.task-main { flex: 1; min-width: 0; }

.task-done { background: var(--surface-soft); }
.task-done .item-title { color: var(--text-faint); text-decoration: line-through; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
}
.badge-open { color: var(--warn); background: var(--warn-soft); }
.badge-done { color: var(--success); background: var(--success-soft); }

/* 空のとき */
.empty {
  padding: 26px 12px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.empty svg { width: 22px; height: 22px; margin-bottom: 4px; opacity: .55; }
.empty p { margin: 0; }

/* ---------- トースト（メッセージ） ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 14px);
  max-width: min(90vw, 420px);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #262a35;
  border-radius: 999px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

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

@media (max-width: 860px) {
  .app { padding: 28px 16px 56px; }
  .columns { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .dashboard { grid-template-columns: 1fr; }
  .header { justify-content: center; text-align: center; }
  .stat-value { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
