/* ---------- デザインの基本（色・角丸・影） ---------- */
:root {
  --bg: #f2f0eb;          /* 画面の地 */
  --canvas: #f7f6f2;      /* キャンバスの地（app.js の CANVAS_BG と同じ） */
  --dots: #dedad0;        /* キャンバスの点 */
  --panel: #ffffff;
  --panel-2: #faf9f6;
  --tint: #ebe8e1;        /* 選択中・押したときの地 */
  --ink: #1f2328;
  --ink-2: #3a4048;
  --muted: #6b7078;
  --faint: #9a9ea5;
  --line: #e6e3dc;
  --line-strong: #d4d0c6;
  --accent: #d9573f;
  --accent-soft: #fbe8e3;
  --ai: #2e8f7a;          /* AI の操作と回答の色 */
  --ai-soft: #e6f4f1;
  --warn-soft: #fff4d6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(31, 35, 40, .05);
  --shadow-2: 0 12px 32px rgba(31, 35, 40, .12), 0 2px 6px rgba(31, 35, 40, .06);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { display: flex; flex-direction: column; background: var(--bg); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* アイコン（線で描く SVG） */
svg.i { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- ボタン ---------- */
button {
  font: inherit;
  font-size: 13.5px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  min-height: 32px;
  cursor: pointer;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
button:hover { border-color: var(--line-strong); background: var(--panel-2); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid rgba(217, 87, 63, .45); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
button.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
button.ghost:hover { background: var(--tint); }
button.icon-btn { width: 34px; min-height: 34px; padding: 0; background: transparent; border-color: transparent; color: var(--ink-2); }
button.icon-btn:hover, button.icon-btn[aria-expanded="true"] { background: var(--tint); }
button.ai { background: var(--ai-soft); color: #1f6b5a; border-color: #c3e3dc; font-weight: 600; }
button.ai:hover { background: #d8eee8; border-color: #9fd0c4; }
button.chip { border-radius: 999px; font-size: 12px; min-height: 26px; padding: 2px 12px; color: var(--ink-2); }

/* ---------- 上のバー ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 28px; height: 28px; flex-shrink: 0; fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: .01em; }
.brand .sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }

.nav { display: flex; gap: 2px; padding: 3px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.nav-item { border: 0; background: transparent; color: var(--muted); min-height: 30px; padding: 4px 12px; border-radius: 7px; font-size: 13px; }
.nav-item:hover { background: var(--tint); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.cost {
  font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap;
  padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); cursor: help;
}
.cost:empty { display: none; }
.count { display: inline-block; min-width: 18px; margin-left: 2px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }

/* セッション終了処理の進行状況。控えめに出す */
.closing { font-size: 12px; color: var(--muted); white-space: nowrap; }
.closing::before, .status.busy::before {
  content: "";
  display: inline-block;
  width: 9px; height: 9px; margin-right: 6px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 吹き出し（メニュー・設定） ---------- */
.pop { position: relative; }
.pop-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  min-width: 260px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2);
}
.pop-panel.up { top: auto; bottom: calc(100% + 10px); }
.menu button { width: 100%; justify-content: flex-start; align-items: flex-start; gap: 10px; border: 0; background: transparent;
  padding: 8px 10px; text-align: left; border-radius: var(--radius-sm); }
.menu button:hover { background: var(--panel-2); }
.menu button svg.i { margin-top: 2px; color: var(--muted); }
.menu button span { display: flex; flex-direction: column; }
.menu small, .setting small { font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.settings { width: 360px; padding: 8px 14px; }
.setting { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 8px 0; font-size: 13.5px; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting > span { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.setting select { font: inherit; font-size: 13px; color: var(--ink); padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }

/* スイッチ（チェックボックスの見た目を変える） */
.switch input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; margin: 0; flex-shrink: 0;
  width: 30px; height: 18px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background-color .15s;
}
.switch input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s;
}
.switch input[type="checkbox"]:checked { background: var(--ink); }
.switch input[type="checkbox"]:checked::after { transform: translateX(12px); }

/* ---------- 本体 ---------- */
.layout { flex: 1; display: flex; min-height: 0; position: relative; }

.canvas-wrap {
  position: relative; flex: 1; min-width: 0;
  background-color: var(--canvas);
  background-image: radial-gradient(var(--dots) 1px, transparent 1.2px);
  background-size: 22px 22px;
}
/* 上のビューバーと下の凡例に重ならないよう、グラフの描画域を少し狭める（全体表示がその内側に収まる） */
#graph { position: absolute; top: 58px; right: 0; bottom: 46px; left: 0; }

.viewbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px;
  pointer-events: none;
}
.viewbar > * { pointer-events: auto; }
.views { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow-1); }
.views button { white-space: nowrap; flex-shrink: 0; border: 0; border-radius: 7px; padding: 4px 11px; min-height: 28px; font-size: 12.5px; color: var(--muted); background: transparent; }
.views button:hover { background: var(--panel-2); color: var(--ink); }
.views button.active { background: var(--ink); color: #fff; }
.viewbar .views button.summary-tab { position: relative; margin-left: 5px; }
.viewbar .views button.summary-tab::before { content: ""; position: absolute; left: -4px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.views button.summary-tab .new-dot { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--panel); }
.viewbar #reorgBtn { box-shadow: var(--shadow-1); }
.viewbar-right { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
  background: rgba(255, 255, 255, .85); border: 1px solid var(--line); border-radius: 10px; padding: 3px 3px 3px 10px; box-shadow: var(--shadow-1); backdrop-filter: blur(6px); }
.toggle { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; cursor: pointer; white-space: nowrap; }
.viewbar-right .icon-btn { width: 30px; min-height: 30px; }
.suggest {
  font-size: 12px; background: var(--warn-soft); border: 1px solid #f0d58a; color: #6b5310;
  border-radius: 999px; padding: 3px 4px 3px 12px; display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow-1);
}
.suggest button { font-size: 12px; min-height: 24px; padding: 1px 10px; border-radius: 999px; }

/* はじめの表示 */
.empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; pointer-events: none; padding: 80px 24px 24px;
}
.empty-card { max-width: 540px; }
.empty-title, .empty .hint { text-wrap: balance; }
.empty-art { width: 120px; height: 80px; fill: var(--panel); stroke: var(--line-strong); stroke-width: 1.6; stroke-linecap: round; margin-bottom: 10px; }
.empty-art circle:nth-of-type(3) { fill: var(--accent-soft); stroke: var(--accent); }
.empty-title { font-size: 18px; font-weight: 700; margin: 0 0 8px; letter-spacing: .01em; }
.empty .hint { color: var(--muted); font-size: 13.5px; line-height: 1.8; margin: 0 0 18px; }
.tips { list-style: none; padding: 0; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; width: fit-content; text-align: left; font-size: 12.5px; color: var(--muted); }
.tips li { display: flex; align-items: center; gap: 8px; }
kbd { font-family: inherit; font-size: 11.5px; color: var(--ink-2); background: var(--panel); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; min-width: 64px; text-align: center; }

.legend {
  position: absolute; left: 14px; bottom: 14px;
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 12px; font-size: 11.5px; color: var(--muted);
  max-width: calc(100% - 28px);
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; border: 1.5px solid; }

/* ---------- 右の欄 ---------- */
.side {
  width: 344px; flex-shrink: 0;
  border-left: 1px solid var(--line);
  background: var(--bg);
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; overflow-y: auto;
}
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--tint); border-radius: 10px; }
.tab { flex: 1; border: 0; background: transparent; border-radius: 7px; font-size: 13px; color: var(--muted); min-height: 30px; }
.tab:hover { background: rgba(255, 255, 255, .5); color: var(--ink); }
.tab.active { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.tabpane { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-1); }
.card h2 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 8px; letter-spacing: .03em; display: flex; align-items: center; gap: 6px; }
.card h2 svg.i { width: 14px; height: 14px; }
.card p { margin: 0; line-height: 1.75; font-size: 14px; }
.card p.muted { font-size: 13px; color: var(--faint); }
.card.focus { border-color: #f1d3cb; background: linear-gradient(180deg, #fffaf8, var(--panel)); }
.card.focus h2 { color: var(--accent); }
.card.focus p:not(.muted) { font-size: 16px; font-weight: 700; line-height: 1.6; }
.h-hint { font-weight: 400; font-size: 11px; margin-left: auto; color: var(--faint); letter-spacing: 0; }

.questions { margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 1.6; display: flex; flex-direction: column; gap: 2px; }
.questions li { cursor: pointer; padding: 6px 8px 6px 22px; border-radius: var(--radius-sm); position: relative; }
.questions li::before { content: ""; position: absolute; left: 8px; top: 13px; width: 6px; height: 6px; border-radius: 50%; background: #d69e1f; }
.questions li:not(.muted):not(.fold):hover { background: var(--warn-soft); }
.questions li.muted { cursor: default; padding-left: 0; font-size: 13px; color: var(--faint); }
.questions li.muted::before, .questions li.fold::before { display: none; }
/* 「もっと表示」で追加した問い（F-41） */
.questions li.added { color: var(--ink-2); }
.questions li.added::before { background: transparent; border: 1.5px solid #d69e1f; }
.questions li.fold { font-size: 12px; color: var(--muted); padding-left: 8px; }
.questions li.fold:hover { color: var(--ink); }
.more-q { margin-top: 8px; }

.log-card { flex: 1; min-height: 180px; display: flex; flex-direction: column; }
.log { flex: 1; overflow-y: auto; font-size: 13px; line-height: 1.7; color: var(--ink-2); }
.log .chunk { padding: 5px 0; border-bottom: 1px solid var(--line); }
.log .chunk:last-child { border-bottom: 0; }
.log .chunk.pending { color: var(--muted); }
.log .chunk.error { color: var(--accent); }
.log .chunk .tag { font-size: 10.5px; color: var(--muted); margin-left: 6px; background: var(--tint); border-radius: 999px; padding: 0 7px; }
.interim { font-size: 13px; color: var(--muted); font-style: italic; min-height: 1.5em; padding-top: 4px; }

.chat { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.chat-empty { font-size: 13px; line-height: 1.85; padding: 14px; background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.msg { border-radius: 14px; padding: 10px 13px; font-size: 14px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.msg.q { background: var(--ink); color: #fff; align-self: flex-end; max-width: 88%; border-bottom-right-radius: 4px; }
.msg.q .meta { color: rgba(255, 255, 255, .65); }
.msg.a { background: var(--panel); border: 1px solid #c3e3dc; border-bottom-left-radius: 4px; box-shadow: var(--shadow-1); }
.msg.a.flash { outline: 2px solid #f5b82e; }
.msg.error { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.msg .meta { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; white-space: normal; }
.msg .meta a { color: inherit; cursor: pointer; text-decoration: underline; }
.askbar { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow-1); }
.askbar textarea { font: inherit; font-size: 14px; padding: 6px 8px; border: 0; resize: vertical; background: transparent; color: var(--ink); }
.askbar textarea:focus-visible { outline: none; }
.askbar:focus-within { border-color: var(--line-strong); }
.askbar button[type="submit"] { align-self: flex-end; }
.ask-focus { font-size: 12px; color: var(--ai); background: var(--ai-soft); border-radius: var(--radius-sm); padding: 4px 8px; }

/* ---------- 下の入力欄（マイクと文字入力） ---------- */
.composer {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-top: 1px solid var(--line); background: var(--panel);
  position: relative; z-index: 15;
}
.mic {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 4px 18px 4px 5px; border-radius: 999px;
  font-weight: 700; font-size: 14px; white-space: nowrap;
  background: var(--panel); border: 1px solid var(--line-strong); box-shadow: var(--shadow-1);
}
.mic-icon { position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.mic-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mic .dot { display: none; }
.mic:hover { border-color: var(--accent); background: #fffaf8; }
.mic[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.mic[aria-pressed="true"] .mic-icon { background: #fff; color: var(--accent); animation: pulse 1.4s infinite; }
.mic:disabled .mic-icon { background: var(--faint); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); }
  100% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
}
.composer-input { flex: 1; min-width: 0; display: flex; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 4px 4px 16px; transition: border-color .15s, background-color .15s; }
.composer-input:focus-within { border-color: var(--line-strong); background: var(--panel); }
.composer-input input { flex: 1; min-width: 0; font: inherit; font-size: 14px; border: 0; background: transparent; padding: 7px 0; color: var(--ink); }
.composer-input input:focus-visible { outline: none; }
.composer-input .send { width: 34px; min-height: 34px; padding: 0; border-radius: 50%; background: var(--ink); color: #fff; border: 0; }
.composer-input .send:hover { background: var(--ink-2); }
.composer-input:has(input:disabled) { opacity: .6; }
.status { color: var(--muted); font-size: 12px; line-height: 1.45; max-width: 280px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.status.error { color: var(--accent); }

/* 集中モード（F-33）。話している間は画面をほぼ真っ白にし、マイクの状態と経過時間だけを出す */
.focus-view { position: fixed; inset: 0; z-index: 100; background: #fdfdfb; display: flex; align-items: center; justify-content: center; }
.focus-stop { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 28px 44px; border-radius: 28px; }
.focus-stop:hover { background: #f4f3ef; }
.focus-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); animation: focus-pulse 1.8s infinite; }
.focus-dot.busy { background: #c9a227; animation: none; }
.focus-time { font-size: 15px; color: #a3a6ab; font-variant-numeric: tabular-nums; letter-spacing: .1em; }
@keyframes focus-pulse {
  0% { box-shadow: 0 0 0 0 rgba(217, 87, 63, .45); }
  100% { box-shadow: 0 0 0 14px rgba(217, 87, 63, 0); }
}

/* ---------- 再整理の比較（F-11）。キャンバスと右の欄を覆う。一覧などの画面はこの上に重なる ---------- */
.reorg-view { position: absolute; inset: 0; z-index: 5; background: var(--bg); display: flex; flex-direction: column; padding: 14px 18px 16px; gap: 12px; }
.reorg-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.reorg-head h1 { font-size: 18px; margin: 0; }
.reorg-head .muted { font-size: 12.5px; margin-right: auto; }
.reorg-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reorg-col { display: flex; flex-direction: column; min-height: 0; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); }
.reorg-col:last-child { border-color: #9fd0c4; box-shadow: 0 0 0 3px var(--ai-soft); }
.reorg-label { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); background: var(--panel); }
.reorg-label b { color: var(--ink); font-size: 14px; }
.reorg-match { margin-left: auto; font-size: 12px; min-height: 26px; padding: 2px 10px; border-radius: 999px; }
.reorg-graph { flex: 1; min-height: 240px; position: relative; }

/* ---------- 重ねる画面（一覧・気づき・問い・取り込み） ---------- */
.list-view { position: absolute; inset: 0; z-index: 10; overflow-y: auto; background: var(--bg); padding: 28px 24px 48px; }
.list-head { display: flex; align-items: center; gap: 10px; max-width: 820px; margin: 0 auto 18px; }
.list-head h1 { font-size: 22px; margin: 0; margin-right: auto; letter-spacing: .01em; }
.canvas-list { list-style: none; margin: 0 auto; padding: 0; max-width: 820px; display: flex; flex-direction: column; gap: 10px; }
.canvas-list > li.muted { text-align: center; padding: 32px 0; font-size: 14px; }
.canvas-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s; }
.canvas-item:hover { border-color: var(--line-strong); }
.canvas-item.current { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.canvas-item .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.canvas-item h2 { font-size: 16px; margin: 0; font-weight: 700; }
.canvas-item .date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.canvas-item .open { margin-left: auto; }
.canvas-item .summary { margin: 8px 0 0; font-size: 14px; line-height: 1.75; color: var(--ink-2); }
.badge { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 9px; background: var(--tint); color: var(--ink-2); white-space: nowrap; }
.badge.error { background: var(--accent-soft); color: var(--accent); }
.memo-toggle { margin-top: 10px; font-size: 12px; min-height: 26px; padding: 2px 10px; border-radius: 999px; color: var(--muted); }
.memos { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; line-height: 1.6; }
.memos li { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.memos .kind, .kind-tag { flex-shrink: 0; font-size: 11px; font-weight: 600; border-radius: 5px; padding: 1px 7px; height: fit-content; }
.memos .kind { margin-top: 2px; }
.memos .kind.question, .kind-tag.question { background: #fdf3d6; color: #5c4106; }
.memos .kind.idea, .kind-tag.idea { background: #eaf1fd; color: #1d3a6b; }
.memos .kind.claim, .kind-tag.claim { background: #2b3442; color: #fff; }
.memos .status { font-size: 11px; color: var(--muted); margin-left: 4px; }

/* 気づき欄（F-34）と並べて見る（F-35） */
.list-note { max-width: 820px; margin: 18px auto 0; font-size: 12px; text-align: center; }
.list-filter { max-width: 820px; margin: 0 auto 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.more { display: flex; max-width: 820px; width: 100%; margin: 12px auto 0; font-size: 13px; color: var(--muted); border-style: dashed; background: transparent; }
#insightWeakList { margin-top: 10px; }
.insight .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.insight .lead { font-size: 13px; color: var(--muted); }
.badge.hint { background: #fff1c9; color: #6b5310; }
.badge.similar { background: #e3eefc; color: #1d3a6b; }
.badge.contradiction { background: #fbe3e3; color: #8a2a1c; }
.badge.new { background: var(--accent); color: #fff; }
.insight .reason { margin: 10px 0; font-size: 15px; line-height: 1.75; }
.insight .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.insight .side-memo { border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px; line-height: 1.6; }
.origin { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.insight .actions { display: flex; gap: 8px; margin-top: 12px; }
.insight .actions .sel { background: var(--ink); color: #fff; border-color: var(--ink); }
.insight .actions .compare-btn { margin-left: auto; }
.insight.weak { opacity: .85; }
.compare { max-width: 820px; margin: 0 auto; }
.compare .reason { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; font-size: 15px; line-height: 1.75; margin-bottom: 12px; box-shadow: var(--shadow-1); }
.compare .reason p { margin: 6px 0 0; }
.compare .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare .col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-1); }
.compare .memo-text { font-size: 16px; font-weight: 700; line-height: 1.6; }
.compare .summary { font-size: 14px; line-height: 1.75; margin: 0; color: var(--ink-2); }
.compare .col button { align-self: flex-start; margin-top: auto; }
.kind-tag { margin-right: 6px; vertical-align: 1px; }

/* まとまりかけている考え（熟成提案、F-32） */
.synthesis-section { max-width: 820px; margin: 0 auto 24px; }
.synthesis-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.synthesis-head h2, .list-subhead { font-size: 15px; margin: 0; }
.synthesis-head button { margin-left: auto; }
.synthesis-status { font-size: 12px; margin: 6px 0 10px; }
.list-subhead { max-width: 820px; margin: 0 auto 10px; }
.badge.synthesis { background: #e2f4ea; color: #14532d; }
.synthesis-item { border-color: #cfe7da; background: linear-gradient(180deg, #fbfefc, var(--panel)); }
.synthesis-item .title { font-size: 17px; margin: 10px 0 4px; }
.synthesis-item .body { margin: 0 0 10px; font-size: 15px; line-height: 1.75; }
.fragments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fragments button { display: block; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 12px; background: var(--panel); font-size: 14px; line-height: 1.6; }
.fragments button:hover { border-color: var(--ink); background: var(--panel); }

/* 問い一覧（F-36） */
#questionFilter { display: flex; width: fit-content; margin-left: max(0px, calc((100% - 820px) / 2)); }
.question-item .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.question-item .text { font-size: 15px; line-height: 1.6; flex: 1 1 320px; font-weight: 600; }
.question-item .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.question-item .actions button { font-size: 12.5px; min-height: 28px; }
.badge.open { background: var(--tint); }
.badge.hinted { background: #fff1c9; color: #6b5310; }
.badge.resolved { background: #dff1e7; color: #14532d; }
.question-item.resolved .text { color: var(--muted); font-weight: 400; text-decoration: line-through; text-decoration-color: var(--line-strong); }

/* ---------- まとめ表示（F-37）。グラフの上に重ね、ビューバーは上に残す ---------- */
.summary-view { position: absolute; inset: 0; z-index: 1; overflow-y: auto; background: var(--bg); padding: 72px 24px 40px; }
.summary-view > * { max-width: 820px; margin-left: auto; margin-right: auto; }
.summary-view section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px; box-shadow: var(--shadow-1); }
.summary-view h2 { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; letter-spacing: .03em; }
.summary-view h2 i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.summary-view h3 { font-size: 12px; color: var(--muted); font-weight: 600; margin: 12px 0 2px; }
.summary-view h3:first-of-type { margin-top: 0; }
.summary-view p { margin: 0; font-size: 15px; line-height: 1.8; }
.summary-view p + p { margin-top: 8px; }
.summary-view .label { display: block; font-size: 11px; color: var(--muted); }
.summary-view ul { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.85; }
.summary-view li, .summary-view td.text { cursor: pointer; }
.summary-view li:hover, .summary-view tr:hover td.text { color: var(--accent); }
.summary-view .w3 { font-weight: 700; }
.summary-view table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.6; }
.summary-view th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.summary-view td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.summary-view td.rel { color: var(--muted); font-size: 13px; }
.summary-view td.weight { white-space: nowrap; color: #d69e1f; letter-spacing: 1px; }
.summary-view .group-row td { font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 0; padding-top: 12px; }
.summary-view .empty-note { color: var(--muted); font-size: 14px; text-align: center; padding: 40px 0; }

/* ---------- テキストの取り込み（F-39, F-40） ---------- */
.import-form, .import-preview { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.import-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-1); }
.import-preview { margin-top: 18px; }
.import-form .lead { margin: 0; font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.import-form code { background: var(--tint); border-radius: 4px; padding: 0 5px; font-size: 13px; }
.import-form textarea { width: 100%; font: inherit; font-size: 14px; line-height: 1.65;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--ink); resize: vertical; }
.import-form textarea:focus { background: var(--panel); }
.import-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.import-row .muted { font-size: 13px; }
.import-row .primary { margin-left: auto; }
.field { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.field input[type="date"] { font: inherit; font-size: 13px; color: var(--ink); padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.import-summary { margin: 0; font-size: 14px; }
.import-summary.error { color: var(--accent); }
.import-section .row input[type="date"] { font: inherit; font-size: 13px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; }
.import-section .time { font-size: 12px; color: var(--muted); }
.import-section .chars { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.import-section .body { margin: 8px 0 0; font-size: 13px; line-height: 1.65; color: var(--muted); white-space: pre-wrap;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.import-section.too-long { border-color: var(--accent); }

/* ---------- 画面が狭いとき ---------- */
@media (max-width: 1180px) {
  .brand .sub { max-width: 160px; }
  .cost { display: none; }
}
@media (max-width: 1000px) {
  .nav-item .lbl, .topbar-right .lbl { display: none; }
  .nav-item { padding: 4px 9px; }
  .nav-item .count { margin-left: 0; }
  .status { max-width: 140px; }
}
@media (max-width: 800px) {
  .topbar { gap: 10px; padding: 0 10px; }
  .brand-text { display: none; }
  .layout { flex-direction: column; }
  .canvas-wrap { min-height: 55vh; }
  .side { width: auto; border-left: 0; border-top: 1px solid var(--line); }
  .composer { flex-wrap: wrap; padding: 8px 10px; }
  .views { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .viewbar-right { padding: 3px; }
  .viewbar-right .toggle, .legend { display: none; }
  #graph { bottom: 0; }
  .composer-input { order: 3; flex-basis: 100%; }
  .status { flex: 1; max-width: none; }
  .reorg-cols, .insight .pair, .compare .cols { grid-template-columns: 1fr; }
  .tips { grid-template-columns: 1fr; }
  .list-view { padding: 18px 12px 40px; }
}

/* ---------- スマホ幅（v3-5、F-60）。640px 以下だけ。PC の画面は変えない ---------- */
@media (min-width: 641px) {
  .mobile-only, .mobile-tabs, .sheet-backdrop { display: none !important; }
}
@media (max-width: 640px) {
  :root { --tabs-h: 58px; }
  body { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); }
  /* 上：キャンバス名・閉じる・メニューだけ。画面の切り替えは下のタブ、新規・一覧・設定はメニューへ */
  .topbar { height: 52px; gap: 8px; padding: 0 8px 0 12px; }
  .brand-text { display: flex; min-width: 0; }
  .brand-name { display: none; }
  .brand .sub { max-width: none; font-size: 14px; font-weight: 600; color: var(--ink); }
  .brand { flex: 1; min-width: 0; }
  .nav, #newBtn, #costMeter, #summaryTab, #settingsBtn { display: none !important; }
  #closeBtn .lbl { display: inline; }
  .menu-note { margin: 2px 10px 6px; font-size: 12px; color: var(--muted); }
  .menu-note:empty { display: none; }
  /* マップを画面いっぱいに */
  .layout { flex-direction: column; }
  .canvas-wrap { flex: 1; min-height: 0; }
  #graph { touch-action: none; }
  .viewbar { padding: 8px 8px 0; gap: 6px; }
  .empty-card .tips { display: none; }
  .panel-btn { position: absolute; right: 12px; bottom: 12px; z-index: 3; border-radius: 999px; min-height: 40px; padding: 6px 14px;
    background: var(--panel); border: 1px solid var(--line-strong); box-shadow: var(--shadow-2); font-weight: 600; }
  /* サイドパネルは、下から引き出すシート */
  .side { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); z-index: 45;
    width: auto; max-height: 70vh; border: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 32px rgba(31, 35, 40, .16); padding-top: 6px;
    transform: translateY(calc(100% + var(--tabs-h) + 40px)); visibility: hidden; transition: transform .22s ease, visibility .22s; }
  body.panel-open .side { transform: none; visibility: visible; }
  .canvas-wrap:has(#summaryView:not([hidden])) .panel-btn { display: none; }
  .sheet-handle { align-self: stretch; width: auto; min-height: 24px; padding: 0; border: 0; background: transparent; flex-shrink: 0; touch-action: none; }
  .sheet-handle::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto; border-radius: 2px; background: var(--line-strong); }
  .sheet-handle:hover { background: transparent; }
  .sheet-backdrop { position: fixed; inset: 0; z-index: 44; background: rgba(31, 35, 40, .28); }
  /* 下の入力：文字入力と、右に親指で押せる大きなマイク */
  .composer { flex-wrap: wrap; gap: 6px 10px; padding: 6px 12px 10px; }
  .composer .status { order: 0; flex-basis: 100%; max-width: none; -webkit-line-clamp: 1; font-size: 11.5px; min-height: 16px; }
  .composer-input { order: 1; flex: 1; flex-basis: auto; }
  .composer-input input { font-size: 16px; } /* 16px 未満だと、iPhone は入力のたびに画面を拡大する */
  #flushBtn { order: 2; }
  .composer .pop { order: 3; position: static; }
  .mic { order: 4; width: 64px; height: 64px; min-height: 64px; padding: 0; border-radius: 50%; justify-content: center; flex-shrink: 0; }
  .mic-icon { width: 54px; height: 54px; }
  .mic-icon svg { width: 26px; height: 26px; }
  #micLabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* 入力の設定は、メニューから下のシートとして開く */
  #settings { position: fixed; left: 8px; right: 8px; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px); top: auto; min-width: 0; z-index: 60; }
  /* 下のタブ */
  .mobile-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--panel); border-top: 1px solid var(--line); }
  .mobile-tabs button { position: relative; flex-direction: column; gap: 2px; border: 0; border-radius: 0; background: transparent;
    color: var(--muted); font-size: 11px; min-height: var(--tabs-h); padding: 6px 0 4px; }
  .mobile-tabs button svg.i { width: 22px; height: 22px; }
  .mobile-tabs button[aria-current="page"] { color: var(--ink); font-weight: 600; }
  .mobile-tabs button[aria-current="page"] svg.i { color: var(--accent); }
  .mobile-tabs .count { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; }
  .mobile-tabs .new-dot { position: absolute; top: 8px; left: calc(50% + 10px); width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
  .list-view { padding: 16px 12px 32px; }
  .summary-view { padding: 64px 12px 32px; }
  /* タップしたノードのシート */
  .node-sheet { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); z-index: 46;
    max-height: 60vh; overflow-y: auto; background: var(--panel); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 32px rgba(31, 35, 40, .16); padding: 10px 16px 14px; }
  .node-sheet-head { display: flex; align-items: center; justify-content: space-between; touch-action: none; }
  .node-kind { font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
  .node-kind i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; border: 1.5px solid; }
  .node-label { font-size: 16px; font-weight: 600; margin: 4px 0 8px; line-height: 1.5; }
  .node-rename { display: flex; gap: 6px; margin: 4px 0 8px; }
  .node-rename input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
  .node-sources { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
  .node-sources:empty { display: none; }
  .node-sources p { margin: 4px 0; padding-left: 10px; border-left: 2px solid var(--line); }
  .node-sources .label { font-size: 11.5px; color: var(--muted); }
  .node-actions { display: flex; gap: 8px; margin-top: 12px; }
  .node-actions button { flex: 1; min-height: 44px; }
  button.danger-ghost { color: var(--accent); border-color: #f0c9c0; }
}

/* ---------- ホスト版のアカウント（v3-4） ---------- */
.account-view { position: fixed; inset: 0; z-index: 200; background: var(--bg); overflow-y: auto;
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 40px; }
.account-card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 26px 24px 22px; }
.account-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 14px; }
.account-step h1 { font-size: 20px; margin: 0 0 8px; }
.account-step .lead { color: var(--ink-2); line-height: 1.7; margin: 0 0 16px; }
.account-step .stack { display: flex; flex-direction: column; gap: 10px; }
.account-step .field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.account-step .field input { font: inherit; font-size: 15px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--ink); background: var(--panel); }
.account-step button.wide { width: 100%; justify-content: center; min-height: 40px; margin-top: 8px; }
.account-step .or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 16px 0 6px; }
.account-step .or::before, .account-step .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.account-message { margin: 14px 0 0; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.account-message.error { color: var(--accent); }
.account-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 16px; }
.link-btn { border: 0; background: transparent; color: var(--muted); padding: 4px 0; min-height: 0; font-size: 12.5px; text-decoration: underline; }
.link-btn:hover { background: transparent; color: var(--ink); }
.consent-text { font-size: 13.5px; line-height: 1.75; color: var(--ink-2); max-height: 50vh; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 14px; background: var(--panel-2); }
.consent-text ul { padding-left: 1.2em; margin: 8px 0; }
.consent-text li { margin: 6px 0; }
.withdraw-list { margin: 0 0 12px; padding-left: 1.2em; line-height: 1.8; }
.account-step .check { display: flex; align-items: center; gap: 8px; margin: 16px 0 4px; font-size: 13.5px; }
button.danger { background: var(--accent); color: #fff; border-color: var(--accent); }
button.danger:hover { background: #c24a33; border-color: #c24a33; }
button.danger:disabled { opacity: .45; }
.cap-banner { padding: 8px 16px; background: var(--warn-soft); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); text-align: center; }
.log .chunk.held { color: var(--ink-2); }
/* 通信が切れているときの小さな印（F-62） */
.offline-badge { font-size: 11.5px; font-weight: 600; color: #8a5a00; background: var(--warn-soft); border: 1px solid #f1dfa6;
  border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.log .chunk.waiting { color: var(--ink-2); }
.setting-note { margin: 6px 10px 4px; font-size: 12px; line-height: 1.6; color: var(--muted); }
/* 保存の衝突（F-71） */
.conflict-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px;
  padding: 10px 16px; background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink); }
.conflict-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; }
