:root {
  /* benriz のブランドカラー: 濃い緑 #0e3b2c・明るい緑 #4be08a。テーマを足すときは theme.js の BG にも背景の色を足す */
  --bg: #f5f8f4;
  --surface: #ffffff;
  --fg: #12261d;
  --muted: #5d7267;
  --line: #dbe6dd;
  --hover: #eaf2ea;
  --accent: #17794a;
  --primary: #0e3b2c;
  --primary-fg: #ffffff;
  --logo: #0e3b2c;
  --chip: #e4ede5;
  --danger: #d1453b;
  --ok: #1f9d55;
  --session: #7c4dcc;
  --mark: #fde68a;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI",
    "Segoe UI", "Noto Sans JP", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
:root[data-theme="light"] { color-scheme: light; }
:root:is([data-theme="dark"], [data-theme="earth"], [data-theme="brand"]) { color-scheme: dark; }

/* ダーク: テーマを選んでいないときは、端末の設定がダークならこれになる。下の [data-theme="dark"] と同じ値にそろえる */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #171918;
    --surface: #1f2221;
    --fg: #e6e9e6;
    --muted: #8d948f;
    --line: #2d312f;
    --hover: #272b29;
    --accent: #4be08a;
    --primary: #4be08a;
    --primary-fg: #082619;
    --logo: #e6e9e6;
    --chip: #2a2e2c;
    --danger: #ec6a60;
    --ok: #2fb866;
    --session: #a98bf0;
    --mark: #6e5a10;
  }
}
:root[data-theme="dark"] {
  --bg: #171918;
  --surface: #1f2221;
  --fg: #e6e9e6;
  --muted: #8d948f;
  --line: #2d312f;
  --hover: #272b29;
  --accent: #4be08a;
  --primary: #4be08a;
  --primary-fg: #082619;
  --logo: #e6e9e6;
  --chip: #2a2e2c;
  --danger: #ec6a60;
  --ok: #2fb866;
  --session: #a98bf0;
  --mark: #6e5a10;
}
/* アース: こげ茶のダーク */
:root[data-theme="earth"] {
  --bg: #1f1814;
  --surface: #281f1a;
  --fg: #ece4da;
  --muted: #a39483;
  --line: #3a2e26;
  --hover: #32271f;
  --accent: #7ccf8f;
  --primary: #7ccf8f;
  --primary-fg: #1a130f;
  --logo: #ece4da;
  --chip: #362a22;
  --danger: #ee7a68;
  --ok: #3fae6a;
  --session: #c3a6f2;
  --mark: #6b5312;
}
/* ブランド: 濃い緑のダーク */
:root[data-theme="brand"] {
  --bg: #082619;
  --surface: #0d3122;
  --fg: #eef6f0;
  --muted: #9db8ab;
  --line: #174634;
  --hover: #113a2a;
  --accent: #4be08a;
  --primary: #4be08a;
  --primary-fg: #082619;
  --logo: #ffffff;
  --chip: #154131;
  --danger: #ff8a7a;
  --ok: #2fb866;
  --session: #c9b2ff;
  --mark: #7a6a14;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.grow { flex: 1; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--primary); color: var(--primary-fg); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { color: var(--fg); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--danger); }
.btn.round { width: 34px; padding: 0; justify-content: center; border-radius: 50%; }
.btn.primary.round:disabled { background: var(--chip); color: var(--muted); opacity: 1; }
.delete-btn { margin-right: 10px; }
.btn.small { height: 28px; padding: 0 9px; font-size: 13px; }
.btn.big { height: 46px; padding: 0 22px; font-size: 16px; }

/* ---------- 上部バー ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px
    max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.02em; margin-right: 8px; }
/* 正式ロゴ（/icons/benriz-logo.svg）を型抜きにして、テーマごとの色（--logo）で塗る */
.logo {
  display: inline-block;
  height: 18px;
  aspect-ratio: 3344.4 / 784.2;
  background: var(--logo);
  -webkit-mask: url(/icons/benriz-logo.svg) center / contain no-repeat;
  mask: url(/icons/benriz-logo.svg) center / contain no-repeat;
}
.brand-sub { font-size: 13px; font-weight: 600; color: var(--muted); }
.search {
  width: min(280px, 36vw);
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
}
.search:focus { border-color: var(--accent); }

/* ---------- ログイン ---------- */
.login {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}
.login-brand { font-size: 40px; margin: 0; letter-spacing: 0.02em; line-height: 1; }
.login-brand .logo { height: 44px; }
.login .muted { margin: 0 0 20px; }
.login-error { color: var(--danger); margin: 0; }
/* claude.ai 連携の許可画面（src/oauth.ts がサーバー側で組み立てる） */
.consent { max-width: 460px; margin: 0 auto; }
.consent h2 { font-size: 20px; margin: 0; }
.consent p { margin: 0; }
.consent-actions { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }
.consent-warn {
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  font-size: 14px;
  text-align: left;
}
.consent-warn p + p { margin-top: 4px; }

/* ---------- 一覧 ---------- */
.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}
.side { position: sticky; top: 76px; align-self: start; max-height: calc(100dvh - 96px); overflow: auto; }
.side-section { margin-bottom: 24px; }
.side-section h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 6px 8px;
  letter-spacing: 0.04em;
}
.side-item {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 3px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}
.side-item:hover { background: var(--hover); }
.side-item.on { background: var(--chip); font-weight: 600; }
.side-item.lv2 { padding-left: 22px; }
.side-item.lv3 { padding-left: 36px; }
.count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.main { min-width: 0; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.active-filters:empty { display: none; }
.result-count { margin: 0 0 4px 16px; }
.entries { display: flex; flex-direction: column; gap: 4px; }
.card {
  display: block;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.card:hover { background: var(--surface); border-color: var(--line); }
.card-title { margin: 0; font-size: 18px; line-height: 1.4; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-meta .tag { color: var(--accent); }
.card-body {
  margin-top: 6px;
  font-size: 14px;
  color: color-mix(in srgb, var(--fg) 82%, var(--bg));
  max-height: 8.5em;
  overflow: hidden;
  mask-image: linear-gradient(#000 70%, transparent);
  -webkit-mask-image: linear-gradient(#000 70%, transparent);
}
.empty { padding: 40px 0; text-align: center; }
.more { margin: 16px auto 0; display: flex; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--chip);
  font-size: 13px;
  cursor: pointer;
}
.chip.on { color: var(--accent); }
.chip-x { border: 0; background: none; padding: 0 0 0 2px; cursor: pointer; color: var(--muted); font-size: 14px; }

/* Markdown 表示 */
/* 検索語のハイライト */
mark { background: var(--mark); color: inherit; border-radius: 2px; }
.md h1, .md h2, .md h3 { margin: 0.4em 0 0.1em; line-height: 1.4; }
.md h1 { font-size: 1.3em; }
.md h2 { font-size: 1.15em; }
.md h3 { font-size: 1.05em; }
.md p { margin: 0.15em 0; }
.md ul { margin: 0.15em 0; padding-left: 1.3em; }
.blk-view a { color: var(--accent); overflow-wrap: anywhere; }

/* ---------- エディタ ---------- */
.editor, .settings {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px max(16px, env(safe-area-inset-right)) calc(120px + env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}
.title-row { display: flex; align-items: baseline; gap: 12px; }
.title-time,
.title-input {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
}
.title-time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.title-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  padding: 0;
  color: inherit;
  font-family: inherit;
  resize: none;
  overflow: hidden;
}
.title-input::placeholder { font-weight: 400; }
.title-input.quiet:not(:focus)::placeholder { color: transparent; }
.stamp { margin: 4px 0 0; }

.blocks { margin: 20px 0 32px; min-height: 30vh; cursor: text; }
.blk { position: relative; }
.blk textarea,
.blk-view {
  display: block;
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  background: none;
  padding: 2px 0;
  line-height: 1.7;
  min-height: 1.7em;
}
/* 太字のある行は、書いていないあいだは記号（**）を隠して太字で見せる */
.blk-view { display: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.blk.show-view textarea { display: none; }
.blk.show-view .blk-view { display: block; }
.blk textarea::placeholder { color: var(--muted); }
.blk[data-kind="h1"] :is(textarea, .blk-view) { font-size: 26px; font-weight: 700; line-height: 1.4; padding-top: 14px; }
.blk[data-kind="h2"] :is(textarea, .blk-view) { font-size: 21px; font-weight: 700; line-height: 1.4; padding-top: 10px; }
.blk[data-kind="h3"] :is(textarea, .blk-view) { font-size: 18px; font-weight: 600; line-height: 1.4; padding-top: 6px; }
.blk[data-kind="li"] { padding-left: 1.4em; }
.blk[data-kind="li"]::before {
  content: "";
  position: absolute;
  left: 0.5em;
  top: calc(2px + 0.85em - 2.5px);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fg);
}

/* 音声入力 */
.voice-row { display: flex; align-items: center; gap: 8px; margin: -20px 0 12px; min-height: 34px; }
.voice-btn.on { color: #fff; background: #e5484d; animation: voice-pulse 1.4s ease-in-out infinite; }
.voice-interim { min-width: 0; overflow-wrap: anywhere; }
@keyframes voice-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, #e5484d 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .voice-btn.on { animation: none; } }
/* 引用（X の引用リポストと同じ形） */
.quote-card {
  display: block;
  margin: 8px 0 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}
.editor .quote-card { margin: -16px 0 20px; }
.editor .voice-row + .quote-card { margin-top: 0; }
.quote-card:hover { border-color: var(--muted); }
.quote-card.deleted { cursor: default; }
.quote-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.quote-title { font-weight: 600; }
.quote-body { color: color-mix(in srgb, var(--fg) 82%, var(--bg)); max-height: 5.5em; overflow: hidden; }
.tags-section { border-top: 1px solid var(--line); padding-top: 14px; }
.tagpicker { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.picked { display: contents; }
.tag-field { flex: 1 1 100%; min-width: 160px; }
/* iOS Safari は 16px 未満の入力欄にフォーカスすると自動ズームするので 16px にする */
.tag-input {
  width: 100%;
  height: 32px;
  border: 0;
  outline: none;
  background: none;
  font-size: 16px;
  cursor: pointer; /* クリックで候補が開くことが分かるように指の形にする */
}
.tag-input:focus { cursor: text; }
/* タグの候補は、押せる札として入力欄の下に並べる（PC もスマホも同じ。位置を計算しないので、キーボードが出てもずれない） */
.suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}
.suggest[hidden] { display: none; }
.suggest li {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
}
/* 長い名前は省略して、横にはみ出さないようにする */
.suggest li > span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 札は画面の幅より広げない（広がると右側が切れて、札に見えなくなる） */
.suggest li { max-width: 100%; }
.suggest li.create { color: var(--accent); }
/* 「＋ #名前 を作る」は省略せずに折り返す（名前が長くても「を作る」まで見えるように）。2行になっても形が崩れないよう、角を小さくする */
.suggest li.create { border-radius: 16px; }
.suggest li.create > span { white-space: normal; overflow-wrap: anywhere; }
/* on: キーボードの ↑↓ で選んでいる札（入力欄にいるあいだだけ付く） */
.suggest li.on { background: var(--hover); }
/* :hover の色はマウスのある端末だけ（iPhone は、押したあとに指の下へ来た別の札に :hover が残る） */
@media (hover: hover) {
  .suggest li:hover { background: var(--hover); }
}
.suggest li.none { padding: 6px 0; border: 0; background: none; cursor: default; font-size: 13px; }
.suggest .tag-name { font-size: 14px; }
.field-error { color: var(--danger); font-size: 13px; margin: 6px 0 0; }

/* ---------- 設定 ---------- */
.settings h1 { font-size: 28px; margin: 0 0 20px; }
.settings section { margin-bottom: 40px; }
.settings h2 { font-size: 17px; margin: 0 0 4px; }
.settings input {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
  min-width: 0;
}
.settings input:focus { border-color: var(--accent); }
.lang-select,
.theme-select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
}
.tag-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 44px auto auto;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.tag-row.add { grid-template-columns: auto minmax(0, 1fr) auto; margin-top: 8px; }
.hash { color: var(--muted); }
.token-form { display: flex; gap: 6px; margin: 12px 0; }
.invite-email { overflow-wrap: anywhere; }

/* ---------- プライバシーポリシーなどの文書ページ ---------- */
.doc {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-right)) 64px max(16px, env(safe-area-inset-left));
  line-height: 1.8;
}
.doc h1 { font-size: 26px; margin: 24px 0 4px; }
.doc h2 { font-size: 17px; margin: 28px 0 6px; }
.doc a { color: var(--accent); }
.doc .brand { color: var(--fg); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0; }
.legal-links { margin-top: 24px; font-size: 13px; }
.legal-links a { color: var(--muted); }
.token-form input { flex: 1; }
.token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.steps { margin: 8px 0 12px; padding-left: 1.4em; line-height: 1.8; }
.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 12px;
  vertical-align: middle;
}
.update-hint { margin: 4px 0 0; }
.update-steps { display: block; margin-top: 2px; }
.update-banner { margin: 0 0 16px; }
/* どの AI の行も同じ形にする: 文章の下に、左端にそろえてボタンを置く（文章の長さでボタンの位置が変わらないように） */
.update-banner p {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  font-size: 14px;
}
.settings h3.sub { font-size: 14px; margin: 20px 0 0; }
.code-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.code-row code {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface);
  font: 12px/1.5 var(--mono);
  word-break: break-all;
}

/* ---------- トースト ---------- */
#toast {
  position: fixed;
  left: 50%;
  /* --toast-lift: キーボードなどで隠れている高さ（app.js の toast で入れる） */
  bottom: calc(24px + env(safe-area-inset-bottom) + var(--toast-lift, 0px));
  transform: translate(-50%, 20px);
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast[data-kind="error"] { background: var(--danger); color: #fff; }
#toast[data-kind="ok"] { background: var(--ok); color: #fff; }
/* アイコンだけの丸いバッジ（保存したときの ✓） */
#toast.badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.25);
}
#toast.badge svg { width: 30px; height: 30px; stroke-width: 3; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 下から、見えている範囲の真ん中より少し上（80px。画面の上で約15ミリ）まで跳ね上がり、頂点で止まって、その場で消える。
   ✓ は高さ 52px、下端から 24px のところから出るので、真ん中までは「高さの半分 − 50px」。そこからさらに 80px 上げる */
#toast.jump {
  /* --toast-view: 見えている範囲の高さ（app.js の toast で入れる） */
  --apex: calc(-0.5 * var(--toast-view, 100vh) - 30px + env(safe-area-inset-bottom));
  animation: toast-jump 1.3s both;
}
@keyframes toast-jump {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(0.9); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  8% { opacity: 1; }
  35% { opacity: 1; transform: translate(-50%, var(--apex)) scale(1.1); }
  75% { opacity: 1; transform: translate(-50%, var(--apex)) scale(1.1); animation-timing-function: ease-in; }
  100% { opacity: 0; transform: translate(-50%, var(--apex)) scale(1.25); }
}

@media (prefers-reduced-motion: reduce) {
  #toast.jump { animation: none; }
}

/* ---------- 引っぱって更新 ---------- */
.ptr {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 8px);
  z-index: 20;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-top: -46px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.18);
  opacity: 0;
  transform: translate(-50%, 0);
  transition: transform 0.2s, opacity 0.2s;
  pointer-events: none;
}
.ptr.dragging { transition: none; }
.ptr.ready { color: var(--accent); }
.ptr.spin svg { animation: ptr-spin 0.8s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* 絞り込みが効いているときは、絞り込みボタンに色を付ける */
.filter-toggle.active { color: var(--accent); background: var(--chip); }
.filter-toggle[aria-expanded="true"] { background: var(--hover); }

/* ---------- スマホ ---------- */
.only-mobile { display: none; }
@media (max-width: 760px) {
  .only-mobile { display: inline-flex; }
  .layout { display: block; padding-top: 12px; }
  .side {
    display: none;
    position: static;
    max-height: none;
    padding: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }
  .side.open { display: block; }
  .topbar { flex-wrap: wrap; }
  .search { order: 10; width: 100%; flex-basis: 100%; }
  .brand { margin-right: 2px; }
  .card { padding: 12px 4px; border-radius: 0; border-bottom: 1px solid var(--line); }
  .result-count { margin-left: 4px; }
  .title-time,
  .title-input { font-size: 26px; }
  /* スマホでは時刻の下の行にタイトルを置く（長いタイトルが横にはみ出さないように） */
  .title-row { flex-direction: column; align-items: stretch; gap: 0; }
  .title-input { flex: none; width: 100%; }
  .tag-row { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .tag-row .count { display: none; }
  .tag-row.add { grid-template-columns: auto minmax(0, 1fr) auto; }
  .token-row { grid-template-columns: minmax(0, 1fr) auto; }
  .token-row > :nth-child(2) { display: none; }
}

/* 幅のとても狭い画面では、ロゴの横の「タイムライン」を隠す（上部バーのボタンが2段目に落ちるため） */
@media (max-width: 359px) {
  .brand-sub { display: none; }
}

/* ---------- セッション（エントリの続き） ---------- */
.reply-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 6px; }
.reply-note { display: inline-block; }
.author-select {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}
.reply-note:hover { color: var(--accent); }
.session { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 14px; }
.session:empty { display: none; }
.session h2 { font-size: 15px; margin: 0 0 8px; }
.session p { margin: 8px 0 0; }
.session-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.session-item {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  border-left: 3px solid var(--line);
  border-radius: 0 6px 6px 0;
}
.session-item:hover { background: var(--hover); }
.session-item.on { border-left-color: var(--accent); background: var(--chip); }
.session-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.session-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.session-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who { font-size: 12px; padding: 0 6px; border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.who.ai { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.session-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.session-actions .btn { border: 1px solid var(--line); }
.card-meta .session-badge { color: var(--session); }
.card-title.in-session { color: var(--session); }

/* 長押しメニュー（画面の下から出る） */
@media (pointer: coarse) {
  .card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(0 0 0 / 0.35);
}
.sheet {
  width: min(100%, 480px);
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 14px 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sheet-title { margin: 2px 4px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-btn {
  height: 48px;
  border: 0;
  border-radius: var(--radius);
  background: var(--hover);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
.sheet-btn.cancel { background: none; color: var(--muted); }
