/* MyTANA — 比較リスト管理画面
   色はすべて :root の変数で定義する。ダークはメディアクエリと data-theme の両方で
   「変数の再定義だけ」を行い、部品側の CSS には素の色を書かない。
   角丸は 3px（ダイアログ・パレットのみ 8px）。影はパレットとダイアログだけ薄く残す。 */

:root {
  /* 面と文字 */
  --bg: #eef1f0;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --surface-3: #eceeed;
  --border: #e1e5e3;
  --border-strong: #c6cecb;
  --text: #141a19;
  --text-muted: #68726f;
  --text-faint: #98a19e;

  /* アクセント */
  --accent: #1b5464;
  --accent-hover: #153f4c;
  --accent-soft: #e3ecef;
  --accent-on: #ffffff;

  /* 行の状態（ホバー・選択は背景 bg で示す） */
  --row-hover: #eef1f0;
  --row-selected: #eef1f0;
  --row-resolved: #f7f9f8;

  /* アーカイブ帯（琥珀） */
  --amber-bg: #fdf3dd;
  --amber-fg: #7a5310;
  --amber-border: #e6cd97;

  /* 画像で並べる見方の、Google のファイルの種類の札（各サービスの色に寄せる） */
  --gfile-doc: #1a63c9;
  --gfile-sheet: #17773a;
  --gfile-slide: #a85c00;
  --gfile-form: #6a42b0;
  --gfile-pdf: #b3261e;
  --gfile-file: #4f5b58;

  /* 評価の色は既存運用の標準。テーマに関係なく固定する（他の資料と見た目を揃えるため） */
  --rate-a-bg: #f4cccc;
  --rate-a-fg: #cc0000;
  --rate-b-bg: #fce5a6;
  --rate-b-fg: #5c4405;
  --rate-c-bg: #d9ead3;
  --rate-c-fg: #38761d;
  /* 左の一覧・カードの評価の点。上の地色は薄くて白地では見えないので、同じ系統の濃いめ
     （スプレッドシートの標準色の赤・黄・緑） */
  --rate-a-dot: #e06666;
  --rate-b-dot: #f1c232;
  --rate-c-dot: #6aa84f;

  --danger: #b3261e;
  --overlay: rgba(16, 23, 23, .38);
  /* 影はパレット・ダイアログ専用 */
  --shadow-pop: 0 8px 24px rgba(16, 23, 23, .14);

  --font-body: "IBM Plex Sans JP", system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  --font-head: "Murecho", "IBM Plex Sans JP", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --topbar-h: 48px;
  --tabs-h: 40px;
  --sidebar-w: 200px;
  --detail-w: 360px;
  --radius: 3px;
  --radius-lg: 8px;
}

@media (min-width: 1440px) {
  :root { --detail-w: 420px; }
}

/* OS の設定がダークのとき（明示的にライトを選んでいない場合だけ効かせる） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101717;
    --surface: #182121;
    --surface-2: #1d2726;
    --surface-3: #233030;
    --border: #2c3939;
    --border-strong: #3d4a49;
    --text: #e4ebea;
    --text-muted: #93a1a0;
    --text-faint: #73817f;

    --accent: #76b3c5;
    --accent-hover: #8fc4d4;
    --accent-soft: #1c2f36;
    --accent-on: #0f1a1d;

    --row-hover: #101717;
    --row-selected: #101717;
    --row-resolved: #141c1c;

    --amber-bg: #3a2d13;
  --gfile-doc: #8ab4f8;
  --gfile-sheet: #81c995;
  --gfile-slide: #fdd663;
  --gfile-form: #c5a8f5;
  --gfile-pdf: #f28b82;
  --gfile-file: #a9b6b3;
    --amber-fg: #f0ce86;
    --amber-border: #5d4a22;

    --danger: #f2b8b5;
    --overlay: rgba(0, 0, 0, .55);
    --shadow-pop: 0 8px 24px rgba(0, 0, 0, .5);
  }
}

/* 明示的にダークを選んだとき（OS がライトでも勝つ） */
:root[data-theme="dark"] {
  --bg: #101717;
  --surface: #182121;
  --surface-2: #1d2726;
  --surface-3: #233030;
  --border: #2c3939;
  --border-strong: #3d4a49;
  --text: #e4ebea;
  --text-muted: #93a1a0;
  --text-faint: #73817f;

  --accent: #76b3c5;
  --accent-hover: #8fc4d4;
  --accent-soft: #1c2f36;
  --accent-on: #0f1a1d;

  --row-hover: #101717;
  --row-selected: #101717;
  --row-resolved: #141c1c;

  --amber-bg: #3a2d13;
  --gfile-doc: #8ab4f8;
  --gfile-sheet: #81c995;
  --gfile-slide: #fdd663;
  --gfile-form: #c5a8f5;
  --gfile-pdf: #f28b82;
  --gfile-file: #a9b6b3;
  --amber-fg: #f0ce86;
  --amber-border: #5d4a22;

  --danger: #f2b8b5;
  --overlay: rgba(0, 0, 0, .55);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, .5);
}

:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  /* 上部バー / ジャンルタブ / 作業領域。ページ自体は縦にも横にもスクロールさせない */
  display: grid;
  grid-template-rows: var(--topbar-h) var(--tabs-h) minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 700; margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* 数字（件数・価格・日付）は mono＋タブラー数字で右揃えにする */
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* 線画アイコン共通 */
.icon { width: 16px; height: 16px; flex: none; display: block; }

.kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 4px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
}

/* ---------- 上部バー ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

/* 左上のロゴ。ログイン画面と同じ SVG（1590×387）を型抜きに使い、色は --accent にする。
   SVG は #1b5464 の1色なので、明るい画面では元のロゴと同じ色、暗い画面では明るい青緑になる */
.brand {
  width: 90px;
  height: 22px;
  margin-right: 4px;
  background-color: var(--accent);
  -webkit-mask: url("/assets/login-logo.svg") center / contain no-repeat;
  mask: url("/assets/login-logo.svg") center / contain no-repeat;
  flex: none;
}

/* ロゴと、いま動いている画面の版（v105 など）。版を押すと、新しい版が出ていないか確かめる。
   新しい版が出ていれば「更新」の札が付き、押すと更新の案内（.updatepop）を出す */
.brandbox { display: flex; align-items: center; gap: 2px; flex: none; }
.appver {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--text-faint);
  cursor: pointer;
}
.appver[hidden] { display: none; }
.appver:hover { color: var(--text-muted); border-color: var(--border); }
.appver:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.appver__new { display: none; }
.appver--update { color: var(--accent); border-color: var(--accent); }
.appver--update:hover { color: var(--accent); border-color: var(--accent-hover); }
.appver--update .appver__new {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-on);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}

/* 新しい版の案内。上の帯の真下、ロゴの下に出す（top は app.js が帯の実際の下端から決め直す）。
   メニュー（.popover 60）より上、検索（.palette-backdrop 70）と通知（.toasts 90）より下 */
.updatepop {
  position: fixed;
  top: calc(var(--topbar-h) + 8px);
  left: 12px;
  z-index: 65;
  width: min(340px, calc(100vw - 24px));
  padding: 14px 16px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.updatepop__title { margin: 0; font-weight: 700; font-size: 14px; color: var(--text); }
.updatepop__ver { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
.updatepop__from, .updatepop__to { font-family: var(--font-mono); letter-spacing: .02em; }
.updatepop__to { color: var(--accent); font-weight: 600; }
.updatepop__note { margin: 8px 0 0; font-size: 12px; line-height: 1.6; color: var(--text-muted); }
.updatepop__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
@media (prefers-reduced-motion: no-preference) {
  .updatepop { animation: updatepop-in 180ms cubic-bezier(.2, .7, .2, 1); }
}
@keyframes updatepop-in { from { opacity: 0; transform: translateY(-4px); } }
/* 狭い画面で「あとで」を押した後の戻り口（app.js の paintUpdateChip）。広い画面はロゴ横の札があるので出さない。
   行を選んでいる間（下の「まとめて操作」の帯が出ている間）も出さない。重なって件数や「選択解除」を覆う（レビューで指摘） */
.updatechip { display: none; }
body:has(#bulkbar:not([hidden])) .updatechip { display: none; }
/* 上の帯は、幅が足りなくなると右端（アカウント）が画面の外へ押し出される（下の @media (max-width: 767px) の
   説明。実測で、全部出したままで 755px）。版（約42px）に「更新」の札（さらに約42px）が付くと 840px ほど要るので、
   900px より狭い画面では版も札も帯に出さず、新しい版は案内（.updatepop）と左下の「更新」（.updatechip）で
   知らせる（レビューで指摘） */
@media (max-width: 599px) {
  .updatepop { right: 12px; width: auto; }
}
@media (max-width: 899px) {
  .appver { display: none; }
  .updatechip:not([hidden]) {
    display: inline-flex;
    align-items: center;
    position: fixed;
    left: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 65;
    height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-on);
    font-size: 12px;
    font-weight: 600;
    box-shadow: var(--shadow-pop);
  }
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 120px;
  max-width: 460px;
  height: 30px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-faint);
  text-align: left;
  cursor: text;
}
.searchbox:hover { border-color: var(--accent); color: var(--text-muted); }
.searchbox__label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badges { display: flex; gap: 6px; flex: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.badge:hover { border-color: var(--accent); color: var(--text); }
/* 鮮度は0件のとき app.js が hidden を立てる。[hidden] は .badge と詳細度が同じで
   後勝ちも当てにできないので、ここで明示して消す（他の [hidden] と同じ扱い）。 */
.badge[hidden] { display: none; }
.badge[aria-current="true"] {
  background: var(--bg);
  border-color: var(--border-strong);
  color: var(--text);
}
.badge__n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.badge--warn .badge__n { color: var(--amber-fg); }
.badge--zero { opacity: .55; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--small { height: 24px; padding: 0 8px; font-size: 12px; }
.btn--mini { height: 18px; padding: 0 4px; font-size: 10px; border-color: var(--border); color: var(--text-muted); }
.btn--mini:hover { color: var(--text); }
.btn--danger { color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); background: var(--surface-2); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn[disabled]:hover { border-color: var(--border-strong); }

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex: none;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
/* 畳んでいる間は、そのトグルを押された形で見せる。畳んだ本人にとっては
   「どこから戻すのか」が分からないのがいちばん困るので、戻す場所が
   ひと目で分かるようにしておく（aria-pressed="false" ＝いま畳んでいる）。 */
.iconbtn[aria-pressed="false"] {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.iconbtn[aria-pressed="false"]:hover { background: var(--bg); }

/* ---------- ジャンルタブ ---------- */

.genretabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  /* ジャンルは第一階層なので「その他▾」に畳まず、入り切らなければ横スクロールさせる */
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}
.genretabs::-webkit-scrollbar { height: 4px; }
.genretabs::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex: none;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
/* 選択中は太字＋下線 2px（ink 色） */
.tab[aria-current="true"] { color: var(--text); border-bottom-color: var(--text); font-weight: 700; }
/* 物品購入はアクティブがほぼ無い（買い切りで役目を終えたリスト群）ので控えめに置く */
.tab--muted { color: var(--text-faint); }
.tab__n {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-faint);
}
.tab[aria-current="true"] .tab__n { color: var(--text-muted); }
/* ジャンルタブ末尾の「＋」。他のタブと同じ高さで、アイコンだけの控えめな見た目にする */
/* 掴んで左右に並べ替えられる。挿す位置は縦線で示す（サイドバーの listrow と同じ作法） */
.tab--before { box-shadow: inset 2px 0 0 0 var(--accent); }
.tab--after { box-shadow: inset -2px 0 0 0 var(--accent); }
body.dragging-tab .tab { cursor: grabbing; }
/* 行・札を運んでいる間、タブにかざすと左の一覧がそのジャンルに替わる（Finder のばね。app.js の dragPeek）。
   かざしている間は下線が左から伸び、伸びきると替わる。替わったタブは薄い地と枠で「いま左に出ている」を示す */
.tab--arming, .tab--peek { position: relative; color: var(--accent); background: var(--accent-soft); }
.tab--peek { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 8px 8px 0 0; font-weight: 700; }
.tab--arming::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px;
  background: var(--accent); transform-origin: left; animation: tab-arming .5s linear forwards;
}
@keyframes tab-arming { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .tab--arming::after { animation: none; } }

.tab--add { color: var(--text-faint); padding: 0 10px; }
.tab--add:hover { color: var(--text); background: var(--surface-2); }

/* ---------- 作業領域 ---------- */

.workspace {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
}
.workspace.has-detail { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--detail-w); }

/* ---------- 左サイドバー ---------- */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 12px 8px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  min-height: 0;
}

/* 見出しと、その右端の「畳む」ボタン（右パネルの閉じるボタンと同じ形・同じ位置） */
.sidebar__head {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 0 8px 10px;
}
.sidebar__headmain { flex: 1 1 auto; min-width: 0; }
.sidebar__title { font-family: var(--font-head); font-weight: 700; font-size: 14px; }
.sidebar__def { color: var(--text-faint); font-size: 11px; }
/* かざして別のジャンルを出している間（dragPeek）。左の一覧の地を変えて、いつもの一覧ではないと分かるように */
.sidebar--peek { background: var(--surface-2); }
.sidebar__title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
/* 左が狭い時も札が1文字ずつ縦に折れないように（折れる時はジャンル名の下の行へ回る） */
.sidebar__peektag {
  white-space: nowrap; flex: none;
  font-family: var(--font-body); font-weight: 600; font-size: 11px; color: var(--accent);
  background: var(--accent-soft); border-radius: 10px; padding: 1px 8px;
}
/* 掴んでいる間だけ出す案内 */
.sidebar__draghint { display: none; margin: 0 8px 8px; color: var(--text-muted); font-size: 11.5px; line-height: 1.5; }
body.dragging-row .sidebar__draghint { display: block; }
.sidebar__def::before { content: "／"; }

.listrow {
  position: relative;   /* 評価の点（.ldot）を左の余白に置く */
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  /* 左の 18px は評価の色の点の置き場。点が無い行も同じ幅にして、名前の頭をそろえる */
  padding: 5px 8px 5px 18px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.listrow:hover { background: var(--bg); }
/* 選択中は太字・背景 bg・左端に 2px の ink バー */
.listrow[aria-current="true"] {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--text);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.listrow__name {
  flex: 1 1 auto;
  min-width: 0;
  /* 長い名前は2行まで折り返して読めるようにし、それでも入らない分だけ「…」にする
     （1行だと4〜5文字で切れて、どのリストか分からなかった。本人「リストの文字がみえずらい」2026-09-26） */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.listrow__n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--text-faint); text-align: right; }
.listrow--archived .listrow__name { color: var(--text-muted); }

/* リストの評価（A / B / C）の色の点。左の一覧とジャンルの一覧のカードは、文字を出さず色だけで見分ける
   （本人「ABCは色で判断にして」2026-09-26）。左の一覧では行の左の余白に置くので、名前の幅を取らない */
.ldot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.ldot[data-rating="A"] { background: var(--rate-a-dot); }
.ldot[data-rating="B"] { background: var(--rate-b-dot); }
.ldot[data-rating="C"] { background: var(--rate-c-dot); }
.listrow .ldot { position: absolute; left: 6px; top: 50%; margin-top: -4px; }

/* リストの見出しの評価ボタンの印（A / B / C の文字つき）。行の評価（.rate）と同じ色 */
.lrate {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}
.lrate[data-rating="A"] { background: var(--rate-a-bg); color: var(--rate-a-fg); }
.lrate[data-rating="B"] { background: var(--rate-b-bg); color: var(--rate-b-fg); }
.lrate[data-rating="C"] { background: var(--rate-c-bg); color: var(--rate-c-fg); }
.lrate[data-rating=""] { background: transparent; }
/* ピン留め：留めた行は件数の左に塗った押しピンを常に出す。留めていない行は、件数と同じ場所に
   重ねた押しピンを、カーソルを乗せた時だけ件数と入れ替えて出す（.listrow__tail） */
.listrow__pin {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: var(--radius);
  color: var(--text-faint);
  opacity: 0;
}
.listrow__pin .icon { width: 13px; height: 13px; }
.listrow__pin:hover { color: var(--accent); background: var(--surface); }
.listrow__pin--on { opacity: 1; color: var(--accent); }
/* 件数と押しピンを同じ升に重ねる。升の幅は広い方（押しピンの 18px か件数）に合わせる */
.listrow__tail { flex: none; display: grid; align-items: center; justify-items: end; }
.listrow__tail > * { grid-area: 1 / 1; }
@media (hover: hover) {
  .listrow:hover .listrow__pin { opacity: 1; }
  .listrow:hover .listrow__tail .listrow__n { opacity: 0; }
}
/* タッチの端末ではカーソルを乗せられないので、見えない押しピンが件数の上でタップを受けないようにする
   （付け外しは「…」メニューとカルテで） */
@media (hover: none) {
  .listrow__tail .listrow__pin { display: none; }
}
/* ピン留めしたリストと、それ以外の境目 */
.sidebar__pinsep { border: 0; border-top: 1px solid var(--border); margin: 6px 8px; }
/* リストの見出しの印は押せる。未評価は点線の枠で「ここで付けられる」と分かるようにする */
.lrate--btn {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 12px;
  border: 1px solid transparent;
  cursor: pointer;
}
.lrate--btn[data-rating=""] { border: 1px dashed var(--border-strong); }
.lrate--btn:hover:not(:disabled) { box-shadow: 0 0 0 2px var(--accent-soft); }
/* A / B / C / なし を選ぶ4つ（カルテの「このリスト」と、見出し・「…」メニュー） */
.lratepick { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.lratepick--menu { cursor: default; }
.lratepick__label { font-size: 12px; color: var(--text-muted); margin-right: 4px; }
.lratepick__btn {
  min-width: 30px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.lratepick__btn[data-rating=""] { font-family: var(--font-body); font-weight: 400; }
.lratepick__btn:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.lratepick__btn[data-rating="A"]:is([aria-pressed="true"], [aria-checked="true"]) { background: var(--rate-a-bg); color: var(--rate-a-fg); border-color: transparent; }
.lratepick__btn[data-rating="B"]:is([aria-pressed="true"], [aria-checked="true"]) { background: var(--rate-b-bg); color: var(--rate-b-fg); border-color: transparent; }
.lratepick__btn[data-rating="C"]:is([aria-pressed="true"], [aria-checked="true"]) { background: var(--rate-c-bg); color: var(--rate-c-fg); border-color: transparent; }
.lratepick__btn[data-rating=""]:is([aria-pressed="true"], [aria-checked="true"]) { background: var(--surface-3); color: var(--text); }

/* ダブルクリック／Enter でのリスト名リネーム。行のボタンとほぼ同じ寸法で差し替わるので
   ガタつかない（Finderのリネームボックスと同じ見た目のつもり） */
.listrow--renaming {
  display: block;
  width: 100%;
  padding: 4px 7px 4px 17px;   /* 枠の1px ＋ 17px で、行の名前（左 18px）と同じ位置から打てる */
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

/* ① ドラッグ＆ドロップ: 表の行をドラッグしている間、全リスト行に薄いドロップ枠を出し、
   実際にホバーしている行だけ強調する（誤操作対策として「ここに置ける」を常に見せる） */
body.dragging-row .listrow { outline: 1px dashed var(--border-strong); outline-offset: -1px; }
.listrow--dragover { outline: 2px solid var(--accent) !important; outline-offset: -2px; background: var(--accent-soft); }

/* 表の行をリストへドラッグする時の、ブラウザ既定より小さい代わりのドラッグ画像。
   setDragImage に渡すためだけの一時要素で、画面には実質映らない（showRowDragGhost参照）。
   単発は評価チップ＋名前、複数選択はFinderの複数ファイル移動に寄せてアイコン＋件数。 */
.drag-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  max-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}
.drag-ghost__name { overflow: hidden; text-overflow: ellipsis; }
.drag-ghost__chip {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}
.drag-ghost__chip--none { border: 1px solid var(--border-strong); }
.drag-ghost__chip[data-rating="A"] { background: var(--rate-a-bg); color: var(--rate-a-fg); }
.drag-ghost__chip[data-rating="B"] { background: var(--rate-b-bg); color: var(--rate-b-fg); }
.drag-ghost__chip[data-rating="C"] { background: var(--rate-c-bg); color: var(--rate-c-fg); }
.drag-ghost__stack {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
}
.drag-ghost__badge {
  flex: none;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* 左の一覧のリストは、行そのものを掴んで並べ替える（⋮⋮ のつまみはやめた。本人「てんてんで移動より、
   ドラッグ&ドロップでいい」2026-09-26）。タッチの端末では行に draggable を付けない（app.js の canDragListRows） */
body.dragging-listrow { cursor: grabbing; }
/* ドロップ先の行に、挿す位置（前 or 後）を上端・下端の線で示す。選択中の行
   （.listrow[aria-current="true"]、詳細度が高く独自の box-shadow を持つ）に
   対しても効くよう、同じ詳細度の組み合わせを別途書いて上書きする */
.listrow--before,
.listrow[aria-current="true"].listrow--before { box-shadow: inset 0 2px 0 0 var(--accent); }
.listrow--after,
.listrow[aria-current="true"].listrow--after { box-shadow: inset 0 -2px 0 0 var(--accent); }

.sidebar__sep { height: 1px; margin: 8px 4px; background: var(--border); border: 0; }

.archtoggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
}
.archtoggle:hover { background: var(--bg); color: var(--text); }
.archtoggle__mark { width: 10px; font-family: var(--font-mono); }

.sidebar__empty { padding: 8px; color: var(--text-faint); font-size: 12px; }

/* ---------- 中央 ---------- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

/* 見出しは詰めて表を縦に広く（2026-10-11 本人「縦幅が場所とってて、スクロール余白が少ない」。前は 12px 16px 10px・段の間 6px） */
.mainhead {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 16px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.mainhead__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mainhead__title { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; }
.mainhead__title .icon { color: var(--text-muted); }
.mainhead__desc { color: var(--text-muted); font-size: 12px; margin: 0; }
/* リストの説明はふだん1行（押すと全部・もう一度で1行）。見出しを畳んでいる時は出さない */
.mainhead__desc--clamp { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; line-height: 1.5; }
.mainhead__desc--clamp.is-open { white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
body.headfolded .mainhead__desc--clamp { display: none; }
.mainhead__rate { font-weight: 400; }
.mainhead__fold .icon { width: 14px; height: 14px; }
body.headfolded .gallery__head .gallery__opt { display: none; }
body.headfolded .mobilelist .stiles__head { display: none; }
.mainhead__spacer { flex: 1; }
.mainhead__count { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-faint); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 11px;
  border: 1px solid transparent;
}
.chip .icon { width: 12px; height: 12px; }
.chip--archive { background: var(--amber-bg); color: var(--amber-fg); border-color: var(--amber-border); }
.chip--filter { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip--action { font: inherit; cursor: pointer; transition: background-color .1s, border-color .1s; }
.chip--action:hover { background: var(--border); }
.chip--action:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip__x {
  display: inline-flex; align-items: center;
  border: 0; background: transparent; color: inherit; cursor: pointer;
  padding: 0 0 0 2px; line-height: 1;
}
.chip__x .icon { width: 11px; height: 11px; }
/* 列の値の絞り込みのチップ。文字の部分は押すと値の一覧を開き直す。
   値が長い・多い時に1枚が画面幅を超えて横にはみ出さないよう、文字を省略する
   （電話の幅でも崩れない。全部は title で読める）。 */
.chip--filter { max-width: 100%; min-width: 0; }
.chip__open {
  display: inline-flex; align-items: center; min-width: 0;
  border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; padding: 0;
}
.chip__open:focus-visible, .chip__x:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* 数の条件で絞る（N08）。文字欄から読んだ条件は点線の枠（文字欄から来たと分かる）。範囲は列の値のチップと同じ形 */
.chip--numtext { border-style: dashed; }
/* 注意のチップ（文字で探している理由・どの列で比べるか）。中の列の名前は押せる */
.chip--numwarn {
  background: var(--amber-bg); color: var(--amber-fg); border-color: var(--amber-border);
  max-width: 100%; min-width: 0; height: auto; min-height: 20px; flex-wrap: wrap; row-gap: 2px; padding: 1px 8px;
}
.chip--numwarn .chip__text { white-space: normal; }
.chip__pick {
  border: 1px solid var(--amber-border); border-radius: var(--radius); background: var(--surface);
  color: var(--amber-fg); font: inherit; font-weight: 600; padding: 0 6px; cursor: pointer; line-height: 16px;
}
.chip__pick:hover { background: var(--surface-2); }
.chip__pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.numfilter-btn { display: inline-flex; align-items: center; gap: 3px; }
.numfilter-btn .icon { width: 12px; height: 12px; }
.numfilter-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
/* 件数（要確認つき）。PC は長い文、電話は短い文 */
.mainhead__count .c-short { display: none; }

.pills { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.pill {
  height: 24px;
  padding: 0 9px;
  border: 0;
  border-right: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}
.pill:last-child { border-right: 0; }
.pill:hover { background: var(--surface-2); color: var(--text); }
.pill[aria-pressed="true"] { background: var(--bg); color: var(--text); font-weight: 600; }

.filterinput {
  height: 24px;
  width: 180px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

/* 行を追加する簡易フォーム（リストのヘッダー内） */
.addrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.addrow__input {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.addrow__input:focus { border-color: var(--accent); }
.addrow__input--name { width: 240px; }
.addrow__input--url { width: 260px; }
.addrow__hint { font-size: 11px; color: var(--text-faint); }
/* スマホ幅では欄を1本ずつ横いっぱいにし、指で押せる高さにする。文字は16px——iPhone の
   Safari は16px未満の入力欄に触ると画面を拡大し、足すたびにつまんで戻す手間が出る。
   幅の指定（--name 240px / --url 260px）と詳細度が同じなので、3つとも並べて後勝ちにする。 */
@media (max-width: 599px) {
  .addrow__input, .addrow__input--name, .addrow__input--url { width: 100%; height: 40px; font-size: 16px; }
}

/* ---------- 表 ---------- */

.tablewrap {
  flex: 1;
  min-height: 0;
  /* 列は固定6本に畳んであるので、横には流さない（ページ全体も横スクロールさせない） */
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface);
}
/* 見出しの境目をドラッグして幅を決めた表だけ、横に流す。
   決めた幅の合計は画面幅を超えうるので、ここを hidden のままにすると右端
   （見積・行メニューの「…」）が黙って切れて、押すことも見ることもできなくなる。 */
.tablewrap--sized { overflow-x: auto; }

/* 右端の捨て列。幅を持たないので、決めた幅の合計より画面が広いぶんを全部吸う。
   行の中のセルなので、下線もホバーの帯も選択の帯もここまで続く（表の外に余白ができて
   「壊れた表」に見えるのを防ぐ）。中身は空なので、余白そのものが行の一部になる。 */
.grid__filler { padding: 0; }

/* ツールバーの「列」から開く、出す列を選ぶところ */
.popover--cols { max-height: min(60vh, 420px); overflow-y: auto; min-width: 200px; }
.popitem--check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
}
.popitem--check:hover { background: var(--accent-soft); }
.popitem--check input { accent-color: var(--accent); margin: 0; flex: none; }
.popitem--check.is-fixed { cursor: default; color: var(--text-faint); }
.popitem--check.is-fixed:hover { background: none; }
.popitem__note { margin-left: auto; font-size: 11px; color: var(--text-faint); }
/* 並べられる列の行。チェックの行（label）の右に ↑ ↓ を並べる。ボタンを label の中に
   入れないのは、押した時にチェックの入り切りと取り合わないようにするため。 */
.popitem-row { display: flex; align-items: center; gap: 2px; }
.popitem-row > .popitem--check { flex: 1; min-width: 0; }
.popitem__move {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.popitem__move:hover, .popitem__move:focus-visible { background: var(--surface-2); color: var(--text); }
/* 端・保存中は押せない。色を落として、押しても何も起きないことを先に見せる */
.popitem__move:disabled, .popitem:disabled { color: var(--text-faint); cursor: default; background: transparent; }
.popover__sep {
  padding: 8px 10px 4px;
  font-size: 11px;
  color: var(--text-faint);
}
.popover__hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }

/* 列の値で絞り込む一覧（見出しの「…」→「この列の値で絞り込む」）。
   値が数百ある列もあるので、一覧だけを器の中でスクロールさせる（見出しと外す口は動かさない）。 */
.popover--colfilter { width: min(300px, calc(100vw - 16px)); display: flex; flex-direction: column; }
.colfilter__title { padding: 6px 8px 4px; font-size: 12px; font-weight: 600; }
.colfilter__note { padding: 0 8px 6px; font-size: 11px; color: var(--text-faint); line-height: 1.5; }
.colfilter__search {
  margin: 0 4px 4px; height: 26px; padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 12px;
}
.colfilter__list { max-height: min(50vh, 340px); overflow-y: auto; }
.colfilter__value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.colfilter__item.is-blank .colfilter__value { color: var(--text-muted); }
.colfilter__n { margin-left: auto; font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.colfilter__more { padding: 6px 8px 2px; font-size: 11px; color: var(--text-faint); }
.colfilter__more[hidden] { display: none; }
.colfilter__clear:disabled { color: var(--text-faint); cursor: default; background: none; }
/* 数の範囲（N08）。欄2つと単位の切り替えを横並び。「当てる」は欄のすぐ下にいつも見える位置 */
.popover--numpick { width: min(280px, calc(100vw - 16px)); }
.popover--numrange { width: min(300px, calc(100vw - 16px)); display: flex; flex-direction: column; gap: 6px; padding: 6px; }
.popover--numrange .colfilter__title { padding: 2px 2px 0; }
.numrange__back { color: var(--text-muted); }
.numrange__fields { display: flex; align-items: center; gap: 6px; }
.numrange__input {
  flex: 1 1 0; min-width: 0; height: 30px; padding: 0 8px; font-size: 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
}
.numrange__sep { color: var(--text-muted); }
.numrange__unit, .numrange__per { height: 30px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.numrange__unitlabel { color: var(--text-muted); font-size: 12px; min-width: 1.5em; }
.numrange__conv { font-size: 11px; color: var(--text-muted); }
.numrange__err { font-size: 11.5px; color: var(--danger); }
.numrange__conv[hidden], .numrange__err[hidden] { display: none; }
.numrange__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.numrange__perrow { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.numrange__perrow select { flex: 1; min-width: 0; }
.numrange__stats, .numrange__count { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.numrange__count:empty { display: none; }
.popover--numrange .numrange__note { max-width: none; padding: 4px 2px 0; border-top: 1px solid var(--border); }

.grid {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  table-layout: fixed;
  background: var(--surface);
}

.grid th, .grid td {
  border-bottom: 1px solid var(--border);
  padding: 4px 10px;
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--surface);
}
.grid td { height: 44px; }

.grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
  font-weight: 500;
  color: var(--text-muted);
  font-size: 11px;
  height: auto;
  padding-top: 6px;
  padding-bottom: 6px;
}

.grid tbody tr { cursor: pointer; }
/* ホバーと選択は背景 bg で示す */
.grid tbody tr:hover td { background: var(--row-hover); }
.grid tbody tr[aria-selected="true"] td { background: var(--row-selected); }
.grid tbody tr.row--resolved td { background: var(--row-resolved); color: var(--text-faint); }
/* 追加したばかりで、まだサーバの返事を待っている行 */
.grid tbody tr.row--pending td { color: var(--text-muted); font-style: italic; }

/* 数字セル（件数・価格・日付）は mono・右揃え */
.grid .cell-num, .grid th.cell-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  text-align: right;
}

.grid .c-rating { padding-left: 12px; padding-right: 6px; }

/* ④ 一括移動のチェック列・② 行メニュー(…)の操作列。評価送りモード中はどちらも出さない */
.grid .c-select { width: 30px; padding-left: 10px; padding-right: 2px; }
.grid .c-actions { width: 26px; padding-left: 2px; padding-right: 8px; text-align: right; }
.rowcheck { width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent); vertical-align: middle; }
/* 選ぶ欄はなぞってまとめて選べる。なぞっている間に文字が選ばれると、
   ドラッグが途切れたように見えるので、この列だけ文字を選ばせない。 */
/* touch-action: none は、この列からの指の動きをスクロールに取られないため。取られると
   pointercancel が来て、押した1行だけ選ばれたまま残る。スクロールは表の他の場所からできる。 */
.grid .c-select { user-select: none; cursor: pointer; touch-action: none; }
.rowmenu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}
.rowmenu-btn:hover { background: var(--surface-2); color: var(--text); }
/* チェック済みの行は選択中の行と同じ背景で分かるようにする */
.grid tbody tr:has(.rowcheck:checked) td { background: var(--row-selected); }

/* 行の表の見出しに置く列の操作。掴む所（右端9px）の左に寄せる。
   完全に消すと「無い」と読まれるので、うっすら出しておく。 */
.rowmenu-btn--th {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  opacity: .45;
  transition: opacity .12s;
  z-index: 2;
}
.grid th:hover .rowmenu-btn--th,
.rowmenu-btn--th:hover,
.rowmenu-btn--th:focus-visible { opacity: 1; }
@media (hover: none) { .rowmenu-btn--th { opacity: 1; } }

/* 押すと並べ替わる見出し。押すたびに 昇順 → 降順 → 手で並べた順 と回る。 */
.grid th.th--sortable { cursor: pointer; user-select: none; }
.grid th.th--sortable:focus-visible,
.colgrip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.grid th.th--sortable:hover { color: var(--text); background: var(--surface-2); }
.grid th.th--sortable[aria-sort="ascending"],
.grid th.th--sortable[aria-sort="descending"] { color: var(--accent); }
.th__sort {
  font-size: 10px;
  margin-left: 3px;
  vertical-align: 1px;
}

/* 見出しの境目。掴んで左右に動かすと列の幅が変わり、ダブルクリックで中身に合わせる。
   選択列と操作列には出さない（幅が30px・26pxしかなく、選択列は「全選択」の
   チェックボックスと重なって押せなくなる。app.js の NO_RESIZE_COLS）。 */
.colgrip {
  position: absolute;
  top: 0;
  right: 0;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;   /* 触って操作する画面で、掴んだ指が縦スクロールに取られないように */
  z-index: 3;           /* 見出しは sticky（z-index: 2）なので、その上に置く */
}
.colgrip::after {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  right: 3px;
  width: 3px;
  border-radius: 2px;
  background: transparent;
}
.colgrip:hover::after,
.grid--resizing .colgrip::after { background: var(--accent); }
/* 引っ張っている間に文字が選択されると、掴んだ手応えが濁る */
.grid--resizing { user-select: none; }
.grid--resizing .colgrip { cursor: col-resize; }

/* 名前セル（2段組: 上段=名前 / 下段=要約） */
/* 名前列は残りの幅を全部もらうので、画面が広いほど1行が長く伸びる。長い名前が
   端まで一直線に流れると目で追えないので、読みやすい幅で止めて折り返す。
   2行に収まらない分は省略し、全文は title（マウスオーバー）で読める。 */
.ncell { min-width: 0; max-width: 620px; }
/* 幅を自分で決めた表では、この上限を外す。残したままだと、名前列を 620px より
   広げても中身がそこで止まり「引っ張ったのに変わらない」ように見える。 */
.grid--sized .ncell { max-width: none; }

/* 横に長い表は、右へスクロールすると「どの行の話か」が分からなくなる。左端
   （選ぶ欄・評価・名前）だけ貼り付けて、名前が常に見えるようにする。left の値は
   その左にある列の幅の合計で、掴んで幅を変えるたびに JS が入れ直す（syncFreezeOffsets）。
   セルには元々 background が入っているので、下を流れる列は透けない。 */
.grid--sized td.tfreeze, table.sheet td.tfreeze { position: sticky; z-index: 1; }
/* 見出しは既に上へ貼り付いている（position: sticky; top: 0）。同じ指定で左にも
   貼り付くので、重なり順だけ本文の貼り付け列より上げる。 */
.grid--sized thead th.tfreeze, table.sheet thead th.tfreeze { z-index: 3; }
/* 貼り付けの境目。ここが見えないと、下を列が流れていく理由が分からない */
.grid--sized .tfreeze--edge, table.sheet .tfreeze--edge { box-shadow: 1px 0 0 var(--border); }
.ncell__top { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.ncell__name {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.45;
  /* .grid td の nowrap を打ち消す。継承したままだと折り返せず、1行のまま
     ただ切られる（省略記号も出ない）。 */
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  /* URL のような切れ目の無い文字列でも器の外へ出さない */
  overflow-wrap: anywhere;
  min-width: 0;
}
/* 名前全体がリンク。動かすのは下線だけで、クリック領域は固定する。 */
.ncell__name-link {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 6px 0;
  color: var(--accent);
  text-decoration: none;
}
/* 表の既存の上下余白に重ね、1行の名前で行高を増やさない。 */
.grid .ncell__name-link { margin-block: -4px; }
.ncell__link-text { position: relative; display: block; min-width: 0; padding-bottom: 3px; }
.ncell__link-text::before, .ncell__link-text::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px;
  height: 1px;
  background: currentColor;
  pointer-events: none;
}
.ncell__link-text::before { opacity: .35; }
.ncell__link-text::after {
  height: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms cubic-bezier(.2,.7,.2,1);
}
.ncell__name-link:is(:hover, :focus-visible) .ncell__link-text::after { transform: scaleX(1); }
.ncell__name-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .ncell__link-text::after { transition: none; }
}
/* 値が URL だけのセル（URL の列・URL を入れた項目の列）。名前のリンクと同じ色に下線を付け、
   押すと新しいタブで開く。表のセルは1行で切り詰めるので、下線も文字と一緒に「…」で切れる */
.urlcell__link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.urlcell__link:is(:hover, :focus-visible) { text-decoration-thickness: 2px; }
.urlcell__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px; }
.ncell__sub {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 確認日セル（鮮度ビューでは下段に「今日にする」を置く） */
.datecell { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }

.listlink {
  border: 0; background: transparent; padding: 0; cursor: pointer;
  color: var(--accent); text-align: left; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.listlink:hover { text-decoration: underline; }
.listlink .icon { width: 12px; height: 12px; }
.listlink__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* 評価セル。着色するのはこのチップだけで、行全体には色を付けない */
.rate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.rate:hover { border-color: var(--accent); }
.rate[data-rating="A"] { background: var(--rate-a-bg); color: var(--rate-a-fg); }
.rate[data-rating="B"] { background: var(--rate-b-bg); color: var(--rate-b-fg); }
.rate[data-rating="C"] { background: var(--rate-c-bg); color: var(--rate-c-fg); }
/* 評価が無い行も A・B・C と同じ大きさのチップにして、薄く「未」と書く。
   枠線だけの 14x14 にしていた頃は、隣の選ぶ欄のチェック（14x14）と形も大きさも同じで、
   どちらが選択でどちらが評価か分からなかった（利用者の指摘）。中身の文字で見分ける。 */
.rate--none {
  background: var(--surface-3);
  border-color: transparent;
  color: var(--text-faint);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
}
.rate--lg { width: 44px; height: 28px; font-size: 14px; }
.rate--lg.rate--none { font-size: 12px; }

.state {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  padding: 28px 20px;
  color: var(--text-muted);
}
.state__title { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--text); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 16px;
  overflow-y: auto;
}
.card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  color: var(--text);
}
.card:hover { border-color: var(--accent); }
.card .icon { color: var(--text-faint); width: 14px; height: 14px; }
.card__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-faint); }

/* ジャンルの一覧の中身（X08）。「最近」帯とカードを一緒に流す（スクロールはこの箱） */
.overview { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.overview > .cards { overflow: visible; }
/* カードの2段目（未評価の数・最後に行が動いた日）。名前の頭（色の点の後ろ）にそろえる */
.card { flex-wrap: wrap; row-gap: 3px; }
.card__shared { display: inline-flex; flex: none; color: var(--accent); }
.card .card__shared .icon { width: 12px; height: 12px; color: inherit; }
.card__meta { flex: 0 0 100%; display: flex; gap: 10px; padding-left: 16px; font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.card--archived .card__meta { padding-left: 38px; }
.card__unrated { color: var(--text-muted); }
/* 「最近」帯（全ジャンル横断で、最近行が動いたリスト5本） */
.recent { padding: 12px 16px 0; }
.recent__toggle { width: auto; }
.recent__hint { font-size: 11px; color: var(--text-faint); }
.recent__list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.recent__list[hidden] { display: none; }
.recent__item {
  display: inline-flex; align-items: center; gap: 6px; max-width: 280px; height: 30px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  color: var(--text); font: inherit; cursor: pointer;
}
.recent__item:hover { border-color: var(--accent); }
.recent__item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.recent__item .icon { width: 14px; height: 14px; color: var(--text-faint); flex: none; }
.recent__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent__shared { display: inline-flex; flex: none; color: var(--accent); }
.recent__item .recent__shared .icon { width: 12px; height: 12px; color: inherit; }
.recent__ago { flex: none; font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
@media (max-width: 599px) {
  .recent__item { flex: 1 1 100%; max-width: none; height: 38px; }
  .recent__ago { margin-left: auto; }
  .recent__hint { display: none; }
}


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

.detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow: hidden;
}
/* [hidden] は詳細度がクラスセレクタと同じなので、後勝ちを当てにせず明示する。
   これが無いと、1200px未満で「何も選んでいない」ときに fixed 配置の空パネルが
   画面右3分の1を覆ったまま残る。 */
.detail[hidden] { display: none; }
/* ログイン画面表示中、MyTANA本体側を同じ理由で明示的に隠す（showLoginScreen 参照）。 */
.topbar[hidden], .genretabs[hidden], .workspace[hidden], .login-screen[hidden] { display: none; }

.detail__head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 12px 10px 16px;
  border-bottom: 1px solid var(--border);
}
.detail__headmain { flex: 1; min-width: 0; }
.detail__eyebrow { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail__title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  cursor: text;
  border-radius: var(--radius);
  margin: 2px 0 0;
}
.detail__title:hover { background: var(--bg); }
.detail__titleinput {
  width: 100%;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1px 4px;
  margin: 2px 0 0;
  resize: none;
  overflow: hidden;
}
.detail__meta { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.detail__fill { font-size: 11px; color: var(--text-faint); }

.banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--amber-bg);
  color: var(--amber-fg);
  border-bottom: 1px solid var(--amber-border);
  font-size: 12px;
}
.banner__text { flex: 1; }
.banner .btn { border-color: var(--amber-border); background: transparent; color: var(--amber-fg); }
.banner .btn:hover { background: var(--surface); }

.detail__body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }

/* パネル内のセクション（タブは廃止して縦1本スクロール） */
.dsec { padding: 10px 16px 12px; border-bottom: 1px solid var(--border); }
.dsec:last-of-type { border-bottom: 0; }
.dsec__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.dsec__row { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* 右パネル（電話では下から出る詳細）の「一番上へ・一つ上へ・一つ下へ・一番下へ」。狭い幅では折り返す */
.dsec__row--order { flex-wrap: wrap; margin-top: 6px; }
.dsec__grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }

/* クリックで編集に切り替わる値表示 */
.edwrap { min-width: 0; flex: 1; }
.ed {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 3px 4px;
  margin: 0 -4px;
  text-align: left;
  color: var(--text);
  cursor: text;
  border-radius: var(--radius);
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.ed:hover { background: var(--bg); }
.ed--empty { color: var(--text-faint); }
/* 保存に失敗した打ちかけが残っているセル。表示は確定値のままなので、色ではなく
   下線の点線で「開くと打った文が入る」ことだけ示す */
.ed--draft { text-decoration: underline dotted var(--danger); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.ed-input {
  width: 100%;
  padding: 2px 4px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

/* 改行を含む項目（シートのメモ列）の編集。中身に合わせて高さを伸ばすので
   自前のリサイズハンドルは要らない。表の行の中で開くため、セルの高さを
   押し広げるぶんの余白は上下に持たせない。 */
.ed-input--multi {
  display: block;
  min-height: 24px;
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
  font: inherit;
  white-space: pre-wrap;
}

/* メモ（常設 textarea・auto-grow） */
.memoarea {
  width: 100%;
  min-height: 64px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  resize: none;
  overflow: hidden;
  field-sizing: content;
}
.memoarea:hover { border-color: var(--border-strong); }
.memoarea:focus { border-color: var(--accent); background: var(--surface); }
.savenote { font-size: 11px; color: var(--text-faint); }

/* 【見出し】つきメモの畳んだ表示 */
.memofold { display: flex; flex-direction: column; gap: 8px; }
.memofold__g { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.memofold__g summary { cursor: pointer; padding: 8px 12px; font-weight: 500; display: flex; gap: 8px; align-items: center; list-style: none; }
.memofold__g summary::-webkit-details-marker { display: none; }
.memofold__g summary::before { content: "▸"; color: var(--text-faint); font-size: 11px; }
.memofold__g[open] summary::before { content: "▾"; }
.memofold__g summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.memofold__n { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); font-weight: 400; }
.memofold__in { padding: 2px 12px 10px 28px; display: flex; flex-direction: column; gap: 10px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.memofold__in b { display: block; font-weight: 500; color: var(--text-muted); font-size: 12px; }
.memofold__in a { color: var(--accent); }
.memofold__edit { align-self: flex-start; }

/* スペック */
.spec { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; padding: 3px 0; align-items: start; }
.spec__k { font-size: 11px; color: var(--text-faint); padding-top: 4px; overflow-wrap: anywhere; }
/* 列を消している最中の値。編集欄と同じ位置・同じ行の高さで、押せないだけ */
.spec__frozen { padding: 3px 4px; color: var(--text-muted); overflow-wrap: anywhere; }
.spec-toggle {
  display: block;
  margin-top: 6px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}
.spec-toggle:hover { color: var(--text); }

/* 価格調査（店/価格/日の3列ミニ表） */
.qtable { width: 100%; border-collapse: collapse; font-size: 12px; }
.qtable th {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  text-align: left;
  padding: 2px 6px 4px;
  border-bottom: 1px solid var(--border);
}
.qtable td { padding: 4px 6px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; vertical-align: top; }
.qtable tr:last-child td { border-bottom: 0; }
.qtable .cell-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
/* 最安の行に細い目印 */
.qrow--min td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.qrow--memo td { border-bottom: 1px solid var(--border); padding-top: 0; }
.qmemo { color: var(--text-faint); font-size: 11px; white-space: normal; }
/* 見積を足す・消す（X01）。見出しの「価格調査 3」と「＋ 足す」 */
.qhead { display: inline-flex; align-items: baseline; gap: 6px; }
/* 消すボタンの列。行の高さを押し広げないよう、ボタンは24pxに詰める */
.qtable .qact { width: 28px; padding: 1px 0 1px 4px; text-align: right; vertical-align: top; }
.qdel { width: 24px; height: 24px; color: var(--text-faint); }
.qdel:hover { color: var(--danger); }
.qdel .icon { width: 14px; height: 14px; }
.qrow--busy td { opacity: .45; }
/* シートから移した見積の「URL」の欄のサイト名（Amazon・価格.com など） */
.qsite { font-size: 11px; color: var(--text-faint); }
/* specs（送料・在庫・注意点など）は「ほかの項目」を開いた時だけ */
.qrow--specs td { border-bottom: 1px solid var(--border); padding-top: 0; }
.qspecs summary { cursor: pointer; font-size: 11px; color: var(--text-muted); width: fit-content; }
.qspecs summary:hover { color: var(--text); }
.qspecs dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; margin: 4px 0 2px; font-size: 11px; }
.qspecs dt { color: var(--text-faint); }
.qspecs dd { margin: 0; overflow-wrap: anywhere; }
.qform { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--border); }
.qform__row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 8px; }
.qform__note { font-size: 11px; line-height: 1.6; color: var(--text-muted); margin: 0; }
.qform__note[hidden] { display: none; }
.qform__note--error { color: var(--danger); }
.qform__actions { display: flex; gap: 6px; }

/* 評価送りモード（パネル上部の大きな A/B/C/スキップ） */
.ratepad { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.ratepad__row { display: grid; grid-template-columns: 1fr 1fr 1fr 1.2fr; gap: 6px; }
.ratepad__btn {
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
}
.ratepad__btn--a { background: var(--rate-a-bg); color: var(--rate-a-fg); border-color: transparent; }
.ratepad__btn--b { background: var(--rate-b-bg); color: var(--rate-b-fg); border-color: transparent; }
.ratepad__btn--c { background: var(--rate-c-bg); color: var(--rate-c-fg); border-color: transparent; }
.ratepad__btn:hover { border-color: var(--accent); }
.ratepad__skip { font-family: var(--font-body); font-weight: 400; font-size: 12px; }
/* 直前に評価した行を戻す（M24）。戻せる行がある時だけ、大ボタンの下に出す */
.ratepad__undo-row { display: flex; margin-top: 6px; }
.ratepad__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-faint);
}

/* リストのカルテ（行を選んでいないときの右パネル） */
.meter { display: flex; height: 10px; border-radius: var(--radius); overflow: hidden; background: var(--border); }
.meter__seg { display: block; }
.meter__seg--a { background: var(--rate-a-bg); }
.meter__seg--b { background: var(--rate-b-bg); }
.meter__seg--c { background: var(--rate-c-bg); }
.meter__seg--none { background: var(--border); }
.meterlegend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.meterlegend .num { color: var(--text); }
.meterlegend__a { color: var(--rate-a-fg); }
.meterlegend__b { color: var(--rate-b-fg); }
.meterlegend__c { color: var(--rate-c-fg); }

.fillrow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 3px 0; font-size: 12px; }
.fillrow__k { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fillrow__n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--text-faint); flex: none; }

.karte__cta { margin: 12px 16px 16px; margin-top: auto; padding-top: 12px; }
.karte__cta .btn { width: 100%; height: 34px; }

/* 行のメタ情報（元タブ・追加/更新時刻）。パネル最下部に薄く出す */
.detail__srcmeta { padding: 10px 16px 16px; font-size: 11px; color: var(--text-faint); }
.detail__srcmeta div { display: flex; justify-content: space-between; gap: 8px; }
.detail__srcmeta .num { font-size: 11px; }

/* 右パネルの足元。削除は取り消せないので、他の操作から離してここに置く */
.detail__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.detail__footnote { margin-right: auto; font-size: 11px; color: var(--text-faint); }

.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 0; }
.field__label { font-size: 11px; color: var(--text-faint); }
/* 断り書きを添えて聞き直す時の見出し（askText の tone: "warn"）。ダイアログは
   最前面なのでトーストが背後に隠れる。理由はこの位置でしか言えない。 */
.field__label--warn { font-size: 12px; line-height: 1.6; color: var(--danger); }
.field input[type="text"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--border-strong); }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); background: var(--surface); }
.field textarea { resize: vertical; min-height: 60px; }
.field__row { display: flex; gap: 6px; align-items: center; }
.field__row input { flex: 1; min-width: 0; }

.dialog .field { margin-bottom: 10px; }

.note { color: var(--text-faint); font-size: 12px; margin: 0; }

/* ---------- ポップオーバー ---------- */

.popover {
  position: fixed;
  z-index: 60;
  min-width: 150px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.popitem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 6px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.popitem:hover, .popitem:focus-visible { background: var(--surface-2); }
/* 消す操作。押し間違えると値ごと消えるので、色で他と区別する */
.popitem--danger, .popitem--danger:hover, .popitem--danger:focus-visible { color: var(--danger); }
.popitem__label { flex: 1; font-size: 12px; }
/* 押せない説明行。なぜこの列は消せないのか、をその場で言う */
/* 一覧の先頭に置く説明は、下ではなく上に線を引く */
.popover__note--top { border-top: 0; border-bottom: 1px solid var(--border); margin: 0 0 4px; padding-top: 6px; }
.popover__note {
  padding: 8px 10px 6px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 260px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.popitem__kbd { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); }

/* ---------- 検索パレット ---------- */

.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 10vh;
  background: var(--overlay);
}
.palette-backdrop[hidden] { display: none; }

.palette {
  width: min(680px, calc(100vw - 32px));
  max-height: 74vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.palette__head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.palette__icon { color: var(--text-faint); }
.palette__head input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 4px 0;
  font-size: 15px;
  outline: none;
}
.palette__results { flex: 1; overflow-y: auto; padding: 6px; min-height: 80px; }
.palette__group { padding: 8px 8px 2px; font-size: 11px; color: var(--text-faint); }

.pres {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.pres:hover { background: var(--surface-2); }
.pres[data-active="true"] { background: var(--bg); }
.pres__icon {
  flex: none;
  width: 18px;
  display: inline-flex;
  justify-content: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}
.pres__main { flex: 1; min-width: 0; }
.pres__title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres__sub { display: block; font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres__tag { flex: none; font-size: 11px; color: var(--text-faint); }

.palette__foot {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11px;
  color: var(--text-faint);
}
.palette__hint { margin-left: auto; }

/* ---------- ダイアログ ---------- */

.dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  padding: 16px;
  width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow-pop);
}
.dialog::backdrop { background: var(--overlay); }
/* 別の画面で変えられていた時の「どちらにするか」（M08）。2つの内容を並べて見比べられるように */
.dialog--stale { width: min(640px, calc(100vw - 32px)); }
.stale__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
@media (max-width: 599px) { .stale__pair { grid-template-columns: 1fr; } }
.stale__box { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; background: var(--surface-2); }
.stale__label { font-size: 11px; font-weight: 500; color: var(--text-muted); margin: 0 0 4px; }
.stale__text { font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30vh; overflow: auto; }
.stale__text--empty { color: var(--text-faint); }
.dialog--stale .dialog__actions { flex-wrap: wrap; }
/* 選んだ行を並べて比べる（M23）。項目を縦に、選んだ行を横に。広い表は器の中だけで流し、項目名の列と行の見出しは貼り付ける。
   display は開いている時だけ変える（閉じている dialog に display を当てると、閉じていても出てしまう） */
.dialog--compare { width: min(1120px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); }
.dialog--compare[open] { display: flex; flex-direction: column; }
.compare__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.compare__head .dialog__title { margin: 0 auto 0 0; }
.compare__diff { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.compare__note { font-size: 12px; color: var(--text-muted); margin: 0 0 8px; }
.compare__wrap { overflow: auto; min-height: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.compare { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 12.5px; }
.compare th, .compare td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: left; }
.compare thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.compare tbody th { position: sticky; left: 0; z-index: 1; background: var(--surface-2); color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.compare thead th.compare__corner { left: 0; z-index: 2; color: var(--text-faint); font-weight: 500; }
.compare td, .compare__item { min-width: 170px; max-width: 320px; }
.compare td { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
/* 同じ値の項目は薄く（違う所が目に入るように） */
.compare tr.is-same td { color: var(--text-faint); }
.compare__name { display: block; margin-bottom: 6px; font-weight: 600; overflow-wrap: anywhere; }
.compare__rates { display: flex; gap: 4px; }
.compare__rate { width: 30px; height: 26px; opacity: .45; }
.compare__rate[aria-pressed="true"] { opacity: 1; outline: 2px solid var(--accent); outline-offset: 1px; }
.compare__empty { font-size: 12px; color: var(--text-muted); padding: 12px; margin: 0; }
/* 比べる画面で決めるのを断った理由（トーストはこのモーダルの裏に隠れるので、ここに出す。N07） */
.compare__note--warn { color: var(--danger); }
.compare__decide { margin-top: 6px; }
.compare__decided { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 11.5px; font-weight: 600; color: var(--accent); }
.compare__decided .icon { width: 12px; height: 12px; }

/* 「これに決めた」（N07）。リストの見出しの帯・名前の印・右パネルの入口・決めるダイアログ。色はトークンだけ（濃い色の見た目でも効く） */
.decidedband {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  margin: 2px 0; padding: 5px 10px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px;
}
.decidedband__mark { display: inline-flex; flex: none; }
.decidedband__mark .icon { width: 14px; height: 14px; }
.decidedband__label { flex: none; font-weight: 600; }
.decidedband__name {
  flex: 0 1 auto; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.decidedband__name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.decidedband__reason { flex: 1 1 auto; min-width: 0; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.decidedband__date { flex: none; color: var(--text-faint); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.decidedband__ago { flex: none; color: var(--text-faint); font-size: 11.5px; }
.decidedband__more { flex: none; }
/* 90日以上前の決定は薄く（去年の決定が今の答えに見えないように） */
.decidedband--old { background: var(--surface-2); color: var(--text-muted); }
.ncell__decided {
  flex: none; display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 600; line-height: 1;
}
.stile__marks { display: inline-flex; align-items: center; gap: 4px; }
.decide-btn .icon { width: 12px; height: 12px; }
.chip--decided { color: var(--accent); background: var(--accent-soft); border-color: transparent; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.chip--decided:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.decidedpop__reason { max-width: 300px; white-space: normal; overflow-wrap: anywhere; }
.decidedpop__reason b { display: block; color: var(--accent); }
.decide-dialog { width: min(480px, calc(100vw - 32px)); }
.decide__note { color: var(--danger); font-size: 12px; line-height: 1.6; margin: 0 0 10px; }
.decide__opt { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 0 0 10px; cursor: pointer; }
.decide__demote { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px 8px; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.decide__demote legend { font-size: 12px; color: var(--text-muted); padding: 0 4px; }
.decide__choice { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; cursor: pointer; }
.decide__choice input { margin-top: 3px; }
.decide__choicetext { min-width: 0; }
.decide__who { display: block; font-size: 11px; color: var(--text-faint); overflow-wrap: anywhere; }
.decide__info { color: var(--text-muted); line-height: 1.6; }
/* display を当てた部品は hidden が効かなくなるので、隠す時の指定を足す */
.decide__opt[hidden], .decide__demote[hidden], .decide__note[hidden], .decide__info[hidden] { display: none; }
@media (max-width: 599px) {
  .decidedband { padding-top: 6px; padding-bottom: 6px; }
  /* 年つきの日付は右パネルの「✓ 決定」に出る。狭い帯では名前と理由を優先する */
  .decidedband__date { display: none; }
}
.dialog__title { font-size: 15px; margin-bottom: 12px; }
.dialog__body { font-size: 13px; color: var(--text); margin: 0; line-height: 1.7; overflow-wrap: anywhere; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* 行を移す時、移動先に同じ行があった時の確認（Finder と同じ形。app.js の askMoveConflict）。
   移動する行と移動先の行を左右に並べて見比べる。狭い画面では上下に積む。 */
.conflict-dialog { width: min(600px, calc(100vw - 32px)); }
.conflict-dialog__step { margin: 0 0 4px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.conflict-dialog__step[hidden] { display: none; }
.conflict-dialog__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.conflict-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 10px 12px;
  min-width: 0;
}
.conflict-card__cap { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; overflow-wrap: anywhere; }
.conflict-card__name { font-weight: 600; font-size: 13px; margin-bottom: 8px; overflow-wrap: anywhere; }
.conflict-card__facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: 12px; }
.conflict-card__facts dt { color: var(--text-muted); }
.conflict-card__facts dd { margin: 0; overflow-wrap: anywhere; }
.conflict-card__memo { margin: 8px 0 0; font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.conflict-dialog__all { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; }
.conflict-dialog__all[hidden] { display: none; }
.conflict-dialog__note { margin: 10px 0 0; font-size: 11px; line-height: 1.7; color: var(--text-muted); }
.conflict-dialog__warn { margin: 10px 0 0; font-size: 12px; line-height: 1.6; color: var(--amber-fg); }
/* ボタンは4つ（停止・移動しない・両方とも残す・まとめる）。幅が足りない時は右寄せのまま折り返す */
.conflict-dialog .dialog__actions { flex-wrap: wrap; }
@media (max-width: 599px) {
  .conflict-dialog__pair { grid-template-columns: 1fr; }
  /* スマホでは2つずつ2段にして、どのボタンも切れずに押せる大きさで並べる */
  .conflict-dialog .dialog__actions { display: grid; grid-template-columns: 1fr 1fr; }
}

/* ---------- 重複の一覧（dup-dialog。移動先に同じ行があった時の確認と同じ部品を使い回す） ---------- */

.dup-dialog { width: min(720px, calc(100vw - 32px)); }
.dup-dialog__lead { margin: 0 0 10px; font-size: 13px; line-height: 1.7; color: var(--text-muted); }
.dup-lists { list-style: none; margin: 0; padding: 0; max-height: min(60vh, 520px); overflow: auto; border-top: 1px solid var(--border); }
.dup-lists__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.dup-lists__name { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.dup-lists__n { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dup-lists__acts { display: flex; gap: 6px; flex: 0 0 auto; }
/* 答えが分からなかった「このままにする」がある時の知らせ（確かめ直す口）。注意の色で、一覧の上に置く */
.dup-dialog__unsure { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px;
  font-size: 12px; line-height: 1.6; color: var(--amber-fg); overflow-wrap: anywhere; }
.dup-dialog__unsure p { margin: 0; }
.dup-dialog__unsure-acts { display: flex; gap: 6px; flex: 0 0 auto; }
@media (max-width: 599px) { .dup-dialog__unsure { flex-direction: column; align-items: stretch; } .dup-dialog__unsure-acts { justify-content: flex-end; } }
.dup-dialog__status { min-height: 1.5em; margin: 8px 0 0; font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.dup-dialog__status[data-kind="error"] { color: var(--danger); }
@media (max-width: 599px) {
  .dup-lists__row { flex-direction: column; align-items: stretch; }
  .dup-lists__acts { justify-content: flex-end; }
}

/* ---------- マイページ（アカウントダイアログ） ---------- */

.account__head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.account__avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
  background: var(--surface-2);
}
/* 画像が無い／読めなかった時の受け皿。中の線画アイコンを中央に置く */
.account__avatar--blank { display: grid; place-items: center; color: var(--text-muted); }
.account__avatar--blank .icon { width: 22px; height: 22px; }
.account__who { min-width: 0; }
.account__name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.account__sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* 定義リストを2列に。値が長いメールアドレスは折り返す */
.account__rows {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 13px;
  align-items: baseline;
}
.account__rows dt { color: var(--text-muted); white-space: nowrap; }
.account__rows dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- 表示モードの切替（「この表を絞り込む」の右） ---------- */

.modeswitch {
  display: flex;
  flex: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.modeswitch__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}
.modeswitch__btn:last-child { border-right: 0; }
.modeswitch__btn:hover { background: var(--surface-2); color: var(--text); }
.modeswitch__btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-on); }
/* 狭い画面ではアイコンだけに落とす。文字を残すと絞り込み欄が潰れる */
@media (max-width: 899px) {
  .modeswitch__label { display: none; }
  .modeswitch__btn { padding: 0 7px; }
}

/* ---------- カード表示（行の1件を箱にする）----------
   .cards / .card はジャンル概要のリスト一覧が先に使っているので、
   同じ名前で後から定義すると向こうの見た目を奪ってしまう。別名にする。 */

.itemcardswrap { overflow: auto; min-height: 0; padding: 0 12px 16px; }
.itemcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 8px;
  align-items: start;
}
.itemcard {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  min-width: 0;
}
.itemcard:hover { border-color: var(--border-strong); background: var(--surface-2); }
.itemcard[aria-selected="true"] { border-color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.itemcard--pending { opacity: .55; }
.itemcard__head { display: flex; align-items: flex-start; gap: 8px; width: 100%; min-width: 0; }
.itemcard__head .ncell { flex: 1; min-width: 0; overflow: hidden; }
/* 表では要約を1行 nowrap で省略しているが、カードでその指定が残ると
   「折り返せない長い1行」が器の幅そのものになり、カードを突き抜けて隣に重なる。
   カードは縦に伸ばせるので、折り返して2行で打ち切る。 */
.itemcard__head .ncell__sub {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 値を持つ項目だけが並ぶので、ここに空行は出ない */
.itemcard__specs {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  margin: 0;
  font-size: 12px;
}
.itemcard__specs dt { color: var(--text-faint); white-space: nowrap; }
.itemcard__specs dd { margin: 0; color: var(--text-muted); overflow-wrap: anywhere; }
/* 並びに入りきらなかった項目。件数（「ほか5項目」）では中身が読めないので値を出す。
   2行で打ち切り（末尾に … が出る）、全文は title でマウスオーバーから読める。 */
.itemcard__more {
  font-size: 11px;
  color: var(--text-faint);
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.itemcard__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}
.itemcard__quotes { color: var(--text-faint); }

/* ---------- パネル表示（右を開いたまま ↑↓ で送る） ---------- */

/* 行が並ぶ形なので、表やシートと同じく白地を敷く。ここだけ地の色（--bg）を
   そのまま見せていたため、他のモードから切り替えると中央だけ暗く沈んで見えた。 */
.panelwrap {
  /* 行が少なくても中央を白で埋めきる（表モードの .tablewrap と同じ形）。
     伸ばさないと最後の行より下だけ地の色が残り、直したいことが直らない。 */
  flex: 1;
  overflow: auto;
  min-height: 0;
  padding: 0 12px 16px;
  background: var(--surface);
}
.panelhint {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 2px 8px;
  font-size: 11px;
  color: var(--text-faint);
}
.panellist { display: flex; flex-direction: column; }
.panelrow {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  min-width: 0;
}
.panelrow:first-child { border-top: 0; }
.panelrow:hover { background: var(--row-hover); }
.panelrow[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.panelrow .ncell { flex: 1; min-width: 0; }
.panelrow__date { flex: none; color: var(--text-muted); font-size: 11px; }
.panelrow--pending { opacity: .55; }

/* 名前をページから取っている間の進み具合。ボタンと同じ高さに並べる */
.titlerun { display: inline-flex; align-items: center; gap: 8px; }
.titlerun__count {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- シート表示（全列を出してその場で編集する） ---------- */

/* ここだけは横スクロールを許す。全列を見て埋めるための形なので、
   6列に絞る表モードとは目的が違う。 */
.sheetwrap { overflow: auto; min-height: 0; padding: 0 12px 16px; }
/* 列幅は colgroup の <col> が正（app.js の buildSheet）。table-layout: fixed にすると
   中身の長さで勝手に伸び縮みしなくなり、見出しの境目をドラッグした幅がそのまま残る。
   行数が多いほど描画も速い（ブラウザが全セルの中身を測らずに済む）。 */
table.sheet {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  table-layout: fixed;
}
table.sheet th, table.sheet td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0;
  vertical-align: top;
  background: var(--surface);
}
table.sheet th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 5px 8px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  border-top: 1px solid var(--border);
}
table.sheet tr[aria-selected="true"] td { background: var(--row-selected); }
table.sheet tbody tr:hover td { background: var(--row-hover); }
/* 列ごとの幅指定はここには置かない（colgroup 側に持たせている）。
   ここに min-width を書くと、狭く縮めたい列がその値で止まってしまう。 */

/* 見出しの右端にある、幅を変えるための掴む所。線は普段出さず、乗せた時だけ出す。
   th は position: sticky なので、この絶対配置の基準になる。 */
.sheet__grip {
  position: absolute;
  top: 0;
  right: 0;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;   /* 触って操作する画面で、掴んだ指が縦スクロールに取られないように */
  z-index: 2;
}
.sheet__grip::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 3px;
  width: 3px;
  background: transparent;
}
.sheet__grip:hover::after { background: var(--accent); }
/* ドラッグ中は表全体で矢印を保ち、文字が選択されないようにする */
.sheet--resizing { cursor: col-resize; user-select: none; }
.sheet--resizing .sheet__grip::after { background: var(--accent); }
/* セルの中身。編集部品は既存の .ed / .ed-input をそのまま使う。
   スプレッドシートは「1行1件」で目が走るのが利点なので、セルは折り返さず
   1行で省略し、全文はマウスオーバー（title）に逃がす。 */
table.sheet td { height: 30px; }
/* 見積は読み取り専用の数字なので、編集欄（.edwrap）を持たない。余白と右揃えを
   ここで入れないと、数字がセルの左上の枠線に張り付く。 */
table.sheet td.sheet__c-quotes, table.sheet th.sheet__c-quotes { padding: 6px 8px; text-align: right; }
table.sheet td.sheet__c-quotes { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.sheet td .edwrap { padding: 2px 6px; }
table.sheet td .ed {
  width: 100%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
table.sheet td .rate { margin: 3px 6px; }

/* 折り返し（ツールバーの「切り詰め／折り返し」で切り替える）。列の幅の中で全文を出す。
   行の高さは中身に合わせて伸ばす。 */
table.sheet--wrap td { height: auto; }
table.sheet--wrap td .ed {
  white-space: pre-wrap;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
table.sheet--wrap td .sheetname__static {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
}

/* スペック列の見出しは、名前と操作メニューを横に並べる。メニューはホバー中と
   キーボードで辿った時だけ出す（常に出ていると見出しが読みにくい）。 */
.sheet__th--menu { padding: 0 4px 0 6px; }
.sheet__th--menu > * { vertical-align: middle; }
/* 見出しは列の幅に収める（列を狭めた時に、見出しが表を押し広げないように）。
   操作メニューを持つスペック列だけ、その分を引いた幅にする。 */
.sheet__thlabel {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.sheet__th--menu .sheet__thlabel { max-width: calc(100% - 26px); }
/* 完全に消していると「無い」と読まれる（「消すマークでてこん」と言われた）。
   うっすら出しておいて、乗せた時にはっきりさせる。 */
.sheet__th--menu .rowmenu-btn { opacity: .45; transition: opacity .12s; }
.sheet__th--menu:hover .rowmenu-btn,
.sheet__th--menu .rowmenu-btn:hover,
.sheet__th--menu .rowmenu-btn:focus-visible { opacity: 1; }
@media (hover: none) {
  /* 触って操作する画面ではホバーが無いので、最初から出しておく */
  .sheet__th--menu .rowmenu-btn { opacity: 1; }
}

/* 名前セルは編集欄とリンクを横に並べる。編集欄が伸び、リンクは右端に寄る。
   min-width:0 を入れないと、長い名前が列幅を押し広げてしまう。 */
table.sheet td .sheetname {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  min-width: 0;
}
table.sheet td .sheetname .edwrap { flex: 1 1 auto; min-width: 0; padding: 0; }
.sheetname__static { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheetname__link {
  flex: 0 0 auto;
  color: var(--text-faint);
  text-decoration: none;
  padding: 0 2px;
  line-height: 1;
}
.sheetname__link:hover { color: var(--accent); }

/* 確認日はセルいっぱいの日付入力。枠を消して他のセルと同じ見え方に揃える */
.sheetdate {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 2px 6px;
  border-radius: var(--radius);
}
.sheetdate:hover { background: var(--bg); }

/* ---------- 左サイドバーの折りたたみ ---------- */

.workspace--nosidebar { grid-template-columns: minmax(0, 1fr); }
.workspace--nosidebar.has-detail { grid-template-columns: minmax(0, 1fr) var(--detail-w); }
/* [hidden] はクラスセレクタと詳細度が同じなので、後勝ちを当てにせず明示する */
.sidebar[hidden] { display: none; }

/* ---------- 一括操作バー（④ 一括移動。1件以上選択中に画面下へ浮動） ---------- */

.bulkbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  font-size: 12px;
}
.bulkbar[hidden] { display: none; }
.bulkbar__count { font-weight: 600; }
.bulkbar__spacer { width: 1px; align-self: stretch; background: var(--border); }
/* まとめて評価・確認日（M14）。ボタンが増えたので、狭い画面では折り返して画面からはみ出さない */
.bulkbar { flex-wrap: wrap; justify-content: center; row-gap: 6px; max-width: calc(100vw - 24px); }
.bulkbar__group { display: inline-flex; align-items: center; gap: 4px; }
.bulkbar__label { color: var(--text-muted); margin-right: 2px; }
.bulkbar__rate { min-width: 28px; font-family: var(--font-mono); font-weight: 600; }
.bulkbar__rate[data-rating="A"] { background: var(--rate-a-bg); color: var(--rate-a-fg); border-color: transparent; }
.bulkbar__rate[data-rating="B"] { background: var(--rate-b-bg); color: var(--rate-b-fg); border-color: transparent; }
.bulkbar__rate[data-rating="C"] { background: var(--rate-c-bg); color: var(--rate-c-fg); border-color: transparent; }
.bulkbar__rate[data-rating=""] { font-family: var(--font-body); font-weight: 400; }

/* ---------- トースト ---------- */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  /* 空でも fixed 要素として画面上に居座り、その上のクリックを奪ってしまう。
     幕そのものは触れないようにして、トースト本体だけ触れるようにする。 */
  pointer-events: none;
}
.toasts > * { pointer-events: auto; }

/* ---------- 数の条件の「要確認」の帯（N08） ----------
   表の器の外、.main のいちばん下。表を流しても帯は動かない。開くと縦に流れる */
.numtray { flex: 0 0 auto; border-top: 1px solid var(--border); background: var(--surface); }
.numtray__head {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 16px;
  border: 0; background: transparent; color: var(--text); cursor: pointer; text-align: left; font: inherit;
}
.numtray__head:hover { background: var(--surface-2); }
.numtray__head:focus-visible, .numtray__sec:focus-visible, .numtray__bundle:focus-visible, .numtray__row:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -2px;
}
.numtray__title { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.numtray__sum { flex: 1; min-width: 0; font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.numtray__chev { width: 12px; height: 12px; flex: none; color: var(--text-muted); transition: transform .12s; }
/* chev は右向き。小見出し・束は開くと下向き。帯の頭は畳んでいると上向き（上へ開く）、開くと下向き */
.numtray__sec[aria-expanded="true"] > .numtray__chev, .numtray__bundle[aria-expanded="true"] > .numtray__chev { transform: rotate(90deg); }
.numtray__head[aria-expanded="false"] > .numtray__chev { transform: rotate(-90deg); }
.numtray__head[aria-expanded="true"] > .numtray__chev { transform: rotate(90deg); }
.numtray__body { max-height: min(45vh, 420px); overflow: auto; padding: 0 0 8px; border-top: 1px solid var(--border); }
.numtray__sec, .numtray__bundle {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 16px 4px;
  border: 0; background: transparent; cursor: pointer; text-align: left; font: inherit;
  font-size: 11px; color: var(--text-faint);
}
.numtray__bundle { padding: 6px 16px 4px 28px; color: var(--text-muted); font-size: 11.5px; }
.numtray__sec:hover, .numtray__bundle:hover { color: var(--text); }
.numtray__group { display: flex; flex-direction: column; }
.numtray__row {
  display: flex; align-items: center; gap: 9px; padding: 5px 16px; min-width: 0;
  border-top: 1px solid var(--border); cursor: pointer;
}
.numtray__row:hover { background: var(--row-hover); }
.numtray__row[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.numtray__row .ncell { flex: 1 1 160px; min-width: 0; }
.numtray__whys { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; flex: 2 1 220px; min-width: 0; justify-content: flex-end; }
.numtray__val { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.numtray__why {
  flex: none; font-size: 10.5px; line-height: 16px; padding: 0 6px; border-radius: var(--radius);
  background: var(--surface-3); color: var(--text-muted); border: 1px solid transparent;
}
.numtray__why--other_per, .numtray__why--other_kind, .numtray__why--open_range, .numtray__why--no_per {
  background: var(--amber-bg); color: var(--amber-fg); border-color: var(--amber-border);
}
.numtray__more { margin: 6px 16px 0; align-self: flex-start; }
.numtray__note { margin: 8px 16px 0; font-size: 11px; color: var(--text-faint); }
/* まとめて選ぶ帯・知らせの下に潜らないように */
body:has(#bulkbar:not([hidden])) .numtray { padding-bottom: calc(var(--bulkbar-h, 48px) + 16px); }
body:has(.numtray) .toasts { bottom: calc(16px + var(--numtray-h, 36px)); }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 380px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12px;
}
.toast--error { border-left-color: var(--danger); }
.toast__text { flex: 1; overflow-wrap: anywhere; }

.loading { padding: 20px; color: var(--text-faint); }
.loading__slow { margin: 12px 0 0; display: flex; align-items: center; gap: 10px; color: var(--text-muted); }
.loading__slow[hidden] { display: none; }

/* 1200px 未満では右パネルをオーバーレイにする（行を選んだときだけ JS 側で出す） */
@media (max-width: 1199px) {
  .workspace.has-detail { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  /* この幅では詳細がグリッドの外（position: fixed）に出るので、上の1行が
     サイドバーを隠した状態まで巻き戻してしまう。畳んでいるときは1列に保つ。
     でないと本文が 200px の列に押し込まれ、閉じたのに狭くなる。 */
  .workspace--nosidebar, .workspace--nosidebar.has-detail { grid-template-columns: minmax(0, 1fr); }
  .detail {
    position: fixed;
    top: calc(var(--topbar-h) + var(--tabs-h));
    right: 0;
    bottom: 0;
    width: min(360px, calc(100vw - 48px));
    z-index: 40;
    border-left: 1px solid var(--border-strong);
  }
}

/* サイドバー200px＋固定の列(30+46+150+132+88+44+26=516px。評価送りモード中は
   選択・操作の2列(56px)が無いので460px)＝716px（同・580px）で名前列がちょうど
   ゼロ幅になる。境界をそこに合わせると、そのすぐ上（716〜816px）で名前列が
   60px未満まで潰れて実用にならないので、名前列に最低100pxは残る幅
   （716px＋100px＝816px）を境にする。ここから下は横スクロールへ戻す
   （隠すより読めることを優先する）。 */
@media (max-width: 815px) {
  .tablewrap { overflow-x: auto; }
  .grid { min-width: 620px; }
  /* 自分で幅を決めた表は、上の min-width より合計幅のほうが正。ここに書かないと
     同じ詳細度で後勝ちになり、狭い画面では縮めた列が620pxまで押し戻される。 */
  .grid--sized { min-width: 0; }
}
/* 上部バーは固定幅の要素が横に並ぶだけなので、幅が足りなくなると右端
   （アカウント）が画面の外へ押し出される。body は overflow:hidden なので
   横スクロールでも救えない。実測（ビューポートを実際に変えて計測）では、
   全部出したままで 755px、バッジを落として 535px、ブランドも落として 436px、
   サイドバートグルも消える幅（519px以下）で 396px、検索を虫めがねだけに
   すると 308px。入り切らなくなる手前で、他からも辿り着けるものから順に落とす。 */
@media (max-width: 767px) {
  /* 横断ビューへの入口はこのバッジだけ。幅が足りないので落とす（#/view/unrated で開ける） */
  .badges { display: none; }
}
@media (max-width: 599px) {
  .brand { display: none; }
  /* スマホでは詳細を畳ませない（app.js の detailToggleReason）。押しても何も起きない
     マークを置いたままにすると壊れて見えるので、サイドバーのトグルと同じく隠す（M03） */
  #detail-toggle { display: none; }
}
@media (max-width: 479px) {
  /* 検索は虫めがねだけにする。押して開くパレットは同じものなので、
     入り口の見た目が縮むだけで何も失われない。 */
  .searchbox { min-width: 0; flex: 0 0 auto; }
  .searchbox__label, .searchbox .kbd { display: none; }
}

/* さらに狭い画面ではサイドバーも畳んで、660pxの計算自体を成立させる。
   .detail はこの幅では既に position:fixed（1199px以下のルール）でグリッドの
   トラック計算から外れているため、.sidebar を消すと残るグリッドアイテムは
   .main だけになる。2トラックの定義（0px側 or 200px側）を残したままだと
   .main が最初のトラックへ押し込まれて潰れるので、1トラックに変える。
   has-detail 修飾（1199px以下のルール）の方が詳細度が高く上書きされるので、
   そちらも同じ1トラックに揃えておく。 */
@media (max-width: 519px) {
  .workspace, .workspace.has-detail { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  /* この幅ではサイドバーを出す場所がなく常に非表示。押しても何も起きない
     ボタンを置いたままにすると壊れて見えるので、トグルごと隠す。 */
  #sidebar-toggle { display: none; }
}

/* 共有リンクの合言葉画面でも使う従来のカード。本人ログインは下で限定上書きする。 */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 16px;
}
.login-card {
  width: 100%;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card__brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.04em;
}
.login-card__lead { font-size: 12px; color: var(--text-muted); margin: -6px 0 4px; }
.login-card__google { display: flex; align-items: center; justify-content: center; gap: 8px; }
.login-card__google .icon { width: 16px; height: 16px; }
.login-card__error { font-size: 12px; color: var(--danger); margin: 0; }
.login-card__note { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ログイン画面。採用された白い棚とロゴの構図は、アプリの明暗設定と分離する。 */
body.is-login { display: block; overflow: auto; background: #fff; color-scheme: light; }
#login-screen {
  --accent: #1b5464;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: normal;
  place-items: center;
  background: #fff;
  color: #343d46;
  color-scheme: light;
  padding: 48px 40px;
  box-sizing: border-box;
}
#login-screen[hidden] { display: none; }
#login-screen .login-layout {
  width: min(1024px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 176px;
  align-items: center;
}
#login-screen .login-art {
  width: 500px;
  max-width: none;
  height: auto;
  justify-self: center;
  transform: translate(18px, -18px);
}
#login-screen .login-card { width: 100%; min-width: 0; max-width: none; padding: 0; border: 0; border-radius: 0; background: transparent; display: block; text-align: center; }
#login-screen .login-card__brand { margin: 0; line-height: 1; }
#login-screen .login-card__brand img { display: block; width: 100%; height: auto; }
#login-screen .login-card__lead { color: #343d46; font-size: 30px; font-weight: 600; line-height: 1.5; letter-spacing: .035em; margin: 24px 0 34px; }
#login-screen .login-card__google {
  display: flex;
  width: 100%;
  min-height: 74px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 14px 22px;
  border: 1.5px solid #b6bdc4;
  border-radius: 12px;
  background: #fff;
  color: #343d46;
  font-size: 26px;
  font-weight: 600;
  box-shadow: none;
}
#login-screen .login-card__google:hover { background: #f6f8f7; color: #273039; border-color: #8f9ca2; }
#login-screen .login-card__google .icon { width: 38px; height: 38px; flex: none; }
#login-screen .login-card__error { font-size: 14px; line-height: 1.6; color: #b3261e; margin: 18px 0 0; overflow-wrap: anywhere; }
/* 使っている途中でログインが切れた時の1行（M06）。エラーではないので赤にせず、ボタンの上に置く */
#login-screen .login-card__note { font-size: 15px; line-height: 1.7; color: #343d46; background: #f3f6f5; border: 1px solid #d5dcdb; border-radius: 10px; padding: 12px 16px; margin: -12px 0 22px; text-align: left; overflow-wrap: anywhere; }
@media (max-width: 1100px) {
  #login-screen .login-layout { width: min(900px, 100%); grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 64px; }
  #login-screen .login-art { width: min(440px, 52vw); transform: translate(8px, -12px); }
  #login-screen .login-card__lead { font-size: 26px; }
}
@media (max-width: 720px) {
  #login-screen { padding: 48px 28px; }
  #login-screen .login-layout { display: flex; flex-direction: column; width: min(380px, 100%); gap: 26px; }
  #login-screen .login-art { width: 300px; max-width: 100%; transform: none; }
  #login-screen .login-card__brand img { width: 100%; }
  #login-screen .login-card__lead { font-size: clamp(18px, 4.8vw, 24px); letter-spacing: .01em; margin: 22px 0 30px; }
  #login-screen .login-card__google { min-height: 58px; border-radius: 9px; gap: 12px; padding: 12px 16px; font-size: 18px; }
  #login-screen .login-card__google .icon { width: 28px; height: 28px; }
}
@media (max-width: 720px) and (max-height: 650px) {
  #login-screen { padding-block: 28px; }
  #login-screen .login-layout { gap: 12px; }
  #login-screen .login-art { width: 160px; }
}

/* ---------- 共有リンクの閲覧画面 ---------- */

/* 上部バーもジャンルタブも出さないので、body の3行グリッドを1行に畳む。
   本人用のUI（サイドバー・詳細）も出さないため、作業領域も1トラック。 */
body.is-shared { grid-template-rows: minmax(0, 1fr); }
/* 通信が切れている間は先頭に1段足す（共有の閲覧画面でも同じ） */
body.is-offline { grid-template-rows: auto var(--topbar-h) var(--tabs-h) minmax(0, 1fr); }
body.is-shared.is-offline { grid-template-rows: auto minmax(0, 1fr); }
.offline-bar {
  padding: 6px 16px;
  background: var(--amber-bg);
  color: var(--amber-fg);
  border-bottom: 1px solid var(--amber-border);
  font-size: 12px;
  text-align: center;
}
.offline-bar[hidden] { display: none; }
.workspace--shared,
.workspace--shared.has-detail { grid-template-columns: minmax(0, 1fr); }

.sharedview {
  height: 100%;
  overflow: auto;
  padding: 28px 24px 48px;
  background: var(--surface);
}
.sharedview__head { max-width: 1100px; margin: 0 auto 18px; }
.sharedview__eyebrow { color: var(--text-faint); font-size: 11px; letter-spacing: .04em; }
.sharedview__title {
  margin: 2px 0 0;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 22px;
  text-wrap: balance;
}
.sharedview__desc { margin: 6px 0 0; color: var(--text-muted); }
.sharedview__count { margin: 8px 0 0; color: var(--text-faint); font-size: 12px; }

.sharedtable__wrap {
  max-width: 1100px;
  margin: 0 auto;
  overflow-x: auto;   /* 列が多いときはこの中だけ横に流す */
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
/* 列が少なければ幅いっぱいに、多ければ内容の幅を保って親（.sharedtable__wrap）を
   横に流す。min-width を付けないと、列が増えたぶんだけ各列が潰れ、名前が
   1文字ずつ縦に折り返される。 */
.sharedtable {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: max-content;
  font-size: 12.5px;
}
.sharedtable th, .sharedtable td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  background: var(--surface);
  /* 1列あたりの下限。これが無いと内容の長さに関わらず極端に細くなる */
  min-width: 96px;
  max-width: 260px;
}
/* 評価は1文字なので詰めてよい。名前は読ませたいので広めに取る。
   何列目かではなく列そのものに印を付ける（評価が1件も無いリストでは
   評価列自体が出ないので、位置で決めると別の列に当たってしまう）。 */
.sharedtable .col-rate { min-width: 0; width: 44px; }
.sharedtable .col-name { min-width: 180px; max-width: 320px; }
.sharedtable th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--text-faint);
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-strong);
}
.sharedtable tbody tr:last-child td { border-bottom: 0; }
.sharedtable tbody tr:hover td { background: var(--row-hover); }
/* 名前は読ませたいので折り返す。他の列は詰めて出す（全文は title で読める） */
.sharedname { font-weight: 600; overflow-wrap: anywhere; }
.sharedname--link { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.sharedname--link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.sharedview__memo { max-width: 320px; color: var(--text-muted); white-space: pre-wrap; }
.sharedview__foot {
  max-width: 1100px;
  margin: 14px auto 0;
  color: var(--text-faint);
  font-size: 11px;
}
/* 押せない見せかけの評価チップ（閲覧画面用） */
.rate--static { cursor: default; }
.rate--static:hover { border-color: transparent; }

/* ---------- 共有リンクの管理（リストのカルテ内） ---------- */

.share { display: flex; flex-direction: column; gap: 8px; }
.sharerow {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.sharerow__head { display: flex; align-items: baseline; gap: 8px; }
.sharerow__kind { flex: 1; font-size: 12px; font-weight: 600; }
.sharerow__seen { color: var(--text-faint); font-size: 11px; white-space: nowrap; }
.sharerow__url {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px;
}
.sharerow__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.share__actions { display: flex; }
/* 相手に見せていない項目（リンクごと）。どのリンクで何を外したかを一覧で見分ける */
.sharerow__hidden { margin: 0; color: var(--text-muted); font-size: 11px; overflow-wrap: anywhere; }
/* ダイアログの中では通知（toast）が幕の下に隠れるので、結果をここにも1行出す */
.share__status { margin: 8px 0 0; color: var(--text-muted); font-size: 12px; }
.share__status--error { color: var(--danger); }
.share__status[hidden] { display: none; }

/* 相手に見せる項目のチェック欄（作る時・後から変える時） */
.sharecols { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 4px; }
.sharecols__item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; min-height: 28px; }
.sharecols__item input { margin: 0; }
.sharecols__hint { margin: 4px 0 0; color: var(--text-muted); font-size: 11.5px; line-height: 1.5; }

/* 共有リンクの管理ダイアログ。カルテの欄をそのまま入れるので、少し広めにとる */
.sharemanage { width: min(480px, calc(100vw - 32px)); }
.sharemanage .dsec { padding: 0; border-bottom: 0; }

/* 作り方を選ぶダイアログ。3つの案を、何が起きるかと一緒に並べる */
.sharepick { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.sharepick__item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  color: var(--text);
}
.sharepick__item:hover, .sharepick__item:focus-visible { border-color: var(--accent); background: var(--bg); }
.sharepick__title { font-weight: 600; font-size: 13px; }
.sharepick__note { color: var(--text-muted); font-size: 11.5px; line-height: 1.5; }
/* 期限切れの共有リンク。もう開けないことが見て分かるようにする */
.sharerow--expired { opacity: .7; border-style: dashed; }
.sharerow__warn { margin: 0; color: var(--danger); font-size: 11px; }

/* ---------- 共有ページの見方の切替と、表以外の4つの形 ---------- */

/* 切替ピル。押されている1つだけ塗りつぶす（本人画面のモード切替と同じ約束） */
.sharedmodes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto 14px;
}
.sharedmodes__pill {
  padding: 5px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.sharedmodes__pill:hover { color: var(--text); border-color: var(--accent); }
.sharedmodes__pill.is-on { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }
.sharedview__body { max-width: 1100px; margin: 0 auto; }

/* 「項目｜値」の小さな並び（1件ずつ・カード系で共用） */
.sharedkv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 10px; font-size: 12.5px; }
.sharedkv__k { color: var(--text-faint); white-space: nowrap; }
.sharedkv__v { overflow-wrap: anywhere; white-space: pre-wrap; }

/* 共有ページの見積（X07）。本人が見せると選んだリンクだけ出る */
.squotes { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.squotes--cell { margin-top: 0; gap: 2px; }
.squotes__label { color: var(--text-faint); font-size: 11.5px; }
.squotes__table { border-collapse: collapse; width: 100%; }
.squotes__table td { padding: 3px 8px 3px 0; border-top: 1px solid var(--border); vertical-align: top; }
.squote { display: flex; flex-wrap: wrap; gap: 0 8px; }
.squote__shop { overflow-wrap: anywhere; }
.squote__price { white-space: nowrap; }
.squote__date { color: var(--text-faint); white-space: nowrap; }

/* 1件ずつ */
.sswipe { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.sswipe__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 320px;
  touch-action: pan-y;   /* 縦は普通にスクロール、横は自前でめくる */
}
.sswipe__top { display: flex; justify-content: space-between; align-items: center; }
.sswipe__n { font-size: 11px; color: var(--text-faint); }
.sswipe__name .sharedname { font-size: 18px; }
.sswipe__nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sswipe__dots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
.sswipe__dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.sswipe__dots i.is-on { background: var(--accent); }

/* 評価別 */
.sgroup { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sgroup__head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}
.sgroup__n { margin-left: auto; color: var(--text-faint); }
.sgroup__row { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.sgroup__row:last-child { border-bottom: 0; }
.sgroup__sub { margin-top: 2px; font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 要点（札） */
.schips { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.schips__row { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.schips__row:last-child { border-bottom: 0; }
.schips__head { display: flex; align-items: flex-start; gap: 8px; }
.schips__name { min-width: 0; }
.schips__chips { display: flex; flex-wrap: wrap; gap: 4px; }
.schip {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
  white-space: nowrap;
}
.schip--k { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }

/* タイル */
.stiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 10px; display: flex; flex-direction: column; gap: 5px; min-height: 96px; min-width: 0;
}
.stile__top { min-height: 20px; }
.stile__name .sharedname { font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stile__price { font-size: 12px; color: var(--text-muted); }
.stile__sub { font-size: 10.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* カード（案1） */
.scards { display: flex; flex-direction: column; gap: 10px; }
.scard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.scard__head { display: flex; align-items: flex-start; gap: 8px; }
.scard__name { min-width: 0; font-weight: 600; }

/* 1行＋開く（案2） */
.sopen { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sopen__item { border-bottom: 1px solid var(--border); }
.sopen__item:last-child { border-bottom: 0; }
.sopen__row { display: flex; align-items: center; gap: 8px; padding: 9px 8px 9px 12px; cursor: pointer; min-width: 0; }
.sopen__name { flex: 1; min-width: 0; }
.sopen__sub { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.sopen__toggle { flex: none; width: 28px; height: 28px; border: 0; background: transparent; color: var(--text-faint); font-size: 18px; line-height: 1; cursor: pointer; transition: transform .15s; }
.sopen__item.is-open .sopen__toggle { transform: rotate(90deg); color: var(--text); }
.sopen__body { display: none; padding: 2px 12px 12px; background: var(--surface-2); flex-direction: column; gap: 8px; }
.sopen__item.is-open .sopen__body { display: flex; }

/* 決め手＋下から詳細（案4） */
.saxis { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.saxis__head { display: flex; justify-content: space-between; padding: 6px 12px; font-size: 11px; color: var(--text-faint); border-bottom: 1px solid var(--border); background: var(--bg); }
.saxis__row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; min-width: 0; }
.saxis__row:last-of-type { border-bottom: 0; }
.saxis__name { flex: 1; min-width: 0; }
.saxis__val { flex: none; max-width: 45%; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saxis__val.is-none { color: var(--text-faint); font-weight: 400; }
.saxis__sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-height: 78vh; overflow: auto;
  background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
  padding: 12px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 10px;
}
.saxis__sheet[hidden] { display: none; }
.saxis__sheethead { display: flex; align-items: flex-start; gap: 8px; }
.saxis__sheetname { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .sopen__toggle { transition: none; } }

/* スマホでは余白を詰める */
@media (max-width: 599px) {
  .sharedview { padding: 16px 12px 40px; }
  .sharedview__title { font-size: 19px; }
}

/* リンク発行ダイアログ: 選んだ案に印（押しても閉じず「作る」で確定する） */
.sharepick__item.is-on { border-color: var(--accent); background: var(--accent-soft); }
/* 見せ方は5つあるので2列に詰める。縦に積むと「作る」が画面の下に隠れる */
.sharepick--views { margin-top: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sharepick--views .sharepick__item { padding: 7px 10px; gap: 1px; }
.sharepick--views .sharepick__note { font-size: 11px; }
@media (max-width: 480px) { .sharepick--views { grid-template-columns: 1fr; } }
.dialog .field__label { margin-top: 12px; }

/* ---------- 共有中の印 ---------- */
.listrow__shared { display: inline-flex; color: var(--accent); flex: none; margin-left: 4px; }
.listrow__shared .icon { width: 12px; height: 12px; }
.chip--shared { color: var(--accent); background: var(--accent-soft); border-color: transparent; cursor: pointer; }
.note--shared { display: flex; align-items: center; gap: 6px; color: var(--accent); margin: 0 0 6px; }
.note--shared .icon { width: 13px; height: 13px; flex: none; }
/* 生きているリンクが全部メモを外している時は隠す。display: flex に [hidden] が負けないように */
.note--shared[hidden] { display: none; }

/* ---------- シートの「＋列」 ---------- */
.sheet__addcol { white-space: nowrap; }
.sheet__addcol .btn { font-size: 11.5px; padding: 3px 8px; }

/* ---------- 共有ページの絞り込み ---------- */
.sharedfilter {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  max-width: 1100px; margin: 0 auto 10px;
}
.sharedfilter__input {
  flex: 1 1 180px; min-width: 0;
  padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
}
.sharedfilter__rate { display: flex; gap: 4px; }
.sharedfilter__rate .pill { padding: 4px 10px; font-size: 12px; }
.sharedfilter__count { color: var(--text-faint); font-size: 12px; white-space: nowrap; }

/* ---------- 電話の幅での本人画面（共有ページの見方を流用） ---------- */
.mobilelist { flex: 1; min-height: 0; overflow: auto; padding: 0 10px 24px; background: var(--bg); }
.mobilelist .sgroup, .mobilelist .schips, .mobilelist .sopen, .mobilelist .saxis { border: 0; border-radius: 0; background: transparent; }
.mobilelist .scard, .mobilelist .sopen__body { cursor: pointer; }
.mobilelist .sgroup__row, .mobilelist .schips__row, .mobilelist .stile, .mobilelist .sswipe__card, .mobilelist .saxis__row { cursor: pointer; }
/* 選んでいる行（右のドロワーに出ている行）を色で示す */
.mobilelist [aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.mobilelist .stile[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.mobilelist .sswipe { padding-top: 10px; }
.sharedmodes--owner { margin: 0; flex-wrap: nowrap; overflow-x: auto; }
.sharedmodes--owner .sharedmodes__pill { padding: 4px 11px; font-size: 12px; white-space: nowrap; }
/* 名前セルは表モード用の余白を持つので、札の中では詰める */
.mobilelist .ncell { max-width: none; }
.mobilelist .ncell__sub { display: none; }
/* 電話の一覧の評価の印は押せる（M27）。指で押せる大きさにする。評価別の見出しの印（押せない rate--static）は小さいまま */
.mobilelist .rate:not(.rate--static) { flex: none; width: 36px; height: 30px; font-size: 13px; }
.mobilelist .rate--none:not(.rate--static) { font-size: 12px; }
/* 評価別の行は、名前と要点を左に、押せる印を右端に置く */
.sgroup__row--rate { display: flex; align-items: center; gap: 10px; }
.sgroup__main { flex: 1; min-width: 0; }

/* Settings / API keys */
.settings-dialog { width: min(660px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow-y: auto; }
.settings-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.settings-tabs [role="tab"] { border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-muted); padding: 8px 0 12px; font: inherit; font-size: 13px; cursor: pointer; }
.settings-tabs [aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.api-key-intro, .api-key-message { font-size: 12px; color: var(--text-muted); line-height: 1.7; }
.api-key-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.api-key-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12px; }
.api-key-field:first-child { grid-column: 1 / -1; }
.api-key-field .input { width: 100%; min-width: 0; box-sizing: border-box; }
.api-key-form > button { grid-column: 1 / -1; justify-self: start; }
.api-key-heading { font-size: 13px; margin: 22px 0 10px; }
.api-key-list { display: grid; gap: 8px; }
.api-key-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-width: 0; }
.api-key-card-head { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.api-key-card-head strong { overflow-wrap: anywhere; min-width: 0; }
.api-key-card-head .btn { margin-left: auto; flex-shrink: 0; }
.api-key-status { color: var(--text-muted); white-space: nowrap; font-size: 11px; }
.api-key-card p { margin: 6px 0 0; font-size: 11px; color: var(--text-muted); overflow-wrap: anywhere; line-height: 1.6; }
.api-key-issued { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); padding: 14px; font-size: 12px; }
.api-key-issued p { line-height: 1.7; }
.api-key-issued textarea { display: block; box-sizing: border-box; width: 100%; resize: none; padding: 10px; font: 12px monospace; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 4px; overflow-wrap: anywhere; }
.api-key-issued-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.settings-dialog [hidden] { display: none !important; }
.api-key-field .input { min-height: 36px; padding: 8px 10px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.api-key-field .input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 設定の「つないだアプリ」（スマホの Claude をつなぐ。N05） ---------- */
.conn-intro { font-size: 12px; color: var(--text-muted); line-height: 1.7; margin: 0 0 14px; }
.conn-arm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; }
.conn-arm__state { font-size: 12px; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.conn-arm--open { padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--surface-2); }
.conn-url { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 12px; min-width: 0; }
.conn-url > span { flex: none; color: var(--text-muted); }
.conn-url .input { flex: 1 1 auto; min-width: 0; min-height: 32px; padding: 6px 8px; font: 12px var(--font-mono, monospace); color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.conn-url .input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.conn-howto { margin: 0 0 16px; font-size: 12px; line-height: 1.8; }
.conn-howto summary { cursor: pointer; color: var(--text-muted); }
.conn-howto ol { margin: 6px 0 0; padding-left: 1.4em; }
.conn-list { display: grid; gap: 10px; }
.conn-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-width: 0; }
.conn-card__head { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.conn-card__head strong { overflow-wrap: anywhere; min-width: 0; }
.conn-card__head .btn { margin-left: auto; flex-shrink: 0; }
.conn-card p { margin: 6px 0 0; font-size: 11px; color: var(--text-muted); overflow-wrap: anywhere; line-height: 1.6; }
.conn-status { white-space: nowrap; font-size: 11px; color: var(--text-muted); }
.conn-status--expired { color: var(--amber-fg); }
.conn-activity { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--border); font-size: 11.5px; overflow-wrap: anywhere; }
.conn-activity li { padding: 6px 0; border-bottom: 1px solid var(--border); line-height: 1.6; }
.conn-activity a { color: var(--accent); }
.conn-activity__warn { color: var(--amber-fg); }
.conn-activity__bad { color: var(--danger); }
.conn-activity .btn { margin-left: 6px; }
.conn-before { margin: 6px 0 0; padding: 8px; max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11.5px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.conn-before h4 { margin: 0 0 4px; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.conn-before h4:not(:first-child) { margin-top: 10px; }
.conn-before .btn { margin: 8px 0 0; }
.conn-ended { margin: 16px 0 0; font-size: 12px; }
.conn-ended summary { cursor: pointer; color: var(--text-muted); }
.conn-ended ul { margin: 6px 0 0; padding-left: 1.2em; line-height: 1.7; color: var(--text-muted); overflow-wrap: anywhere; }
.conn-all { margin: 12px 0 0; }
@media (max-width: 599px) {
  .settings-tabs { overflow-x: auto; gap: 14px; }
  .settings-tabs [role="tab"] { flex: 0 0 auto; }
  .conn-arm .btn, .conn-card .conn-card__head .btn, .conn-url .btn, .conn-all .btn { width: 100%; height: 44px; }
  .conn-arm, .conn-url { flex-direction: column; align-items: stretch; }
  .conn-card__head { flex-wrap: wrap; }
}

/* ---------- 同意画面（/connect。public/connect.html + connect.js） ---------- */
body.connect-body { display: block; overflow: auto; min-height: 100%; }
.connect { display: flex; justify-content: center; padding: 32px 16px 48px; }
.connect-card { width: min(480px, 100%); padding: 22px 20px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.connect-title { margin: 0 0 12px; font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; }
.connect-title:focus { outline: none; }
.connect-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.connect-sub { margin: 16px 0 6px; font-size: 12.5px; }
.connect-facts, .connect-can, .connect-cannot { list-style: none; margin: 0; padding: 0; font-size: 12.5px; line-height: 1.8; overflow-wrap: anywhere; }
.connect-facts { color: var(--text-muted); font-size: 12px; }
.connect-cannot { color: var(--text-muted); }
.connect-text, .connect-status { margin: 8px 0 0; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.connect-warn { margin: 14px 0 0; padding: 10px 12px; font-size: 12.5px; line-height: 1.7; color: var(--amber-fg); background: var(--amber-bg); border: 1px solid var(--amber-border); border-radius: var(--radius); }
.connect-note { margin: 14px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.7; }
.connect-check { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 13px; }
.connect-actions { display: flex; gap: 10px; margin: 16px 0 0; }
.connect-error { color: var(--danger); min-height: 1.4em; font-size: 12px; }
@media (max-width: 599px) {
  .connect { padding: 16px 16px 32px; }
  .connect-actions { flex-direction: column; }
  .connect-btn { width: 100%; height: 44px; }
}

/* ---------- スマホで引っかかる所（M28・M29） ---------- */

/* 検索パレットが空の時に出す、横断ビュー（未評価・鮮度切れ）への入口（M29）。上の帯のバッジと同じ形 */
.palette__views { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 8px 4px; }

/* ジャンルの一覧の下の「アーカイブ (n)」（M29）。左の一覧に同じボタンがあるので、左の一覧が出ている間は隠す */
.overarch { display: none; flex: none; padding: 4px 8px; border-top: 1px solid var(--border); background: var(--surface); }
.workspace--nosidebar .overarch { display: block; }
@media (max-width: 519px) { .overarch { display: block; } }

/* 並びを1つ動かすメニュー（M29）。矢印のアイコンは右向きなので回して使う */
.icon--up { transform: rotate(-90deg); }
.icon--down { transform: rotate(90deg); }

/* 指で触る端末（M28）。
   iPhone の Safari は、文字が16px未満の入力欄に触ると画面を拡大し、入力の後に毎回つまんで戻す手間が出る。
   本文は13pxで、入力欄はそれを受け継ぐ（button, input, select, textarea { font: inherit }）ので、
   触って操作する端末だけ入力欄の文字を16pxにする。viewport の maximum-scale で拡大そのものを止める手は
   取らない（自分でつまんで拡大する操作まで奪うため）。
   (hover: none) and (pointer: coarse) は、マウスやトラックパッドの無い端末だけに当たる。iPad にトラックパッドを
   付けた時や、タッチ式のノートをマウスで使う時は当たらない（掴み手を隠す (hover: none) と同じ見分け方）。 */
@media (hover: none) and (pointer: coarse) {
  /* :not() を並べて、各所の font-size（.palette__head input の15px・.sharedfilter__input の13px など）より強くする。
     :is() でまとめるのは、textarea と select にも同じ強さを持たせるため（:is() の強さは中でいちばん強いもの）。
     素の textarea のままだと、シートの複数行の編集欄（.ed-input--multi の font: inherit）に負けて13pxのまま残った */
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), textarea, select) { font-size: 16px; }
  /* 高さ24px固定の欄は、文字を16pxにすると枠からはみ出すので広げる。min-height なので、
     スマホ幅でもっと高くしている行の追加欄（40px）はそのまま */
  .filterinput, .addrow__input { min-height: 32px; }
  /* 押す部品を指の大きさに（24px → 32px）。絞り込みの評価・見方の切り替え・「＋ 行を追加」など。
     36px にするとリストの見出しがスマホで約90px伸びて、表が見える所が減った（2026-09-27 に幅375pxで測った）ので
     32px にとどめる。1文字の評価（A・B・C）は幅も狭いので、幅も32pxまで広げる */
  .pill, .btn--small, .sharedmodes__pill { min-height: 32px; }
  .pill { min-width: 32px; }
  /* 小さい四角のボタン（上の帯・見出しの「…」＝リストのメニュー・リストの評価）は、見た目の大きさと並びは
     そのままにして、押せる範囲だけ周りへ6px広げる。見た目ごと大きくすると、見出しの「…」が1段目に入りきらず
     独りで2段目へ落ち、幅320pxの画面では上の帯が右へはみ出した。周りとの隙間は8〜12pxなので、広げた範囲が
     隣のボタンの見た目には重ならない */
  .iconbtn, .mainhead .rowmenu-btn, .lrate--btn { position: relative; }
  .iconbtn::after, .mainhead .rowmenu-btn::after, .lrate--btn::after { content: ""; position: absolute; inset: -6px; }
  .popitem, .archtoggle { padding: 10px 8px; }
  /* 押す幅を広げたぶんメニューが長くなるので、画面より長い時は中で送る。
     :where() で詳細度を0にして、自分で高さを決めているメニュー（.popover--cols など）はそのまま */
  :where(.popover) { max-height: calc(100dvh - 16px); overflow-y: auto; }
}

/* ---------------------------------------------------------------- 地図（2026-10-04）
   左に地図、右にパネルと同じ細い一覧。地図は中央の高さいっぱいに伸ばす（Leaflet は器の
   大きさで絵を敷くので、高さの無い器だと何も出ない）。 */
.mapview {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 30%);
  background: var(--surface);
}
.mapview__left { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0 0 8px 12px; }
.mapview__map {
  flex: 1;
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  /* Leaflet の部品（拡大縮小・帰属）が他の重ね物より上に出ないように箱の中へ閉じる */
  isolation: isolate;
  z-index: 0;
}
.mapview__note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px;
  padding: 6px 2px 0; font-size: 11px; color: var(--text-muted);
}
.mapview__muted { color: var(--text-faint); }
.mapview__legend { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.mapview__dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.mapview__side { border-left: 1px solid var(--border); }
.mapview .maplibregl-map { font-family: var(--font-body); }
.mappop { display: flex; flex-direction: column; gap: 3px; min-width: 180px; }
.mappop__name { font-weight: 600; font-size: 13px; line-height: 1.35; }
.mappop__addr { font-size: 11px; color: #555; line-height: 1.4; }
.mappop__meta { font-size: 11px; }
.mappop__links { display: flex; gap: 10px; margin-top: 4px; font-size: 12px; }
@media (max-width: 900px) {
  .mapview { grid-template-columns: 1fr; grid-template-rows: minmax(320px, 60%) auto; }
  .mapview__side { border-left: 0; border-top: 1px solid var(--border); }
}

/* 同じ場所にまとめた点のふきだし（地図・近い順） */
.mappop__group { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; max-height: 220px; overflow: auto; }
.mappop__member { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.mappop__pick { flex: 1; min-width: 0; border: 0; background: none; padding: 2px 0; text-align: left; color: var(--accent); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: inherit; }
.mappop__pick:hover { text-decoration: underline; }
.mappop__rate {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 16px; flex: none;
  border-radius: var(--radius); background: var(--surface-3); color: var(--text-muted);
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
}
.mappop__rate[data-rating="A"] { background: var(--rate-a-bg); color: var(--rate-a-fg); }
.mappop__rate[data-rating="B"] { background: var(--rate-b-bg); color: var(--rate-b-fg); }
.mappop__rate[data-rating="C"] { background: var(--rate-c-bg); color: var(--rate-c-fg); }
.mapbase-label { font-weight: 600; color: var(--accent); }

/* ---------------------------------------------------------------- 近い順（2026-10-05） */
.mapview--nearby { grid-template-columns: minmax(0, 1fr) minmax(300px, 34%); }
.nearside { display: flex; flex-direction: column; min-height: 0; overflow: auto; background: var(--surface); }
.nearhead { position: sticky; top: 0; z-index: 2; display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.nearhead__form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nearhead__label { font-size: 11px; color: var(--text-muted); }
.nearhead__input { flex: 1 1 160px; min-width: 0; height: 26px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 12px; }
.nearhead__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nearhead__switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); cursor: pointer; }
.nearhead__switch--off { color: var(--text-faint); cursor: default; }
.nearhead__msg { font-size: 11px; color: var(--text-muted); min-height: 0; }
.nearhead__msg:empty { display: none; }
.nearlist { padding: 0 12px 16px; }
.nearlist__title { display: flex; justify-content: space-between; padding: 10px 2px 4px; font-weight: 600; font-size: 12px; }
.nearlist__hint { margin: 10px 2px; font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.nearband { margin-top: 6px; }
.nearband__head { display: flex; justify-content: space-between; padding: 4px 6px; background: var(--surface-2); border-radius: var(--radius); font-size: 11px; font-weight: 600; color: var(--text-muted); cursor: default; }
details.nearband > summary.nearband__head { cursor: pointer; list-style: none; }
details.nearband > summary.nearband__head::-webkit-details-marker { display: none; }
.nearrow {
  display: grid; grid-template-columns: 22px 28px minmax(0, 1fr) auto; align-items: center; column-gap: 8px;
  padding: 6px 6px; border-top: 1px solid var(--border); cursor: pointer;
}
.nearrow:hover { background: var(--row-hover); }
.nearrow[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.nearrow--pending { opacity: .55; }
.nearrow__rank { font-size: 11px; color: var(--text-faint); text-align: right; }
.nearrow__body { min-width: 0; }
.nearrow__name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nearrow__addr { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nearrow__km { font-size: 12px; font-weight: 600; white-space: nowrap; }
.nearrow__acts { grid-column: 2 / -1; display: none; flex-wrap: wrap; gap: 6px; padding: 6px 0 2px; }
.nearrow[aria-selected="true"] .nearrow__acts { display: flex; }
.nearrow__acts a.btn { text-decoration: none; }

/* ---------------------------------------------------------------- 散らばり図（2026-10-05） */
.scatter { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 12px; background: var(--surface); }
.scatter__head { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; font-size: 12px; }
.scatter__axissel { display: inline-flex; align-items: center; gap: 4px; }
.scatter__axissel span { color: var(--text-muted); font-size: 11px; }
.scatter__axissel select { height: 24px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 12px; padding: 0 4px; }
.scatter__region-note { display: inline-flex; align-items: center; gap: 4px; }
.scatter__swatch { width: 12px; height: 10px; background: rgba(27, 84, 100, .12); border: 1px dashed var(--accent); }
.scatter__legend { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); }
.scatter__plot { position: relative; flex: 1; min-height: 360px; }
.scatter__svg { display: block; width: 100%; height: auto; max-height: calc(100vh - 260px); font-family: var(--font-mono); }
.scatter__region { fill: rgba(27, 84, 100, .08); }
.scatter__median { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 4; opacity: .7; }
.scatter__grid { stroke: var(--border); stroke-width: 1; }
.scatter__axis { stroke: var(--border-strong); stroke-width: 1; }
.scatter__tick { fill: var(--text-muted); font-size: 11px; }
.scatter__label { fill: var(--text-muted); font-size: 11px; font-family: var(--font-body); }
.scatter__out { fill: var(--text-muted); font-size: 10px; }
.scatter__dot { stroke: #ffffff; stroke-width: 1.5; cursor: pointer; }
.scatter__dot:hover { stroke: var(--text); }
.scatter__dot[aria-selected="true"] { stroke: var(--text); stroke-width: 2.5; }
.scatter__dot:focus-visible { outline: none; stroke: var(--accent); stroke-width: 3; }
.scatter__tip {
  position: absolute; z-index: 2; max-width: 260px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-pop); font-size: 12px;
}
.scatter__tip[hidden] { display: none; }
.scatter__tiphead { display: flex; align-items: center; gap: 6px; }
.scatter__tipname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scatter__tipvals { color: var(--text); }
.scatter__tipnear { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 11px; }
.scatter__tippick { border: 0; background: none; padding: 0; text-align: left; color: var(--accent); cursor: pointer; font: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- 画像で並べる（2026-10-05） */
.gallery { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; background: var(--surface); }
.gallery__head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; padding: 4px 12px; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 12px; }
.gallery__label { font-size: 11px; color: var(--text-muted); }
.gallery__grid { display: grid; gap: 12px; padding: 12px; align-content: start; }
.gallery__grid--s { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.gallery__grid--m { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.gallery__grid--l { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
/* 見せ方「画像全体」：札の幅はそろえたまま、画像の部分の高さを各画像の縦横比（--ar。読めるまでは 4:5）に合わせ、
   切り抜かずに全体を出す。札の高さがそろわないので、行の中では上にそろえる */
.gallery__grid--whole { align-items: start; }
.gallery__grid--whole .gcard__img--photo { aspect-ratio: var(--ar, 4 / 5); }
.gallery__grid--whole .gcard__img--photo img { object-fit: contain; }
/* 画像の上に重ねる色の線は端を隠すので出さない。種類の印は画像の下（札の本文の頭）に置く（app.js） */
.gallery__grid--whole .gcard__img--typed::after { display: none; }
.gcard__body > .gcard__ftype { position: static; align-self: flex-start; background: var(--ftone, var(--gfile-file)); box-shadow: none; }
.gcard { position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; overflow: hidden; min-width: 0; }
.gcard:hover { border-color: var(--border-strong); }
.gcard[aria-selected="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.gcard--pending { opacity: .55; }
/* 代表画像は横長（1.91:1）が多いので、札の形もそれに合わせる（UI案のふり返り） */
.gcard__img { aspect-ratio: 1.91 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: var(--surface-3); color: var(--text-muted); font-size: 11px; text-align: center; padding: 0; overflow: hidden; }
.gcard__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gcard__img--none, .gcard__img--todo, .gcard__img--failed { padding: 8px; }
.gcard__img--todo { background: var(--surface-2); outline: 1px dashed var(--border-strong); outline-offset: -6px; }
.gcard__img--failed { background: var(--amber-bg); color: var(--amber-fg); }
/* 画像の無い札：何の行か（サイト名・ファイルの種類・検索語）を大きく、理由を小さく */
.gcard__host { font-size: 13px; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.gcard__why { font-size: 11px; color: var(--text-muted); }
.gcard__img--logo { background: #ffffff; }
.gcard__img--logo img { object-fit: contain; padding: 14% 18%; }
.gcard__img--gfile, .gcard__img--gsearch { padding: 8px 12px; --gtone: var(--gfile-file); background: color-mix(in srgb, var(--gtone) 9%, var(--surface)); box-shadow: inset 0 3px 0 var(--gtone); }
.gcard__img--g-doc { --gtone: var(--gfile-doc); }
.gcard__img--g-sheet { --gtone: var(--gfile-sheet); }
.gcard__img--g-slide { --gtone: var(--gfile-slide); }
.gcard__img--g-form { --gtone: var(--gfile-form); }
.gcard__img--g-pdf { --gtone: var(--gfile-pdf); }
.gcard__img--gsearch { --gtone: var(--gfile-doc); }
.gcard__gtype { font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--gtone); display: inline-flex; align-items: center; gap: 5px; }
.gcard__gtype .icon { width: 18px; height: 18px; stroke-width: 1.4; }
/* 画像のある札の種類の印（左下）と種類の色の線（上）。Google のファイル・PDF・Office の行だけ（2026-10-06） */
.gcard__img--typed { position: relative; }
.gcard__img--typed::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--gtone, var(--gfile-file)); }
.gcard__ftype { position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px; max-width: calc(100% - 12px); padding: 2px 7px 2px 5px; border-radius: var(--radius); background: var(--gtone, var(--gfile-file)); color: var(--surface); font-size: 11px; font-weight: 600; line-height: 1.5; letter-spacing: .02em; box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.gcard__ftype .icon { width: 14px; height: 14px; flex: none; stroke-width: 1.4; }
.ftype__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard__q { font-size: 12px; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gallery__grid--s .gcard__why, .gallery__grid--s .gcard__img .btn { display: none; }
/* 位置のある行の地図（画像の代わり） */
.gcard__img--map { position: relative; padding: 0; }
.gmap { position: absolute; inset: 0; overflow: hidden; background: var(--surface-3); }
.gmap__tiles { position: absolute; width: 768px; height: 768px; }
.gcard__img .gmap__tiles img { position: absolute; width: 256px; height: 256px; max-width: none; }
.gmap__pin { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent); }
.gmap__credit { position: absolute; right: 3px; bottom: 2px; font-size: 9px; color: #5f6b68; background: rgba(255, 255, 255, .75); padding: 0 3px; border-radius: 2px; }
.gcard__mapnote { position: absolute; left: 6px; bottom: 4px; max-width: calc(100% - 70px); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.gcard__mapnote .gcard__why { background: rgba(255, 255, 255, .85); color: #4f5b58; padding: 1px 5px; border-radius: 2px; }
.gcard__over { position: absolute; top: 6px; left: 6px; right: 6px; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.gcard__over > * { pointer-events: auto; }
.gcard__over .rate { box-shadow: 0 0 0 1.5px #ffffff; }
/* 札全体に重ねた透明のリンク。評価の札と画像の中のボタンだけはその上に出して押せるようにする */
.gcard__hit { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.gcard__hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gcard__over { z-index: 2; }
/* 札の中の重ね順（透明のリンク・評価の印・ボタン）は札の中だけで比べる。閉じ込めないと、下へ流した時に上へ流れた札の
   評価の印が、上の帯（画像の大きさ…・z-index 2）の上に重なって見えた（2026-10-07 の点検） */
.gcard { isolation: isolate; }
.gcard__img .btn { position: relative; z-index: 2; }
.gcard__body { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px 10px; }
.gcard__name { font-weight: 500; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gcard__meta { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery__grid--s .gcard__meta { display: none; }

/* ---------------------------------------------------------------- 画像を右の詳細・カード・一覧にも（2026-10-05） */
/* 右の詳細の一番上。代表画像は横長（1.91:1）が多いので、その比率で幅いっぱいに */
.detail__figure { position: relative; margin: 0; border-bottom: 1px solid var(--border); background: var(--surface-3); }
.detail__figure > a { display: block; }
.detail__img { display: block; width: 100%; aspect-ratio: 1.91 / 1; max-height: 240px; object-fit: cover; }
.detail__figure--map { height: 150px; overflow: hidden; }
.detail__maplink { position: absolute; inset: 0; display: block; color: inherit; }
.detail__figure .gmap__tiles img { position: absolute; width: 256px; height: 256px; max-width: none; }
.detail__mapbtn {
  position: absolute; right: 8px; top: 8px; padding: 3px 8px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .94); border: 1px solid var(--border-strong); font-size: 11px; color: var(--accent);
}
.detail__maplink:hover .detail__mapbtn { background: #ffffff; border-color: var(--accent); }
.detail__figure--map .detail__imgline { position: absolute; left: 8px; bottom: 8px; right: 8px; background: rgba(255, 255, 255, .94); border: 1px solid var(--border); border-radius: var(--radius); }
.detail__imgline { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 11px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.detail__imgline > span { flex: 1; min-width: 0; }

/* カードの一番上 */
.itemcard__img { display: block; width: calc(100% + 22px); margin: -10px -11px 0; aspect-ratio: 1.91 / 1; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface-3); }

/* パネル・地図の右の一覧の名前の前 */
.panelrow__img { flex: none; width: 44px; height: 24px; object-fit: cover; border-radius: 2px; background: var(--surface-3); }

/* 近い順の行 */
.nearrow__body:has(.nearrow__img) { display: grid; grid-template-columns: 56px minmax(0, 1fr); column-gap: 8px; align-items: center; }
.nearrow__img { grid-row: span 2; width: 56px; height: 30px; object-fit: cover; border-radius: 2px; background: var(--surface-3); }

/* 地図のふきだし */
.mappop__img { display: block; width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; border-radius: 2px; margin-bottom: 4px; background: var(--surface-3); }

/* 地図の上の Googleマップへの口（2026-10-05） */
.mapgbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 0 6px; }
.mapgbar .btn { gap: 5px; }
.mapgbar a.btn { text-decoration: none; }

/* 右の詳細: 画像の取り直し・アイコンの画像・場所の1行（2026-10-05） */
.detail__body > .detail__figure, .detail__body > .detail__imgline, .detail__body > .detail__place { flex: none; }
.detail__body > .detail__figure { margin: -1px 0 0; }
.detail__retake {
  position: absolute; right: 8px; top: 8px; height: 22px; padding: 0 8px; border-radius: var(--radius);
  border: 1px solid #c6cecb; background: rgba(255, 255, 255, .94); color: #1b5464; font: inherit; font-size: 11px; cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.detail__figure:hover .detail__retake, .detail__retake:focus-visible { opacity: 1; }
.detail__retake[disabled] { cursor: default; opacity: .5; }
.detail__figure--logo { background: #ffffff; }
.detail__figure--logo .detail__img { object-fit: contain; max-height: 96px; padding: 12px; box-sizing: border-box; }
.detail__place { display: flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 12px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.detail__place .icon { flex: none; }
.detail__addr { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail__placelinks { display: inline-flex; gap: 10px; flex: none; }
.detail__placelinks a { color: var(--accent); }
@media (max-height: 820px) { .detail__img { max-height: 160px; } }

/* 小さな画像がアイコンだった時（320px 以下）は、引き伸ばさず白地に全体を見せる */
.itemcard__img--logo, .panelrow__img--logo, .nearrow__img--logo, .mappop__img--logo, .scatter__tipimg--logo, .mappop__memberimg--logo {
  object-fit: contain; background: #ffffff;
}

/* 散らばり図のふきだし・同じ場所のふきだしの画像 */
.scatter__tip:has(.scatter__tipimg) { width: 220px; }
.scatter__tipimg { display: block; width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; border-radius: 2px; background: var(--surface-3); }
.mappop__memberimg { flex: none; width: 36px; height: 20px; object-fit: cover; border-radius: 2px; background: #eceeed; }

/* 地図の名札（点に乗った時）: 小さく、長い会場名は折り返す。押せないので指の邪魔をしない */
.mapview .maplibregl-popup.mapname { pointer-events: none; }
.mapview .maplibregl-popup.mapname .maplibregl-popup-content { padding: 4px 8px; font-size: 12px; line-height: 1.45; white-space: normal; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }

/* ふきだし・名札は白地に固定なので、ダーク表示でも文字は濃い色のまま（明るいアクセントは白の上で読めない） */
.mapview .maplibregl-popup-content { color: #141a19; font-family: var(--font-body); border-radius: 8px; }
.mapview .mappopup .maplibregl-popup-content { padding: 12px 14px 10px; box-shadow: 0 3px 14px rgba(0, 0, 0, .22); }
.mapview .maplibregl-popup-close-button { font-size: 18px; width: 28px; height: 28px; color: #4f5b58; }
.mapview .maplibregl-popup-content a, .mappop__pick, .mapbase-label { color: #1b5464; }
/* 基準の場所の印（近い順） */
.mapbase { display: flex; align-items: center; gap: 6px; pointer-events: none; }
.mapbase__dot { width: 18px; height: 18px; box-sizing: border-box; border-radius: 50%; background: #1b5464; border: 3px solid #ffffff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.mapbase .mapbase-label { background: #ffffff; padding: 1px 6px; border-radius: 4px; font-size: 12px; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); white-space: nowrap; }
.mappop__addr { color: #555f5c; }
.detail__mapbtn { color: #1b5464; }
.detail__figure--map .detail__imgline { color: #4f5b58; }
.nearlist__empty { margin: 10px 2px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--text-muted); }
.nearlist__empty p { margin: 0; line-height: 1.6; }
.nearlist__pick { display: flex; justify-content: flex-end; padding: 6px 2px 0; }
.scatter__region-note .btn--mini { margin-left: 6px; }

/* 電話の一覧（1件ずつ・タイル・カード）の代表画像（本人の画面だけ。共有ページには出さない） */
.sswipe__img, .scard__img { display: block; width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; border-radius: var(--radius); margin-bottom: 8px; background: var(--surface-3); }
.stile__img { display: block; width: calc(100% + 20px); margin: -9px -10px 2px; aspect-ratio: 1.91 / 1; object-fit: cover; border-radius: 8px 8px 0 0; background: var(--surface-3); }
.sswipe__img--logo, .scard__img--logo, .stile__img--logo { object-fit: contain; background: #ffffff; }

/* 行の表・シートの画像の列（2026-10-06）。行の高さ 44px に収める */
.cellthumb { display: block; width: 64px; height: 34px; object-fit: cover; border-radius: 2px; background: var(--surface-3); }
.cellthumb--logo { object-fit: contain; background: #ffffff; }
/* 資料の種類の色（--gfile-*）。画像の見方の --gtone とは別の変数にする（.gcard__img--g-* を上書きしない） */
.ftype--doc { --ftone: var(--gfile-doc); }
.ftype--sheet { --ftone: var(--gfile-sheet); }
.ftype--slide { --ftone: var(--gfile-slide); }
.ftype--form { --ftone: var(--gfile-form); }
.ftype--pdf { --ftone: var(--gfile-pdf); }
.ftype--folder, .ftype--file { --ftone: var(--gfile-file); }
/* 表の小さな画像の左の色の線 */
.cellthumb--ft { border-left: 4px solid var(--ftone); border-radius: 0 2px 2px 0; }
/* 名前の前の種類の印。色の地に白抜きのアイコンだけ・どれも同じ大きさ（2026-10-08） */
.ftchip {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-top: 1px; border-radius: 4px;
  background: var(--ftone); color: var(--surface);
}
.ftchip .icon { width: 14px; height: 14px; flex: none; stroke-width: 1.5; }
/* URL の無い行の空き。アイコンのある行が1つも無い表・カードでは場所を取らない */
.ftchip--blank { display: none; background: none; }
.grid:has(.ftchip:not(.ftchip--blank)) .ftchip--blank,
table.sheet:has(.ftchip:not(.ftchip--blank)) .ftchip--blank { display: inline-flex; }
/* ドライブの種類のアイコン・サイトのファビコン。地の色は付けない（アイコン自体の色で見分ける） */
.ftchip--fav { background: none; }
.ftchip__img { display: block; width: 18px; height: 18px; object-fit: contain; }
.grid .ncell__top .ftchip { margin-top: 2px; }
table.sheet td .sheetname .ftchip { margin: 0 2px 0 0; }
.grid td.c-image, table.sheet td.sheet__c-image { padding-top: 2px; padding-bottom: 2px; }

/* 画像の札に出す項目（2026-10-06） */
.gfields { min-width: 220px; max-height: 360px; overflow: auto; }
.gfields__item { display: flex; align-items: center; gap: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.gfields__item:hover { background: var(--row-hover); }

/* ---------------------------------------------------------------- 地図 案4（2026-10-07）
   地図は MapLibre で直接動かす。地図の絵は OpenFreeMap の淡い地図。寄ると写真の丸いピン、地図の下に今見えている会場のカードの帯。
   地図の上の白い部品（ピン・カード）は地図の絵と同じく明るい色のまま（ダークでも地図は明るいので） */
/* 狭い幅の .mapview（地図と一覧の2段）より後に書いて、1段のまま高さいっぱいにする */
.mapview--cards { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.mapview--cards .mapview__left { padding: 0 12px 8px; }
.mapview__stage { position: relative; flex: 1; min-height: 360px; display: flex; flex-direction: column; }
.mapview__stage > .mapview__map { flex: 1; }

.mappin-wrap { cursor: pointer; }
.mappin {
  position: relative; box-sizing: border-box;
  width: var(--size); height: var(--size); border-radius: 50%;
  background: var(--pin); border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .32);
  display: flex; align-items: center; justify-content: center;
  color: #ffffff; font: 700 12px/1 var(--font-body);
  cursor: pointer;
}
.mappin--photo { border-color: var(--pin); background: #ffffff; }
.mappin--on { border-width: 4px; }
.mappin::after {
  content: ""; position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%);
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 9px solid var(--pin);
}
.mappin:not(.mappin--photo)::after { border-top-color: #ffffff; }
.mappin[data-rating="B"] .mappin__mark { color: #3b2f00; }
.mappin .mappin__img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.mappin__count {
  position: absolute; top: -6px; right: -8px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box;
  border-radius: 9px; background: #1b5464; color: #ffffff; border: 2px solid #ffffff;
  font: 600 10px/14px var(--font-mono); text-align: center;
}
.mappin__label {
  position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%);
  max-width: 200px; width: max-content; padding: 2px 8px; border-radius: 10px;
  background: #ffffff; color: #141a19; box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  font: 600 12px/1.5 var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.mapcards {
  position: absolute; left: 0; right: 0; bottom: 22px; z-index: 500;
  pointer-events: none;
}
.mapcards__track {
  display: flex; gap: 12px; padding: 4px 16px 6px;
  overflow-x: auto; scroll-behavior: smooth; scrollbar-width: thin;
  pointer-events: auto;
}
.mapcard {
  flex: none; width: 280px; height: 104px; display: flex; overflow: hidden; cursor: pointer;
  background: #ffffff; color: #141a19; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
  outline: 0 solid transparent;
}
.mapcard[aria-selected="true"] { outline: 3px solid #1b5464; outline-offset: -3px; }
.mapcard__img { flex: none; width: 96px; height: 104px; object-fit: cover; background: #eceeed; display: block; }
.mapcard__img--logo { object-fit: contain; padding: 10px; box-sizing: border-box; }
.mapcard__img--none { display: flex; align-items: center; justify-content: center; color: #6b7471; }
.mapcard__img--none[data-rating="A"] { background: #f4cccc; }
.mapcard__img--none[data-rating="B"] { background: #fff2cc; }
.mapcard__img--none[data-rating="C"] { background: #d9ead3; }
.mapcard__body { flex: 1; min-width: 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.mapcard__head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mapcard__name {
  flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; cursor: pointer;
  font: 600 14px/1.35 var(--font-body); color: #141a19;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mapcard__sub { font-size: 11px; color: #555f5c; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapcard__links { margin-top: auto; display: flex; gap: 12px; font-size: 12px; }
.mapcard__links a { color: #1b5464; display: inline-flex; align-items: center; gap: 3px; text-decoration: none; }
.mapcard__links a:hover { text-decoration: underline; }
.mapcard .mappop__rate[data-rating="A"] { background: #f4cccc; color: #7a1d1d; }
.mapcard .mappop__rate[data-rating="B"] { background: #fff2cc; color: #5c4600; }
.mapcard .mappop__rate[data-rating="C"] { background: #d9ead3; color: #23461a; }
.mapcard .mappop__rate:not([data-rating="A"]):not([data-rating="B"]):not([data-rating="C"]) { background: #e6e9e8; color: #4a5250; }
@media (max-width: 900px) {
  .mapcard { width: 240px; height: 92px; }
  .mapcard__img { width: 80px; height: 92px; }
}

/* ---------- ジャンルの段（1｜2｜3。2026-10-07） ----------
   上の帯の右端（設定の右）。押すと上のタブがその段のジャンルだけになる。今の段は濃い色 */
.topbar__sep { width: 1px; height: 22px; background: var(--border); flex: none; }
.tierswitch {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.tierswitch__btn {
  width: 28px;
  height: 26px;
  border: 0;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
}
.tierswitch__btn + .tierswitch__btn { border-left: 1px solid var(--border-strong); }
.tierswitch__btn:hover { background: var(--surface-2); color: var(--text); }
.tierswitch__btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-on); font-weight: 600; }
.tierswitch__btn--arming { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.tierswitch__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 段の切り替え（約100px）を足した分、上の帯の右端（設定・段）が画面の外へ押し出されないようにする（実測：全部出して
   約910px。版の札が出る 900px 以上はさらに約50px）。1023px 以下は段の鉛筆と区切り線を落とす（段を編集はタブの
   右クリックからも開ける）。899px 以下は「＋ 新しいリスト」を「＋」だけにする（押せば同じ画面が開く） */
@media (max-width: 1023px) {
  .topbar__sep, #tier-edit { display: none; }
}
@media (max-width: 899px) {
  .newlist__label { display: none; }
  #new-list { min-width: 32px; padding: 0 10px; }
  /* 768〜772px でまだ数px はみ出したので、段のボタンも少し細くする */
  .tierswitch__btn { width: 24px; }
}

/* 段にジャンルが無い時のタブの帯 */
.genretabs__empty { display: inline-flex; align-items: center; gap: 10px; padding: 0 12px; color: var(--text-faint); font-size: 12px; flex: none; }

/* タブの右クリックで出す「移す段」 */
.tiermenu { min-width: 240px; }
.tiermenu__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 4px 6px 6px; }
.tiermenu__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.tiermenu__btn:hover { background: var(--surface-2); color: var(--text); }
.tiermenu__btn[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }
.tiermenu__btn:disabled { opacity: .5; cursor: default; }
.tiermenu__num { font-family: var(--font-mono); font-size: 15px; line-height: 1.2; }
.tiermenu__name { font-size: 11px; }

/* 段を編集（3列のボード） */
.tier-dialog { width: min(920px, calc(100vw - 32px)); }
.tier-dialog__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tier-dialog__head .dialog__title { margin: 0; }
.tier-dialog__hint { color: var(--text-muted); font-size: 12px; }
#tier-dialog-done { margin-left: auto; }
.tierboard { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 599px) { .tierboard { grid-template-columns: minmax(0, 1fr); } }
.tiercol {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 220px;
  padding: 10px;
  border: 1px dashed transparent;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
@media (max-width: 599px) { .tiercol { min-height: 0; } }
.tiercol--over { border-color: var(--accent); background: var(--accent-soft); }
.tiercol__head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; }
.tiernum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}
.tiernum--on { background: var(--accent); color: var(--accent-on); }
.tiercol__name { font-weight: 700; font-size: 13px; }
.tiercol__n { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.tiercol__empty { margin: 8px 4px; color: var(--text-faint); font-size: 12px; }
.tiercard {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  cursor: grab;
}
.tiercard--saving { opacity: .5; cursor: default; }
.tiercard__name { flex: 1; min-width: 0; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tiercard__ago { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.tiercard__move { width: 26px; height: 26px; flex: none; font-size: 16px; }

/* ---------- 電話の幅の左のメニュー（2026-10-12 メニューの案1。前は下のメニュー＝10-11 の案2） ----------
   電話の幅では上の帯とジャンルタブを隠し、見出しの1段目の ☰ から左のメニュー（.phonesheet）を引き出す。
   下のメニューはやめた（本人「読める幅が減って無駄」）ので、作業領域が画面の下まで使える。上の帯の高さの変数を0にして、
   それを足して位置を決めているもの（右の詳細のドロワーの top・更新の案内）を画面の上端からにする。
   --phonebar-h は下に浮くもの（知らせ・まとめて操作・更新）をホームバーの上に出すための高さとして残した。 */
:root { --phonebar-h: 0px; }
.phonesheet { display: none; }
@media (max-width: 599px) {
  body.has-phonebar:not(.is-shared):not(.is-login) {
    --topbar-h: 0px;
    --tabs-h: 0px;
    --phonebar-h: env(safe-area-inset-bottom, 0px);
    grid-template-rows: minmax(0, 1fr);
  }
  body.has-phonebar.is-offline:not(.is-shared):not(.is-login) { grid-template-rows: auto minmax(0, 1fr); }
  body.has-phonebar:not(.is-shared):not(.is-login) > .topbar,
  body.has-phonebar:not(.is-shared):not(.is-login) > .genretabs { display: none; }
  /* ＋は見出しの1段目にあるので、見出しの「＋ 行を追加」は出さない（開いた欄の中の「追加」はそのまま） */
  body.has-phonebar .addrow-open { display: none; }
  /* 画像から足すも見出しの1段目の画像のボタンにあるので、2段目には出さない（N02） */
  body.has-phonebar .addimg-open { display: none; }
  /* 下に浮くもの（知らせ・まとめて操作・更新）はホームバーの上に出す */
  body.has-phonebar .toasts { bottom: calc(var(--phonebar-h) + 12px); }
  body.has-phonebar:has(.numtray) .toasts { bottom: calc(var(--phonebar-h) + 12px + var(--numtray-h, 36px)); }
  body.has-phonebar .bulkbar { bottom: calc(var(--phonebar-h) + 10px); }
  body.has-phonebar .updatechip:not([hidden]) { bottom: calc(var(--phonebar-h) + 10px); }
  body.has-phonebar .detail { bottom: var(--phonebar-h); }
  body.has-phonebar .phonesheet[open] { display: flex; }
  /* 一覧の最後の行がホームバーに潜らないように */
  body.has-phonebar .mobilelist { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  /* 下に「要確認」の帯（N08）がある時は、ホームバーの余白は帯の方で取る */
  body.has-phonebar .mobilelist:has(+ .numtray) { padding-bottom: 24px; }
  /* リストの見出しの1段目は ☰・名前・件数・探す・＋・… だけにする。リストの評価・ジャンルの札・畳むは「…」のメニューへ、
     評価送りの入口は2段目へ短く（app.js の mainhead__rate--phone） */
  body.has-phonebar .mainhead > .mainhead__row:first-child > .lrate--btn,
  body.has-phonebar .mainhead > .mainhead__row:first-child > .mainhead__genre,
  body.has-phonebar .mainhead > .mainhead__row:first-child > .mainhead__fold,
  body.has-phonebar .mainhead > .mainhead__row:first-child > .mainhead__rate { display: none; }
  body.has-phonebar .mainhead__rate--phone { flex: none; padding: 0 10px; }
  /* ジャンルの見出しは ☰・探す・＋ と鮮度の札で埋まるので、リストの数は出さない（左のメニューに出る）。名前は最低限の幅を残す */
  body.has-phonebar .mainhead__count--genre { display: none; }
  body.has-phonebar .mainhead > .mainhead__row:first-child:has(> .mainhead__count--genre) > .mainhead__title { min-width: 4.5em; }
  /* 狭い電話（320px）でも右端の「…」が切れないように、共有中・アーカイブ済みの札はアイコンだけにし、
     アーカイブしたリストの「アクティブに戻す」がある時だけ1段目を折り返す（レビューで指摘） */
  body.has-phonebar .mainhead > .mainhead__row:first-child > .chip--shared,
  body.has-phonebar .mainhead > .mainhead__row:first-child > .chip--archive { font-size: 0; gap: 0; padding: 0 6px; flex: none; }
  body.has-phonebar .mainhead > .mainhead__row:first-child:has(> .chip--archive) { flex-wrap: wrap; }
  /* ジャンルの一覧と横断ビュー（未評価・鮮度切れ）は、鮮度の札・ジャンルの定義・件数（「1000 件 / 全 20000 件」）・列の選択が
     長くなるので、☰・題名・探す・＋・… を1行目に残し、ほかは入りきらなければ次の行へ（レビューで指摘）。
     後ろの「1段目は折り返さない」（.mainhead > .mainhead__row:first-child）より強くする */
  body.has-phonebar .mainhead > .mainhead__row.mainhead__row--navwrap:first-child { flex-wrap: wrap; }
  body.has-phonebar .mainhead__row--navwrap > .phonenav__search,
  body.has-phonebar .mainhead__row--navwrap > .phonenav__plus,
  body.has-phonebar .mainhead__row--navwrap > .rowmenu-btn { order: 1; }
  body.has-phonebar .mainhead__row--navwrap > :not(.phonenav__menu):not(.mainhead__title):not(.mainhead__spacer):not(.phonenav__search):not(.phonenav__plus):not(.rowmenu-btn) { order: 2; }
  body.has-phonebar .mainhead__row--navwrap > .chip { max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* ジャンルの名前の頭のアイコンが、1行にした題名の上の段へ回らないように */
  body.has-phonebar .mainhead__title > .icon { display: inline-block; vertical-align: -2px; margin-right: 4px; width: 15px; height: 15px; }
  /* 評価送りの入口がある時も、絞り込みと同じ1行に収める（絞り込みの欄を縮める） */
  body.has-phonebar .mainhead__row:has(> .mainhead__rate--phone) .filterinput { flex: 1 1 56px; }
}
.phonenav__menu { position: relative; width: 40px; height: 40px; flex: none; margin-left: -6px; }
.phonenav__menu .icon { width: 20px; height: 20px; stroke-width: 1.4; }
.phonenav__count {
  position: absolute; top: 1px; right: -2px; min-width: 16px; height: 16px; box-sizing: border-box; padding: 0 4px;
  border-radius: 999px; background: var(--amber-bg); color: var(--amber-fg); border: 1px solid var(--amber-border);
  font-size: 9.5px; line-height: 14px; font-weight: 600; text-align: center; white-space: nowrap; pointer-events: none;
}
.phonenav__count[hidden] { display: none; }
.phonenav__search { width: 40px; height: 40px; flex: none; }
.phonenav__search .icon { width: 19px; height: 19px; stroke-width: 1.4; }
.phonenav__plus { width: 40px; height: 34px; flex: none; border-radius: 10px; background: var(--accent); color: var(--accent-on); }
.phonenav__plus:hover, .phonenav__plus:active { background: var(--accent-hover); color: var(--accent-on); }
.phonenav__plus .icon { width: 18px; height: 18px; stroke-width: 1.8; }

/* 左から出るメニュー。dialog の外（暗い所）を押すと閉じる（app.js） */
.phonesheet {
  position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0;
  border: 0; background: transparent; flex-direction: row; justify-content: flex-start;
}
.phonesheet::backdrop { background: var(--overlay); }
.phonesheet__panel {
  width: min(320px, 86vw); height: 100%; display: flex; flex-direction: column; min-height: 0; box-sizing: border-box;
  background: var(--surface); color: var(--text); border-radius: 0 16px 16px 0; box-shadow: var(--shadow-pop);
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
@media (prefers-reduced-motion: no-preference) {
  .phonesheet[open] .phonesheet__panel { animation: phonesheet-in .18s ease-out; }
}
@keyframes phonesheet-in { from { transform: translateX(-100%); } to { transform: none; } }
.phonesheet__head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 4px 16px; flex: none; }
.phonesheet__title { flex: 1; margin: 0; font-family: var(--font-head); font-size: 17px; font-weight: 700; letter-spacing: .06em; }
.phonesheet__head .iconbtn { width: 40px; height: 40px; }
.phonesheet__search {
  margin: 4px 14px 0; height: 42px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border: 0; border-radius: 10px; background: var(--surface-3); color: var(--text-muted); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left;
}
.phonesheet__search .icon { width: 17px; height: 17px; }
.phonesheet__quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; padding: 10px 14px 0; flex: none; }
.phonesheet__qbtn {
  min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-muted);
  font: inherit; font-size: 11px; cursor: pointer;
}
.phonesheet__qbtn[aria-current="page"] { border-color: var(--accent); color: var(--accent); }
.phonesheet__qn { font-size: 15px; color: var(--text); display: inline-flex; min-height: 20px; align-items: center; }
.phonesheet__qn--word { font-size: 14px; font-weight: 600; }
.phonesheet__tierrow { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; flex: none; border-bottom: 1px solid var(--border); }
.phonesheet__tierlabel, .phonesheet__tiername { font-size: 11px; color: var(--text-muted); }
.phonesheet__tiers { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.phonesheet__tier {
  width: 40px; height: 32px; border: 0; background: var(--surface); color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer;
}
.phonesheet__tier + .phonesheet__tier { border-left: 1px solid var(--border); }
.phonesheet__tier[aria-pressed="true"] { background: var(--accent); color: var(--accent-on); font-weight: 600; }
.phonesheet__list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0 8px; }
.phonesheet__gn {
  width: 100%; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 14px; box-sizing: border-box;
  border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.phonesheet__gn .icon { width: 15px; height: 15px; flex: none; color: var(--text-muted); }
.phonesheet__gn .icon:first-child { width: 13px; height: 13px; transition: transform .12s; }
.phonesheet__gn[aria-expanded="true"] .icon:first-child { transform: rotate(90deg); }
.phonesheet__row {
  width: 100%; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 14px 0 37px; box-sizing: border-box;
  border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.phonesheet__row[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.phonesheet__more {
  width: 100%; min-height: 40px; padding: 0 14px 0 37px; box-sizing: border-box; border: 0; background: transparent;
  color: var(--text-muted); font: inherit; font-size: 12px; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.phonesheet__pin { color: var(--text-muted); display: inline-flex; }
.phonesheet__pin .icon { width: 13px; height: 13px; }
.phonesheet__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phonesheet__unrated {
  flex: none; font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px;
  background: var(--amber-bg); color: var(--amber-fg);
}
.phonesheet__n { flex: none; min-width: 26px; text-align: right; font-size: 12px; font-weight: 400; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.phonesheet__empty { margin: 0; padding: 20px 16px; color: var(--text-muted); }
.phonesheet__empty--sub { padding: 8px 14px 8px 37px; font-size: 12px; }
.phonesheet__foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid var(--border); flex: none; }
.phonesheet__foot .btn .icon { width: 14px; height: 14px; }

/* 電話のタイル（案5）: 2列・どの札も同じ大きさの画像の枠・評価の印は画像の左上・資料の種類の色の帯 */
@media (max-width: 599px) {
  .mobilelist .stiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 10px; }
  .mobilelist .stile { position: relative; padding: 0 0 10px; gap: 4px; overflow: hidden; border-radius: 12px; min-height: 0; }
  .mobilelist .stile--ft { border-top: 3px solid var(--ftone); }
  .mobilelist .stile__img { width: 100%; margin: 0 0 4px; aspect-ratio: 4 / 3; border-radius: 0; }
  /* 評価の印は画像の枠の左上に重ねる。画像を「列を選ぶ」で外した札は枠が無いので、今までどおり名前の上に置く（レビューで指摘） */
  .mobilelist .stile:has(> .stile__img) .stile__top { position: absolute; top: 6px; left: 6px; min-height: 0; z-index: 1; }
  .mobilelist .stile:not(:has(> .stile__img)) { padding-top: 8px; }
  .mobilelist .stile:not(:has(> .stile__img)) .stile__top { padding: 0 10px; }
  .mobilelist .stile__top:empty { display: none; }
  .mobilelist .stile__name, .mobilelist .stile__price, .mobilelist .stile__sub { padding: 0 10px; }
  .mobilelist .stile__name .sharedname, .mobilelist .stile__name .ncell { font-size: 12.5px; line-height: 1.45; }
  .mobilelist .stile__sub { color: var(--text-muted); }
  /* 見せ方（画像で並べると同じ切替）。「画像全体」は札の幅はそのまま、画像の高さを各画像の縦横比（--ar。読めるまでは 4:5）に
     合わせて切り抜かずに出す。画像の無い札の枠（.stile__ph）は今までの 4:3 のまま。札の高さがそろわないので上にそろえる */
  .mobilelist .stiles__head { display: flex; align-items: center; gap: 8px; padding-top: 8px; font-size: 12px; }
  .mobilelist .stiles--whole { align-items: start; }
  .mobilelist .stiles--whole img.stile__img { aspect-ratio: var(--ar, 4 / 5); object-fit: contain; }
}
.stile__ph {
  display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--ftone, var(--text-muted));
}
.stile__ph .icon { width: 40px; height: 40px; stroke-width: 1; }
.stile__fav { width: 32px; height: 32px; border-radius: 6px; }

/* 電話の幅（下のメニューあり）のリストの見出しを詰める。案2の「上はリスト名だけ」に寄せる。
   1段目は1行のまま（名前は … で切る）、ジャンルの札は「リストを選ぶ」に出るので隠す。
   評価の切替と絞り込みは同じ段に並べる（前は絞り込みだけで1段使っていた） */
@media (max-width: 599px) {
  body.has-phonebar .mainhead { padding: 6px 12px 6px; gap: 6px; }
  body.has-phonebar .mainhead > .mainhead__row:first-child { flex-wrap: nowrap; gap: 6px; }
  body.has-phonebar .mainhead__title { min-width: 0; flex: 0 1 auto; font-size: 15px; }
  body.has-phonebar .mainhead__title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* ジャンルの札はアイコンだけに（名前はシートに出る）。押すと別のジャンルへ移せるのは同じ（隠すと電話から移せなくなる。レビューで指摘） */
  body.has-phonebar .mainhead__genre { flex: none; font-size: 0; gap: 0; height: 28px; width: 28px; padding: 0; justify-content: center; }
  body.has-phonebar .mainhead__genre .icon { width: 14px; height: 14px; }
  body.has-phonebar .mainhead__rate { flex: none; white-space: nowrap; }
  body.has-phonebar .mainhead__count { flex: none; }
  body.has-phonebar .mainhead > .mainhead__row:first-child > .mainhead__spacer { flex: 1 1 0; min-width: 0; }
  body.has-phonebar .mainhead .filterinput { flex: 1 1 96px; width: auto; min-width: 0; height: 30px; }
  body.has-phonebar .mainhead .sharedmodes--owner { flex: 1 0 100%; }
  /* タイルの名前は文字色で。下線の飾り（リンクの印）は札の中では重いので出さない。押すとサイトが開くのは同じ */
  .mobilelist .stile .ncell__name-link { color: var(--text); min-height: 0; padding: 0; }
  .mobilelist .stile .ncell__link-text { padding-bottom: 0; }
  .mobilelist .stile .ncell__link-text::before { display: none; }
  .mobilelist .stile .ncell__name { font-weight: 500; }
}

/* ---------------------------------------------------------------- 社員どうしの共有（app.js の「社員どうしの共有」） */
/* 顔。画像が無ければ名前の1文字目。色は人ごとに決まる（白い字が読める濃さだけを使う） */
.face {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 50%; color: #fff; font-weight: 700; overflow: hidden;
  box-shadow: 0 0 0 1.5px var(--surface);
}
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face--s { width: 18px; height: 18px; font-size: 10px; }
.face--m { width: 30px; height: 30px; font-size: 12px; }
.faces { display: inline-flex; align-items: center; flex: none; }
.faces .face + .face { margin-left: -5px; }
.faces__more { margin-left: 3px; font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.listrow .faces { margin-left: 4px; }
.listrow .face--s { width: 16px; height: 16px; font-size: 9px; }

.chip--team { height: 26px; padding: 0 10px 0 4px; border-radius: 13px; background: var(--surface); border-color: var(--border-strong); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.chip--team:hover { background: var(--row-hover); }
.chip--team:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn--team { display: inline-flex; align-items: center; gap: 5px; }
.btn--team .icon { width: 13px; height: 13px; }

.teamstrip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 6px 0 2px; padding: 6px 12px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.teamstrip--view { background: var(--amber-bg); color: var(--amber-fg); }
.teamstrip__note { color: var(--text-muted); }
.teamstrip .mainhead__spacer { flex: 1; }

.tab--team .icon { width: 14px; height: 14px; }
.tab__n--team { background: var(--accent); color: var(--accent-on); border-radius: 9px; padding: 0 6px; }
.sidebar__group { display: flex; align-items: center; gap: 8px; padding: 12px 14px 4px; font-size: 12px; font-weight: 700; color: var(--text-muted); }

.popnote { margin: 4px 10px 6px; font-size: 11px; color: var(--text-muted); max-width: 240px; }

/* 共有の窓 */
.teamshare { width: min(600px, calc(100vw - 32px)); }
.teamshare #team-share-body { display: flex; flex-direction: column; gap: 14px; }
.teamshare__label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.teamshare__block .note { margin-top: 6px; }
.seg { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.seg__btn { flex: 1; min-height: 36px; padding: 6px 12px; border: 0; background: var(--surface); color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg__btn + .seg__btn { border-left: 1px solid var(--border-strong); }
.seg__btn[aria-checked="true"] { background: var(--accent); color: var(--accent-on); }
.seg__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.teamshare__invite { display: flex; flex-wrap: wrap; gap: 8px; }
.teamshare .input, .teampanel .input {
  min-height: 36px; padding: 6px 10px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-sizing: border-box;
}
.teamshare .input:focus, .teampanel .input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.teamshare__email { flex: 1 1 240px; min-width: 0; }
.teamshare__status { margin: 0; font-size: 13px; color: var(--accent); }
.teamshare__status--error { color: var(--danger); }
.teamshare__people { display: flex; flex-direction: column; }
.teamperson { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.teamperson:last-child { border-bottom: 0; }
.teamperson__who { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.teamperson__name { font-size: 14px; }
.teamperson__mail { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.teamperson__role { font-size: 13px; color: var(--text-muted); }
.teamperson__select { min-height: 32px !important; font-size: 13px !important; }
.teamshare__link { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; background: var(--row-resolved); border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; color: var(--text-muted); }
.teamshare__link span { flex: 1 1 220px; }

/* 共有の管理（設定の「共有」） */
.teampanel { display: flex; flex-direction: column; gap: 12px; }
.teampanel__invite { display: flex; gap: 8px; flex-wrap: wrap; }
.teampanel__invite .input { flex: 1 1 240px; min-width: 0; }
.teampanel__scroll { overflow-x: auto; }
.teampanel__table { width: 100%; border-collapse: collapse; min-width: 560px; }
.teampanel__table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text-muted); padding: 8px; border-bottom: 1px solid var(--border-strong); background: var(--row-resolved); }
.teampanel__table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13px; }
.teampanel__who { display: flex; align-items: center; gap: 8px; }
.teampanel__mail { font-size: 11px; color: var(--text-muted); overflow-wrap: anywhere; }
.teampanel__none { color: var(--text-faint); font-size: 12px; }
.teamchip { display: inline-block; margin: 0 4px 4px 0; padding: 2px 8px; font: inherit; font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; }
button.teamchip:hover { border-color: var(--border-strong); }
.teamchip--edit { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.teamchip--all { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber-fg); cursor: default; }

/* 変えた人（表の列・右の詳細） */
.bycell { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.bycell__text { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teamlog__line { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 4px 0; }
.teamlog__k { width: 7em; flex: none; font-size: 12px; color: var(--text-muted); }
.teamlog__events { margin: 6px 0; }
.teamlog__event { display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.55; }
.teamlog__event > span:last-child { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.teamlog__when { font-size: 11px; color: var(--text-muted); }

/* 数の条件で絞る（N08）の電話の幅 */
@media (max-width: 599px) {
  .numtray__body { max-height: 55vh; }
  .numtray { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .numtray__head { padding: 0 12px; }
  .numtray__row { padding: 6px 12px; flex-wrap: wrap; }
  .numtray__whys { justify-content: flex-start; flex-basis: 100%; }
  .mainhead__count .c-full { display: none; }
  .mainhead__count .c-short { display: inline; }
  .popover--numrange { width: calc(100vw - 24px); }
}

/* ---------------------------------------------------------------- 画像から足す・iPhone の共有（N01・N02。2026-10-13） */
/* 受信箱の行の移動先の候補の札（「→ ○○」）。押すとその行を移す（⌘Z で戻せる） */
.capchip { max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-size: 12px; flex: none; }
.capchip:hover { background: var(--accent-soft); border-color: var(--accent-hover); color: var(--accent-hover); }
.mobilelist .capchip { font-size: 11px; max-width: 11em; }
/* 画像で並べるの札では、札全体に重ねたリンク（.gcard__hit）より上に出す */
.gcard .capchip { position: relative; z-index: 2; align-self: flex-start; }
.detail__capture { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.detail__capturelabel { font-size: 11px; color: var(--text-muted); }
/* 受信箱の鍵の期限が近い時の帯 */
.capture-expiry { margin: 0; padding: 6px 10px; font-size: 12px; line-height: 1.6; color: var(--amber-fg); background: var(--amber-bg); border: 1px solid var(--amber-border); border-radius: var(--radius); }
/* 見出しの「画像から足す」と進み具合 */
.addimg-open .icon, .addrow__img .icon { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.caprun__count { font-size: 12px; color: var(--text-muted); }
/* ファイルを表に重ねた時の案内（点線の枠。画面全体に重ねる。押せないので、下の表のドロップを邪魔しない） */
.capdrop { position: fixed; inset: 8px; z-index: 30; display: flex; align-items: center; justify-content: center; pointer-events: none; border: 2px dashed var(--accent); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--accent-soft) 82%, transparent); }
.capdrop__box { padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--accent); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-pop); }
/* 右の詳細の取り込んだ画像（押すと元の大きさ） */
.detail__imgbtn { display: block; width: 100%; padding: 0; margin: 0; border: 0; background: none; cursor: zoom-in; }
.detail__imgbtn .detail__img { display: block; }
.detail__upload { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: var(--surface); }
.detail__uploadnote { font-size: 11px; color: var(--text-muted); }
/* 元の大きさで見る画面。画像を押すと「画面に合わせる」と「原寸」が切り替わる */
.origview { width: min(96vw, 1400px); height: min(94vh, 1000px); max-width: none; max-height: none; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); }
.origview[open] { display: flex; flex-direction: column; }
.origview::backdrop { background: var(--overlay); }
.origview__bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border); }
.origview__title { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.origview__hint { flex: none; font-size: 11px; color: var(--text-muted); }
.origview__stage { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; background: var(--surface-3); }
.origview__img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.origview--actual .origview__stage { display: block; }
.origview--actual .origview__img { max-width: none; max-height: none; cursor: zoom-out; }
.origview__err { margin: 0; padding: 24px; font-size: 13px; color: var(--text-muted); }
@media (max-width: 599px) {
  .origview { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .origview__hint { display: none; }
}
/* 設定→APIキー: 取り込んだ画像も読む・足すだけの鍵 */
.api-key-check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.api-key-soon { color: var(--amber-fg) !important; font-weight: 600; }
.api-key-guide summary, .capture-howto summary { cursor: pointer; font-size: 12px; color: var(--accent); margin-top: 6px; }
.capture-guide, .capture-notes { margin: 10px 0 0; padding-left: 20px; font-size: 12px; line-height: 1.7; color: var(--text); }
.capture-notes { color: var(--text-muted); font-size: 11px; }
.capture-howto { margin-top: 10px; font-size: 12px; }
.capture-build { margin-top: 8px; }
.capture-build ol { margin: 4px 0 0; padding-left: 20px; line-height: 1.7; overflow-wrap: anywhere; }
@media (max-width: 599px) {
  .api-key-issued-actions--big { display: grid; grid-template-columns: 1fr; }
  .api-key-issued-actions--big .btn { min-height: 44px; justify-content: center; font-size: 14px; }
}

/* 設定のアカウント: 表示名（社員どうしの共有） */
.account__nameform { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.account__namelabel { font-size: 13px; color: var(--text-muted); width: 7em; }
.account__nameinput { flex: 1 1 200px; min-width: 0; min-height: 34px; padding: 6px 10px; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.account__nameinput:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.account__namestatus { flex-basis: 100%; font-size: 12px; color: var(--text-muted); }

/* 使い方ガイド・AI とつなぐ・AI に頼む（2026-10-15。app.js の openGuide・aiConnectBlock・openAskAi）。色はトークンだけ */
.guide-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 20px 22px; }
.askai-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow-y: auto; }
.guide__head { display: flex; align-items: center; gap: 8px; }
.guide__head .dialog__title { margin: 0 auto 0 0; }
.guide__close { flex: none; }
.guide__nav { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 14px 0 18px; padding: 0 0 12px; border-bottom: 1px solid var(--border); }
.guide__navbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 4px; border: 1px solid transparent; border-radius: 999px;
  background: none; color: var(--text-muted); font: inherit; font-size: 12px; cursor: pointer;
}
.guide__navbtn:hover { background: var(--surface-2); color: var(--text); }
.guide__navbtn[aria-current="step"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.guide__navbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.guide__navnum {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-muted); font-size: 11px;
}
.guide__navbtn[aria-current="step"] .guide__navnum { background: var(--accent); color: var(--accent-on); }
.guide__body { min-height: 300px; outline: none; }
.guide__h { font-family: var(--font-head); font-size: 17px; line-height: 1.5; margin: 0 0 10px; }
.guide__lead { font-size: 13px; line-height: 1.8; color: var(--text); margin: 0 0 14px; }
.guide__note { font-size: 12px; line-height: 1.7; color: var(--text-muted); margin: 14px 0 0; }
.guide__cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.guide__card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; background: var(--surface-2); min-width: 0; }
.guide__card strong { display: block; font-size: 14px; margin: 8px 0 6px; }
.guide__card p { margin: 0; font-size: 12px; line-height: 1.7; color: var(--text-muted); }
.guide__cardnum {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 999px;
  background: var(--accent); color: var(--accent-on); font-size: 12px;
}
.guide__points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.guide__points li { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 12px; font-size: 13px; line-height: 1.7; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.guide__points li:last-child { border-bottom: 0; }
.guide__points strong { font-weight: 600; }
.guide__points span { color: var(--text-muted); }
.guide__steps { margin: 0 0 14px; padding-left: 20px; font-size: 13px; line-height: 1.9; }
.guide__fine { margin: 14px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.7; color: var(--text-muted); }
.guide__skip { margin-top: 12px; }
.guide__actions { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 18px; }
.guide__link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.guide__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 画面の見方の小さな図（棚・引き出し・行・詳細） */
.guide__map {
  display: grid; grid-template-columns: 26% 1fr 24%; grid-template-rows: 34px 92px; gap: 4px; margin: 4px 0 16px;
  font-size: 11.5px; color: var(--text-muted);
}
.guide__map > div { display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px 8px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.guide__map-top { grid-column: 1 / -1; background: var(--accent-soft) !important; color: var(--accent); border-style: solid !important; border-color: transparent !important; font-weight: 600; }
.guide__map-main { background: var(--surface) !important; color: var(--text); font-weight: 600; }

/* AI とつなぐ */
.aiconnect { border: 1px solid var(--accent); border-radius: var(--radius-lg); padding: 14px; background: var(--surface); }
.aiconnect.is-connected { background: var(--accent-soft); }
.aiconnect__apps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.aiconnect__app {
  height: 30px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
  color: var(--text-muted); font: inherit; font-size: 12.5px; cursor: pointer;
}
.aiconnect__app[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-on); font-weight: 600; }
.aiconnect__app:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.aiconnect__row { display: flex; flex-wrap: wrap; gap: 8px; }
.aiconnect__copy { height: 36px; padding: 0 16px; font-size: 13px; }
.aiconnect__status { margin: 10px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--text); }
.aiconnect__status:empty { display: none; }
.aiconnect.is-connected .aiconnect__status { color: var(--accent); font-weight: 600; }
.aiconnect__prompt {
  display: block; box-sizing: border-box; width: 100%; margin-top: 10px; resize: vertical; padding: 10px; font: 11.5px/1.6 var(--font-mono);
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.aiconnect__prompt[hidden] { display: none; }
.aiconnect__current { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-size: 12px; color: var(--text-muted); }
.aiconnect__current:empty { display: none; }
.aiconnect__label { font-weight: 600; color: var(--text-muted); }
.aiconnect__chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aiconnect__chip .icon { width: 12px; height: 12px; flex: none; }

/* AI に頼むプロンプトの札 */
.aiprompts { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.aiprompt { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 12px; background: var(--surface); min-width: 0; }
.aiprompt__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.aiprompt__head strong { margin-right: auto; }
.aiprompt__copy { flex: none; }
.aiprompt__text { margin: 0; font: 12px/1.7 var(--font-body); color: var(--text-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.aiprompt__text:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.askai__what { display: block; box-sizing: border-box; width: 100%; min-height: 38px; margin: 0 0 12px; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.askai__what:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.mainhead__ai { display: inline-flex; align-items: center; gap: 4px; }
.mainhead__ai .icon { width: 13px; height: 13px; }
.api-key-heading--first { margin-top: 0; }
.api-key-manual { margin: 18px 0 0; font-size: 12px; }
.api-key-manual summary { cursor: pointer; color: var(--text-muted); }
.api-key-manual[open] summary { margin-bottom: 8px; }

@media (max-width: 599px) {
  .guide-dialog { padding: 16px; }
  .guide__nav { flex-wrap: nowrap; overflow-x: auto; margin: 10px -4px 14px; }
  .guide__navbtn { white-space: nowrap; }
  .guide__cards { grid-template-columns: 1fr; }
  .guide__points li { grid-template-columns: 1fr; gap: 2px; }
  .guide__map { grid-template-rows: 30px 72px; font-size: 10.5px; }
  /* 電話の見出しの1段目は詰めている。「AIに頼む」は「…」のメニューから、使い方は ☰ のメニューの下から */
  .mainhead__ai { display: none; }
  #guide-btn { display: none; }
}
