/* =========================================================
   My 秘書アプリ - スタイル
   色は :root にまとめてあるので、ここを変えると全体が変わります
   ========================================================= */

:root {
  /* 面 */
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-sunken: #eef1f6;   /* 一覧カードの背景（白から一段沈める） */
  --surface-hover: #e7ebf3;

  /* 線 */
  --border: #e2e6ee;
  --border-strong: #ccd3e0;

  /* 文字 */
  --text: #16202f;
  --text-soft: #4a5568;
  --muted: #6b7688;

  /* アクセント */
  --primary: #4a63e7;
  --primary-hover: #3b52d1;
  --primary-soft: #eaeeff;
  --accent: #ea8025;
  --accent-soft: #fdf0e3;
  --success: #17914f;
  --success-soft: #e7f5ec;
  --danger: #d8365b;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, .07);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .10);
}

/* ダークモード（OSの設定に自動で合わせます） */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --surface: #171d2b;
    --surface-sunken: #1e2537;
    --surface-hover: #242c40;

    --border: #2a3243;
    --border-strong: #3a4459;

    --text: #e8ecf5;
    --text-soft: #c2cad9;
    --muted: #8e9bb1;

    --primary: #7d92ff;
    --primary-hover: #93a5ff;
    --primary-soft: #232c4d;
    --accent: #f0a15a;
    --accent-soft: #38291a;
    --success: #4ec585;
    --success-soft: #17301f;
    --danger: #f2698a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, .35);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Segoe UI", Meiryo, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

svg { width: 100%; height: 100%; display: block; }

/* ---------------------------------------------------------
   ヘッダー
   --------------------------------------------------------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.appbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px;
  height: 40px;
  padding: 9px;
  flex: none;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(140deg, var(--primary), #7b5cf0);
  box-shadow: var(--shadow-sm);
}
.brand-text h1 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: .01em;
}
.brand-text p {
  margin: 0;
  font-size: .78rem;
  color: var(--muted);
}
.today {
  font-size: .8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------------------------------------------------------
   レイアウト
   --------------------------------------------------------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 20px 44px;
}

/* ---------------------------------------------------------
   ダッシュボード
   --------------------------------------------------------- */
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, transform .18s ease;
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-icon {
  width: 42px;
  height: 42px;
  flex: none;
  padding: 10px;
  border-radius: 12px;
  color: var(--primary);
  background: var(--primary-soft);
}
.stat-icon-done { color: var(--success); background: var(--success-soft); }
.stat-icon-todo { color: var(--accent); background: var(--accent-soft); }

.stat-label {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  letter-spacing: .02em;
}
.stat-value {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-success .stat-value { color: var(--success); }
.stat-accent .stat-value { color: var(--accent); }

/* ---------------------------------------------------------
   パネル（メモ / タスク）
   --------------------------------------------------------- */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .01em;
}
.pill {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 11px;
  font-variant-numeric: tabular-nums;
}
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0 16px;
}
.list-title {
  margin: 0 0 12px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .08em;
}

/* ---------------------------------------------------------
   入力フォーム
   --------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-soft);
}
.field input,
.field textarea {
  font: inherit;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  resize: vertical;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder,
.field textarea::placeholder { color: var(--muted); opacity: .75; }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

/* ---------------------------------------------------------
   ボタン
   --------------------------------------------------------- */
.btn {
  font: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn-icon { width: 16px; height: 16px; flex: none; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(1px); }

/* 一覧カード内の小さなアイコンボタン */
.icon-btn {
  width: 30px;
  height: 30px;
  flex: none;
  padding: 7px;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.icon-btn:hover {
  color: var(--danger);
  background: var(--surface);
  border-color: var(--border-strong);
}

/* タスクの完了チェック（丸ボタン） */
.check {
  width: 22px;
  height: 22px;
  flex: none;
  margin-top: 2px;
  padding: 3px;
  cursor: pointer;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.check:hover { border-color: var(--success); }
.check svg { opacity: 0; transition: opacity .15s ease; }
.is-done .check {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.is-done .check svg { opacity: 1; }

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

.card {
  position: relative;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px 12px 16px;
  overflow: hidden;
  transition: background .15s ease, box-shadow .18s ease, transform .18s ease;
}
/* 左端の色帯：メモ=青 / 未完了=オレンジ / 完了=グリーン */
.card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--primary);
}
.task-card::before { background: var(--accent); }
.task-card.is-done::before { background: var(--success); }

.card:hover {
  background: var(--surface-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.card-title {
  flex: 1;
  margin: 0;
  font-size: .97rem;
  font-weight: 700;
  line-height: 1.5;
  word-break: break-word;
}
.card-body {
  margin: 9px 0 0;
  padding: 10px 12px;
  font-size: .9rem;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border-strong);
}
.meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .74rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.meta svg { width: 13px; height: 13px; flex: none; }

/* 完了したタスク */
.is-done { background: color-mix(in srgb, var(--surface-sunken) 60%, var(--bg)); }
.is-done .card-title { text-decoration: line-through; color: var(--muted); font-weight: 600; }

/* 状態バッジ */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 2px 9px;
  border-radius: 999px;
}
.badge-todo { color: var(--accent); background: var(--accent-soft); }
.badge-done { color: var(--success); background: var(--success-soft); }

/* 空のとき */
.empty {
  margin: 0;
  padding: 22px 10px;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
  background: var(--surface-sunken);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------
   フッター
   --------------------------------------------------------- */
.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 30px;
  text-align: center;
  font-size: .76rem;
  color: var(--muted);
}
.site-footer code {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: .95em;
}

/* ---------------------------------------------------------
   画面が狭いとき（タブレット）
   --------------------------------------------------------- */
@media (max-width: 820px) {
  .columns { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 13px 15px; }
  .stat-value { font-size: 1.6rem; }
  .today { display: none; }
}

/* ---------------------------------------------------------
   スマートフォン（iPhone など）
   --------------------------------------------------------- */
@media (max-width: 560px) {
  body { font-size: 15px; }

  /* iPhone の切り欠き・ホームバーを避ける */
  .appbar-inner {
    padding: 11px max(14px, env(safe-area-inset-left)) 11px max(14px, env(safe-area-inset-right));
  }
  .container { padding: 16px 14px 32px; }
  .site-footer { padding: 0 14px calc(24px + env(safe-area-inset-bottom)); }

  .brand-mark { width: 34px; height: 34px; padding: 7px; border-radius: 9px; }
  .brand-text h1 { font-size: 1rem; }
  .brand-text p { display: none; }

  /* ダッシュボードは2列×2行でコンパクトに */
  .dashboard {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }
  .stat {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 11px 12px;
    border-radius: 12px;
  }
  .stat-icon { width: 28px; height: 28px; padding: 6px; border-radius: 9px; }
  .stat-label { font-size: .68rem; line-height: 1.35; }
  .stat-value { font-size: 1.5rem; }

  .panel { padding: 16px 14px; border-radius: 12px; }
  .columns { gap: 14px; }

  /* 16px 未満だと iPhone で入力時に画面が勝手に拡大されるため 16px にする */
  .field input,
  .field textarea { font-size: 16px; padding: 11px 12px; }

  /* 指で押しやすいサイズに */
  .btn { padding: 12px 16px; width: 100%; }
  .icon-btn { width: 36px; height: 36px; padding: 9px; }
  .check { width: 26px; height: 26px; padding: 4px; }

  .card { padding: 12px 12px 11px 15px; }
  .card-foot { gap: 5px 10px; }

  /* スマホではマウスの浮き上がり演出は不要 */
  .card:hover, .stat:hover { transform: none; box-shadow: var(--shadow-sm); }
}

/* アニメーションを控える設定のとき */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
