/* ============================================================
 * CxO Roadmap Log — styles
 * 白ベース / 落ち着いた青・グレー / 業務アプリ寄り / スマホファースト
 * ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --line: #e2e8f0;
  --line-2: #cdd8e3;
  --text: #14293d;
  --text-2: #3b5168;
  --muted: #6b7d90;
  --primary: #1f5e8c;
  --primary-2: #2b78b3;
  --primary-weak: #e8f1f8;
  --accent: #0e9f6e;      /* 実績候補・前進 */
  --accent-weak: #e6f6ef;
  --good: #0e7c54;
  --warn: #b45309;
  --warn-weak: #fdf2e3;
  --danger: #b91c1c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 41, 61, 0.06), 0 1px 3px rgba(20, 41, 61, 0.05);
  --font: 'Inter', 'Noto Sans JP', system-ui, sans-serif;
  --maxw: 760px;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ===== ナビ ===== */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; gap: 7px; overflow-x: auto;
  padding: 10px 16px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(20, 41, 61, 0.05);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-padding: 0 16px;
}
.nav::-webkit-scrollbar { display: none; }
.nav-chip {
  flex: 0 0 auto;
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  padding: 8px 15px; border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  white-space: nowrap;
}
/* スクロール端で最後/最初のチップが切れないよう余白 */
.nav::after { content: ''; flex: 0 0 4px; }
.nav-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== レイアウト ===== */
/* 下部固定バー/Safari下部バーで最下部が見切れないよう余白を確保 */
.main { max-width: var(--maxw); margin: 0 auto; padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
.phead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ptitle { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.psub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ===== ボタン ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 700;
  padding: 11px 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary-2); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.danger { color: var(--danger); border-color: #e7c4c4; }
.btn.sm { padding: 8px 13px; font-size: 13px; }
.btn.xs { padding: 5px 10px; font-size: 12px; font-weight: 600; }
.btn.block { width: 100%; }

/* ===== ダッシュボード ===== */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.quick .btn { width: 100%; }
/* 「今日のログを書く」を最優先で大きく */
.quick .wide { grid-column: 1 / -1; padding: 14px; font-size: 15.5px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.stat-n { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-n.accent { color: var(--accent); }
.stat-n.warn { color: var(--warn); }
.stat-l { font-size: 12px; color: var(--muted); margin-top: 2px; }

.pill-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.pill { font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
.pill.ok { background: var(--accent-weak); color: var(--good); }
.pill.todo { background: var(--warn-weak); color: var(--warn); }

/* ===== ブロック ===== */
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.link { font-size: 12px; font-weight: 600; color: var(--primary); }
.mini-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.mini-list li { font-size: 13px; line-height: 1.7; color: var(--text-2); padding-left: 16px; position: relative; }
.mini-list li::before { content: '▸'; position: absolute; left: 0; color: var(--primary-2); }
.block-note { font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }

/* ===== 今日の3つ ===== */
.f3-list { display: flex; flex-direction: column; gap: 6px; }
.f3-row { display: flex; align-items: center; gap: 4px; }
.f3-toggle {
  flex: 1; min-width: 0; min-height: 46px;
  display: flex; align-items: center; gap: 11px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; cursor: pointer; font-family: inherit; transition: border-color .12s;
}
.f3-toggle:active { border-color: var(--primary-2); }
.f3-mark {
  flex: 0 0 auto; width: 21px; height: 21px; border-radius: 50%;
  border: 2px solid var(--line-2); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
}
.f3-text { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.5; word-break: break-word; }
.f3-row.done .f3-mark { border-color: var(--accent); background: var(--accent); }
.f3-row.done .f3-mark::after { content: '✓'; color: #fff; font-size: 12px; font-weight: 800; line-height: 1; }
.f3-row.done .f3-text { color: var(--muted); text-decoration: line-through; }
.f3-del {
  flex: 0 0 auto; width: 44px; height: 44px; border: none; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 19px; line-height: 1; cursor: pointer;
}
.f3-del:hover { color: var(--danger); background: var(--surface-2); }
.f3-add { display: flex; gap: 8px; margin-top: 8px; }
.f3-add .f3-input {
  flex: 1; min-width: 0; font-family: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 10px 12px; transition: border-color .12s;
}
.f3-add .f3-input:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px var(--primary-weak); }

/* ===== リスト/アイテム ===== */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; box-shadow: var(--shadow); }
.item.flat { box-shadow: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.item:hover { border-color: var(--line-2); }
.item-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 6px; }
.item-meta .date { font-size: 12px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.item-title { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
.item-body { font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; }
.item-sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.skill-name { font-size: 14.5px; font-weight: 700; }

/* ===== バッジ ===== */
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.accent { background: var(--accent-weak); color: var(--good); border-color: transparent; }
.badge.warn { background: var(--warn-weak); color: var(--warn); border-color: transparent; }
.badge.high { background: #fdeaea; color: var(--danger); border-color: transparent; }
.badge.cat { background: var(--primary-weak); color: var(--primary); border-color: transparent; }
.badge.state { background: #eef2f6; color: var(--text-2); }
.badge.muted { color: var(--muted); }
.badge.st-実績候補 { background: var(--accent-weak); color: var(--good); border-color: transparent; }
.badge.st-実績化済み { background: var(--primary-weak); color: var(--primary); border-color: transparent; }
.badge.st-保留 { background: #f1f1f4; color: var(--muted); }
.badge.st-要整理 { background: var(--warn-weak); color: var(--warn); border-color: transparent; }

/* ===== Before / After ===== */
.ba { display: grid; grid-template-columns: 1fr auto 1fr auto auto; gap: 8px; align-items: stretch; margin: 12px 0; }
.ba-cell { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; text-align: center; display: flex; flex-direction: column; justify-content: center; }
.ba-cell.b { background: #f1f4f7; }
.ba-cell.a { background: var(--primary-weak); border-color: transparent; }
.ba-cell.up { background: var(--accent-weak); border-color: transparent; }
.ba-cell.rate { background: var(--accent-weak); border-color: transparent; }
.ba-cell.money { background: var(--surface); }
.ba-lbl { font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.ba-val { font-size: 16px; font-weight: 800; color: var(--text); }
.ba-val.big { font-size: 20px; color: var(--good); }
.ba-val.money-on { color: var(--good); }
.ba-val.uncalc { font-size: 13px; font-weight: 800; color: var(--warn); }
.ba-uncalc { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ba-next { font-size: 9.5px; font-weight: 800; letter-spacing: 0.02em; color: #fff; background: var(--warn); padding: 1px 7px; border-radius: 999px; }
.ba-arrow2 { align-self: center; font-size: 20px; font-weight: 900; line-height: 1; color: var(--primary-2); }
@media (max-width: 560px) {
  .ba { grid-template-columns: 1fr auto 1fr; grid-auto-rows: auto; }
  .ba-cell.up, .ba-cell.money { grid-column: span 1; }
  .ba-arrow2 { grid-row: 1; }
}

/* mini before/after (一覧用) */
.ba-mini { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; font-weight: 700; }
.ba-mini .ba-b { color: var(--muted); }
.ba-mini .ba-arrow { color: var(--muted); }
.ba-mini .ba-a { color: var(--primary); }
.ba-mini .ba-up { margin-left: auto; color: var(--good); }

/* ===== 数字成果カード ===== */
.cards-num { display: flex; flex-direction: column; gap: 12px; }
.card-num { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.cn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cn-name { font-size: 15px; font-weight: 800; }
.cn-meaning { font-size: 13px; color: var(--text-2); margin-top: 4px; }
/* 今後計算: 目立たせすぎず、でも見落とさない控えめなピル */
.cn-future { display: inline-block; font-size: 11.5px; color: var(--warn); margin-top: 8px; font-weight: 600; background: var(--warn-weak); border: 1px solid #f0dcc0; padding: 4px 10px; border-radius: 8px; }
.cn-future::before { content: '▹ '; }
.cn-rel { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ===== 詳細(KV) ===== */
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.kv { display: flex; flex-direction: column; gap: 8px; }
.kv-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.kv-k { font-size: 12px; font-weight: 700; color: var(--muted); }
.kv-v { font-size: 13.5px; color: var(--text); white-space: pre-wrap; }
@media (max-width: 480px) { .kv-row { grid-template-columns: 92px 1fr; } }

/* ===== フォーム ===== */
.form { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-head { font-size: 14px; font-weight: 800; padding: 13px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
details.card > summary.card-head { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.card > summary.card-head::after { content: '＋'; color: var(--muted); font-weight: 700; }
details.card[open] > summary.card-head::after { content: '−'; }
details.card > summary::-webkit-details-marker { display: none; }
.card-body { padding: 14px 16px; }
.sec-hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.fields { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.field.req .field-label::after { content: ' *'; color: var(--danger); }
.field-hint { font-size: 11px; color: var(--muted); }
.field input, .field select, .field textarea, .out {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 10px 12px; transition: border-color .12s;
}
.field input:focus, .field select:focus, .field textarea:focus, .out:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px var(--primary-weak); }
.field textarea, .out { resize: vertical; line-height: 1.6; }
.field-check { flex-direction: row; align-items: center; gap: 9px; }
.field-check input { width: 20px; height: 20px; }
.field-check span { font-size: 14px; font-weight: 600; }

/* ===== 保存バー(下部固定) ===== */
.savebar {
  position: sticky; bottom: 0; z-index: 40;
  display: flex; gap: 10px; margin-top: 4px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, rgba(238,242,246,0));
}
.savebar .btn { flex: 1; padding: 13px; font-size: 15px; }
.savebar .btn.ghost { flex: 0 0 38%; }

.del-row { display: flex; justify-content: flex-end; padding: 4px 0; }

/* ===== 共通 ===== */
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 10px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
/* 空状態の行動喚起カード */
.empty-cta { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 34px 18px; }
.empty-cta .empty-msg { color: var(--text-2); font-size: 13.5px; line-height: 1.8; }
.empty-cta .btn { padding: 13px 22px; font-size: 15px; }
.note { font-size: 12.5px; padding: 10px 13px; border-radius: 10px; margin-bottom: 12px; }
.note.warn { background: var(--warn-weak); color: var(--warn); font-weight: 600; }
.note.info { background: var(--primary-weak); color: var(--primary); font-weight: 600; }

/* 用語ヘルプ(開閉) */
.help { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow); }
.help > summary { cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 700; color: var(--primary); padding: 12px 15px; display: flex; align-items: center; gap: 6px; }
.help > summary::-webkit-details-marker { display: none; }
.help > summary::before { content: 'ⓘ'; }
.help[open] > summary { border-bottom: 1px solid var(--line); }
.help-body { padding: 12px 15px; display: flex; flex-direction: column; gap: 8px; }
.help-body p { font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.help-body b { color: var(--text); }

/* フローティング追加ボタン(最重要行動=今日のログ) */
.fab {
  position: fixed; right: 18px; z-index: 45;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 400; line-height: 1; color: #fff;
  background: var(--primary);
  box-shadow: 0 6px 16px rgba(31, 94, 140, 0.4);
}
.fab:active { transform: scale(0.94); }
.bar { height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 999px; }
.out { background: var(--surface-2); }
