/*
 * 共通の見た目（19 の 2 章）。ChatGPT・Claude に近い配置と色（乗り換えの手間を小さくする）。
 * 色・文字・間隔は変数。配色は <html data-theme="light|dark">（theme-boot.js・core/theme.js が付ける。
 * 既定は端末の設定に合わせる）。スクリプトが動かないときは prefers-color-scheme に従う。
 * インラインの style を使わない（CSP style-src 'self'）。色の対比は本文・補助の文とも 4.5:1 以上（15 の 7 章）。
 * Shared styles: a ChatGPT/Claude-like layout and palette to keep the switching cost low. Tokens are
 * CSS variables; the theme comes from <html data-theme> (set before first paint), falling back to
 * prefers-color-scheme without script. No inline styles (CSP). Text contrast >= 4.5:1 in both themes.
 */
:root {
  --bg: #ffffff;
  --sidebar: #f9f9f9;
  --panel: #ffffff;
  --raised: #ffffff;
  --ink: #0d0d0d;
  --muted: #5d5d5d;
  --line: #e3e3e3;
  --line-strong: #c9c9c9;
  --hover: #ececec;
  --active: #e3e3e3;
  --bubble: #f1f1f1;
  --accent: #0b5cad;
  --accent-ink: #ffffff;
  --btn: #0d0d0d;
  --btn-ink: #ffffff;
  --warn: #7a4f00;
  --warn-bg: #fff4dc;
  --block: #9b1c1c;
  --block-bg: #fde8e8;
  --info-bg: #eef4fb;
  --focus: #1a66d2;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .08);
  --radius: 10px;
  --radius-lg: 24px;
  --font: ui-sans-serif, system-ui, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  --side-w: 260px;
  --col: 48rem;
  --topbar-h: 3.25rem;
  color-scheme: light;
  font-size: 16px;
}
:root[data-font-size="s"] { font-size: 14.5px; }
:root[data-font-size="l"] { font-size: 18px; }

/* スクリプトの無いときだけ端末の設定に従う / no-script fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #212121; --sidebar: #171717; --panel: #212121; --raised: #2f2f2f; --ink: #ececec; --muted: #b4b4b4;
    --line: #3a3a3a; --line-strong: #565656; --hover: #2a2a2a; --active: #333333; --bubble: #303030;
    --accent: #7ab7ff; --accent-ink: #0b1220; --btn: #ececec; --btn-ink: #0d0d0d;
    --warn: #f0c060; --warn-bg: #3a2e14; --block: #f5a3a3; --block-bg: #3a1a1a; --info-bg: #1f2b3d; --focus: #8cc2ff;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #212121; --sidebar: #171717; --panel: #212121; --raised: #2f2f2f; --ink: #ececec; --muted: #b4b4b4;
  --line: #3a3a3a; --line-strong: #565656; --hover: #2a2a2a; --active: #333333; --bubble: #303030;
  --accent: #7ab7ff; --accent-ink: #0b1220; --btn: #ececec; --btn-ink: #0d0d0d;
  --warn: #f0c060; --warn-bg: #3a2e14; --block: #f5a3a3; --block-bg: #3a1a1a; --info-bg: #1f2b3d; --focus: #8cc2ff;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; max-width: 100%; overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 0.9375rem/1.65 var(--font); height: 100vh; height: 100dvh; height: var(--app-h, 100dvh); overflow: hidden; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }

a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.view-title:focus, main:focus { outline: none; }
.view-title:focus-visible { outline: 2px solid var(--focus); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: .5rem; top: -3rem; z-index: 50; }
.skip:focus { top: .5rem; }
.muted { color: var(--muted); }
.small-note { font-size: .85rem; }
.danger-text { color: var(--block); font-weight: 600; }
.warn-text { color: var(--warn); }
.spacer { flex: 1; }

.icon { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

button, select, input, textarea { font: inherit; color: var(--ink); }
button { cursor: pointer; border: 1px solid var(--line-strong); background: var(--raised); border-radius: 999px; padding: .4rem .95rem; display: inline-flex; align-items: center; gap: .4rem; line-height: 1.3; }
button:hover { background: var(--hover); }
button.primary { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
button.primary:hover { opacity: .88; }
button.danger { border-color: var(--block); color: var(--block); }
button.small { padding: .15rem .55rem; font-size: .85rem; }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
button:disabled, button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; border-radius: 8px; padding: .45rem; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.active { color: var(--accent); background: var(--info-bg); }
.icon-btn.small { padding: .3rem; }
.icon-btn.small .icon { width: 1rem; height: 1rem; }
.button-link { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .95rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); text-decoration: none; }
.button-link:hover { background: var(--hover); }
select, input[type="search"], input[type="text"], textarea { background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: .45rem .65rem; }
textarea { width: 100%; resize: vertical; }
select { padding-right: 1.5rem; }

/* --- 枠 / app frame --------------------------------------------------------------- */
/* 高さは動的な画面の高さ（dvh）。画面のキーボードが出たら app.js が --app-h を visualViewport に合わせる。
   Height follows the dynamic viewport (dvh); app.js narrows --app-h to the visual viewport when the on-screen keyboard opens. */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100%; width: 100%; max-width: 100vw; overflow: hidden; }
.app.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app.sidebar-collapsed .sidebar { visibility: hidden; }
.sidebar { background: var(--sidebar); overflow: hidden; min-width: 0; display: flex; }
.main-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.scrim { display: none; }

.topbar { display: flex; align-items: center; gap: .5rem; min-height: var(--topbar-h); padding: .35rem .75rem; padding-top: max(.35rem, env(safe-area-inset-top)); background: var(--bg); }
.topbar-start, .topbar-end { display: flex; align-items: center; gap: .15rem; }
.topbar-tools { display: flex; align-items: center; gap: .5rem; min-width: 0; }
/* メニューを切らない（overflow は付けない）。ボタンの文字は model-picker の中で省略する。
   Never clip popup menus here; the picker label truncates inside .model-picker instead. */
.topbar-tools .menu-anchor, .chat-toolbar .menu-anchor { min-width: 0; max-width: 100%; }
.top-status { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; font-size: .8rem; color: var(--muted); }
.top-status .ext { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: inherit; font-size: inherit; }
.top-status .ext:hover { background: var(--hover); }
.top-status .ext .icon { width: 1rem; height: 1rem; }
.top-status .ext-patent { color: var(--block); font-weight: 600; }
.top-status .ext-web { color: var(--warn); font-weight: 600; }
.top-status .env { padding: .05rem .55rem; border-radius: 999px; background: var(--warn-bg); color: var(--warn); }
.offline { padding: .4rem 1rem; background: var(--warn-bg); color: var(--warn); }
/* サービスの状態の帯（緊急の停止・組織の日の上限。docs/design/22）/ service-state banner */
.service-banner { padding: .5rem 1rem; background: var(--block-bg); color: var(--block); font-weight: 600; }
.service-banner.info { background: var(--info-bg); color: var(--ink); font-weight: 400; }
main { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
main > section { flex: 1; min-height: 0; overflow-y: auto; }
.boot-note { padding: 1rem; color: var(--muted); }

/* --- 横の帯 / sidebar ------------------------------------------------------------- */
.side-inner { display: flex; flex-direction: column; width: var(--side-w); height: 100%; padding: .5rem .5rem 0; padding-top: max(.5rem, env(safe-area-inset-top)); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: .1rem .25rem .4rem .5rem; }
.side-brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-weight: 650; }
.logo { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--btn); color: var(--btn-ink); font-size: .85rem; font-weight: 700; }
.side-item { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .45rem .6rem; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-decoration: none; font-size: .9rem; text-align: left; line-height: 1.35; }
.side-item:hover { background: var(--hover); }
.side-item[aria-current="page"] { background: var(--active); font-weight: 600; }
.side-item .icon { color: var(--muted); }
.side-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-new { margin-bottom: .2rem; }
.side-search { display: flex; align-items: center; gap: .4rem; margin: 0 0 .5rem; padding: 0 .6rem; border-radius: 8px; color: var(--muted); }
.side-search:focus-within { background: var(--hover); }
.side-search-input { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; padding: .45rem 0 !important; font-size: .9rem; }
.side-search-input:focus-visible { outline: none; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 1rem; margin: 0 -.25rem; padding-inline: .25rem; }
.side-heading { margin: 1rem .6rem .25rem; font-size: .75rem; font-weight: 600; color: var(--muted); }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-note { padding: .3rem .6rem; font-size: .85rem; color: var(--muted); list-style: none; margin: 0; }
.chat-item { position: relative; display: flex; align-items: center; }
.chat-item .chat-link { padding-right: 3.8rem; }
.side-mark { color: var(--warn); display: inline-flex; }
.side-mark .icon { width: .9rem; height: .9rem; color: var(--warn); }
.side-actions { position: absolute; right: .15rem; display: flex; gap: .05rem; opacity: 0; }
.side-actions .icon-btn { padding: .3rem; }
.side-error { font-size: .82rem; padding: .3rem .6rem; margin: 0; }
.side-archived { margin-top: .5rem; color: var(--muted); }
.delete-dialog .delete-list { margin: .25rem 0 .75rem; padding-left: 1.25rem; }
.delete-dialog .delete-file-names { margin: .25rem 0 .5rem; padding-left: 1.25rem; font-size: .9rem; overflow-wrap: anywhere; }
.delete-dialog .delete-target { font-weight: 600; overflow-wrap: anywhere; }
.delete-dialog .small { font-size: .82rem; margin: .25rem 0; }
.check-row { display: flex; align-items: flex-start; gap: .5rem; margin: .5rem 0; }
.check-row input { margin-top: .2rem; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.chat-item:hover .side-actions, .chat-item:focus-within .side-actions { opacity: 1; }
.chat-item .confirm { width: 100%; font-size: .85rem; }
.side-foot { border-top: 1px solid var(--line); padding: .4rem 0; padding-bottom: max(.4rem, env(safe-area-inset-bottom)); }
.side-user { display: flex; align-items: center; gap: .6rem; width: 100%; border: 0; border-radius: 8px; background: transparent; padding: .45rem .6rem; text-align: left; }
.side-user:hover, .side-user[aria-expanded="true"] { background: var(--hover); }
.avatar { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; flex: none; font-size: .85rem; font-weight: 700; }
.user-avatar { background: #6b3fa0; color: #ffffff; }

/* --- メニュー / menus ---------------------------------------------------------------- */
.menu-anchor { position: relative; display: inline-flex; }
.side-foot .menu-anchor { display: block; }
.menu { position: absolute; z-index: 40; min-width: min(15rem, calc(100vw - 2rem)); max-width: min(22rem, 90vw); max-height: 70vh; overflow-y: auto; padding: .35rem; background: var(--raised); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.menu-down { top: calc(100% + .35rem); }
.menu-up { bottom: calc(100% + .35rem); }
.menu-start { left: 0; }
.menu-end { right: 0; }
.user-menu { left: 0; right: 0; min-width: 0; max-width: none; }
.tools-menu { min-width: min(19rem, calc(100vw - 2rem)); }
.menu-item { display: flex; align-items: flex-start; gap: .65rem; width: 100%; border: 0; border-radius: 8px; background: transparent; padding: .5rem .6rem; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.menu-item.danger { color: var(--block); }
.menu-item .icon { margin-top: .1rem; color: var(--muted); }
.menu-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.menu-main { font-size: .9rem; }
.menu-hint { font-size: .78rem; color: var(--muted); line-height: 1.4; }
.menu-check { width: 1.1rem; display: inline-flex; color: var(--ink); }
.menu-check .icon { color: var(--ink); }
.icon-space { width: 1.15rem; flex: none; }
.menu-sep { height: 1px; margin: .3rem .2rem; background: var(--line); }
.menu-label { padding: .35rem .6rem .15rem; font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* --- 会話 / chat --------------------------------------------------------------------- */
.chat-toolbar { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.model-picker { border: 0; background: transparent; border-radius: 10px; padding: .4rem .6rem; font-size: 1rem; gap: .35rem; white-space: nowrap; max-width: 100%; min-width: 0; overflow: hidden; }
.model-level { overflow: hidden; text-overflow: ellipsis; }
.model-picker:hover, .model-picker[aria-expanded="true"] { background: var(--hover); }
.model-name { font-weight: 650; }
.model-sep, .model-level { color: var(--muted); }
.project-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; background: var(--hover); color: var(--ink); text-decoration: none; font-size: .85rem; max-width: 14rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.chat-view { display: flex; flex-direction: row; overflow: hidden !important; }
.chat-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
/* 右の欄（この会話のファイルと推論の状況）/ side pane: files of this chat and generation status */
.session-pane { flex: none; width: 17.5rem; max-width: 40vw; min-height: 0; overflow-y: auto; overflow-x: hidden; border-left: 1px solid var(--line); background: var(--sidebar); padding: .75rem .85rem 1.25rem; }
.session-pane:focus { outline: none; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.pane-title { font-size: .95rem; margin: 0; }
.pane-section { margin-bottom: 1rem; }
.pane-heading { font-size: .78rem; font-weight: 600; color: var(--muted); margin: .25rem 0 .4rem; text-transform: none; }
.pane-status p { margin: .15rem 0; }
.pane-state { display: flex; align-items: center; gap: .45rem; font-weight: 600; font-size: .9rem; }
.pane-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--line-strong); flex: none; }
.state-queued .pane-dot, .state-thinking .pane-dot { background: var(--warn); animation: pulse 1.6s infinite ease-in-out; }
.state-generating .pane-dot { background: var(--accent); animation: pulse 1s infinite ease-in-out; }
.state-done .pane-dot { background: #2e7d32; }
.state-failed .pane-dot { background: var(--block); }
.ctx-bar { height: .5rem; border-radius: .25rem; background: var(--line-strong); overflow: hidden; margin: .3rem 0; }
.ctx-fill { height: 100%; background: var(--accent); transition: width .3s; }
.ctx-warn .ctx-fill { background: var(--warn); }
.ctx-danger .ctx-fill { background: var(--block); }
.ctx-note-warn { color: var(--warn); }
.ctx-note-danger { color: var(--block); font-weight: 600; }
.ctx-help { font-size: .75rem; }
.pane-meta { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pane-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.pane-file { display: flex; align-items: center; gap: .45rem; padding: .35rem .4rem; border-radius: var(--radius); background: var(--raised); border: 1px solid var(--line); min-width: 0; }
.pane-file > .icon { flex: none; width: 1rem; height: 1rem; }
.pane-file-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pane-file-name { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-file-meta { font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }
.pane-file.blocked .pane-file-meta, .pane-file.error .pane-file-meta { color: var(--block); }
.pane-empty { font-size: .85rem; color: var(--muted); }
.pane-error { font-size: .82rem; margin: 0 0 .4rem; }
.pane-toggle[aria-expanded="true"] { background: var(--active); }
/* 逐次の下書き / streaming preview */
.live-answer { max-width: var(--col); margin: 1.6rem auto 0; }
.plain-draft { white-space: pre-wrap; overflow-wrap: anywhere; }
.stream-caret { display: inline-block; width: .5rem; height: 1rem; margin-left: .15rem; vertical-align: text-bottom; background: var(--muted); animation: blink 1s infinite; }
@media (prefers-reduced-motion: reduce) { .stream-caret, .state-generating .pane-dot, .state-queued .pane-dot, .state-thinking .pane-dot { animation: none; } }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 1rem 1rem 1.5rem; scroll-behavior: auto; }
.thread { max-width: var(--col); margin: 0 auto; display: flex; flex-direction: column; gap: 1.6rem; }
.thread:empty { display: none; }
.msg { overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; max-width: 80%; }
.msg.user .bubble { background: var(--bubble); padding: .65rem 1.05rem; border-radius: 1.4rem; white-space: pre-wrap; }
.msg.assistant { display: flex; gap: .9rem; align-items: flex-start; }
.msg.assistant.waiting { max-width: var(--col); margin: 1.6rem auto 0; color: var(--muted); align-items: center; }
.ai-avatar { background: var(--raised); border: 1px solid var(--line); color: var(--ink); }
.ai-avatar .icon { width: 1rem; height: 1rem; }
.msg-body { flex: 1; min-width: 0; }
.msg-actions { display: flex; gap: .1rem; margin-top: .35rem; opacity: 0; transition: opacity .15s; }
.msg.assistant:hover .msg-actions, .msg.assistant:focus-within .msg-actions, .thread > .msg.assistant:last-of-type .msg-actions { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: 1; } }
.answer-details { margin-top: .2rem; font-size: .8rem; color: var(--muted); }
.answer-details summary { cursor: pointer; width: max-content; }
.answer-info { display: flex; flex-wrap: wrap; gap: .1rem 1rem; margin: .4rem 0 0; color: var(--muted); font-size: .8rem; }
.answer-info dt { font-weight: 600; }
.answer-info dt::after { content: ":"; }
.answer-info dd { margin: 0 0 0 -.7rem; }
.thinking-text { margin-left: .5rem; }
.dots { display: inline-flex; gap: .25rem; vertical-align: middle; }
.dots span { width: .45rem; height: .45rem; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.pulse { animation: pulse 1.6s infinite ease-in-out; }
@keyframes pulse { 50% { opacity: .55; } }

.notice { max-width: var(--col); margin: 0 auto; width: 100%; padding: .55rem .85rem; border-radius: var(--radius); font-size: .9rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.block { background: var(--block-bg); color: var(--block); }
.notice.info { background: var(--info-bg); color: var(--ink); }
.confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); }

/* 空の状態 / empty state */
.empty-state { max-width: var(--col); margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem 0 1rem; width: 100%; min-width: 0; }
.empty-logo { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; border: 1px solid var(--line); margin-bottom: 1rem; }
.empty-logo .icon { width: 1.4rem; height: 1.4rem; }
.empty-title { font-size: 1.65rem; font-weight: 600; margin: 0 0 .4rem; max-width: 100%; overflow-wrap: anywhere; }
.empty-sub { color: var(--muted); margin: 0 0 1.5rem; max-width: 36rem; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; width: 100%; max-width: 40rem; }
.suggestion { flex-direction: column; align-items: flex-start; gap: .1rem; border-radius: 16px; padding: .7rem .95rem; text-align: left; background: var(--bg); border-color: var(--line); min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.suggestion-title { font-weight: 600; font-size: .9rem; }
.suggestion-sub { color: var(--muted); font-size: .82rem; }
.home-section { width: 100%; max-width: 40rem; display: flex; flex-direction: column; gap: .45rem; text-align: left; }
.home-heading { font-size: .85rem; font-weight: 600; color: var(--muted); margin: .4rem 0 0; }
.company-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.company-card { display: flex; flex-direction: column; gap: .35rem; border: 1px solid var(--line); border-radius: 16px; padding: .7rem .95rem; background: var(--bg); min-width: 0; overflow-wrap: anywhere; }
.company-card.blocked { opacity: .7; }
.company-name { font-weight: 600; font-size: .92rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.company-tag { font-size: .72rem; font-weight: 500; padding: 0 .45rem; border-radius: 999px; background: var(--hover); color: var(--muted); }
.company-meta { color: var(--muted); font-size: .8rem; }
.company-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.company-blocked { color: var(--muted); font-size: .8rem; margin: 0; }
.ack-panel { width: 100%; max-width: 40rem; text-align: left; border: 1px solid var(--line); border-radius: 16px; padding: .9rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.ack-title { font-weight: 600; margin: 0; }
.ack-check { display: flex; gap: .5rem; align-items: center; }
.company-badge .chip-x { margin-left: .1rem; }

/* 入力欄 / composer */
.composer-dock { flex: none; padding: 0 1rem; padding-bottom: max(.5rem, env(safe-area-inset-bottom)); background: var(--bg); }
.composer-wrap { max-width: var(--col); margin: 0 auto; }
.composer { display: flex; flex-direction: column; gap: .25rem; background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: .65rem .65rem .5rem 1rem; box-shadow: var(--shadow); }
.composer:focus-within { border-color: var(--muted); }
.composer textarea { border: 0; background: transparent; resize: none; padding: .35rem 0; min-height: 1.6em; max-height: 20rem; field-sizing: content; line-height: 1.55; }
.composer textarea:focus-visible { outline: none; }
/* ファイルのドロップの受け口（components/drop.js）/ file drop zone */
.drop-hint { display: none; }
.drop-active { border: 1px dashed var(--accent); outline: 2px solid var(--focus); outline-offset: 2px; }
.drop-active > .drop-hint { display: block; color: var(--accent); font-size: .85rem; font-weight: 600; }
.composer-row { display: flex; align-items: center; gap: .15rem; margin-left: -.45rem; }
.web-toggle { display: inline-flex; align-items: center; gap: .3rem; margin-left: .2rem; padding: .3rem .65rem; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: .82rem; }
.web-toggle .icon { width: 1rem; height: 1rem; }
.web-toggle:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.web-toggle.active, .web-toggle[aria-pressed="true"] { color: var(--accent); background: var(--info-bg); border-color: var(--accent); }
.web-toggle:disabled { opacity: .55; cursor: not-allowed; }
.search-terms { margin: 0; padding-left: 1.1rem; }
.composer-row .counter { font-size: .78rem; color: var(--muted); margin-right: .4rem; }
.send-btn { width: 2.25rem; height: 2.25rem; padding: 0; justify-content: center; border-radius: 50%; background: var(--btn); color: var(--btn-ink); border: 0; }
.send-btn:hover { background: var(--btn); opacity: .85; }
.send-btn .icon { width: 1.15rem; height: 1.15rem; stroke-width: 2.2; }
.send-btn.stop .icon { fill: currentColor; }
.send-btn:disabled { opacity: .3; }
.composer-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .25rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; padding: .25rem .35rem .25rem .6rem; border: 1px solid var(--line); border-radius: 12px; font-size: .82rem; background: var(--bg); }
.chip .icon { width: .95rem; height: .95rem; color: var(--muted); }
.chip-name { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-status { color: var(--muted); }
.chip-action { padding: .1rem .5rem; font-size: .8rem; }
.chip.ready { border-color: var(--accent); }
.chip.blocked, .chip.error { border-color: var(--block); color: var(--block); }
.chip.tool { border-color: var(--warn); color: var(--warn); border-radius: 999px; }
.chip.tool.danger { border-color: var(--block); color: var(--block); }
.chip-x { border: 0; background: transparent; padding: .1rem; border-radius: 6px; color: inherit; }
.chip-x .icon { width: .85rem; height: .85rem; }
.composer-note { margin: .35rem .5rem 0; font-size: .78rem; text-align: center; color: var(--muted); }
.composer-note.danger-text { color: var(--block); }
.composer-note.warn-text { color: var(--warn); }
.composer-note.disclaimer { margin-bottom: .2rem; }

/* 回答の本文（markdown.js）/ answer body rendered by markdown.js */
.md { line-height: 1.75; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { line-height: 1.35; margin: 1.2em 0 .5em; }
.md h1 { font-size: 1.4rem; } .md h2 { font-size: 1.2rem; } .md h3 { font-size: 1.05rem; }
.md pre { background: var(--bubble); padding: .8rem 1rem; border-radius: var(--radius); overflow-x: auto; }
.md code { font-family: var(--mono); font-size: .88em; }
.md :not(pre) > code { background: var(--bubble); padding: .1em .35em; border-radius: 5px; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--line-strong); padding: .35rem .65rem; }
.md blockquote { margin: .5rem 0; padding-left: .8rem; border-left: 3px solid var(--line-strong); color: var(--muted); }
.md-align-left { text-align: left; }
.md-align-center { text-align: center; }
.md-align-right { text-align: right; }

/* --- ほかの画面（ツール・管理・プロジェクト）/ other pages ------------------------------- */
.view-body { padding: 1rem 1.5rem 3rem; }
.view-body > *, .page { max-width: 60rem; margin-left: auto; margin-right: auto; }
.view-header { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.view-title { font-size: 1.5rem; font-weight: 650; margin: .25rem 0 .75rem; display: inline-flex; align-items: center; gap: .5rem; }
.view-title .icon { width: 1.4rem; height: 1.4rem; }
.badge { display: inline-block; padding: .05rem .6rem; border-radius: 999px; border: 1px solid var(--warn); color: var(--warn); background: var(--warn-bg); font-size: .8rem; }
.lead { max-width: 46rem; }
.placeholder .planned { max-width: 46rem; padding-left: 1.4rem; }
.placeholder .planned li { margin-bottom: .6rem; }
.placeholder .planned strong { display: block; }
.subtabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: .5rem 0 1rem; border-bottom: 1px solid var(--line); }
.subtabs a { padding: .35rem .7rem; text-decoration: none; color: var(--ink); border-radius: 8px 8px 0 0; }
.subtabs a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--ink); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem 1rem; margin-bottom: .5rem; }
.toolbar label { display: flex; flex-direction: column; font-size: .85rem; }
.table-scroll { overflow-x: auto; }
/* データの扱い・データ保護の証跡 / data handling and evidence */
.table-wrap { overflow-x: auto; max-width: 100%; }
.dh-dialog .table td, .ev-checks .table td { white-space: normal; }
.dh-honest { padding: .6rem .8rem; border-left: 3px solid var(--warn); background: var(--warn-bg); border-radius: 6px; }
.ev-checks { list-style: none; padding: 0; margin: 0; }
.ev-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-bottom: .4rem; }
.ev-status { display: inline-block; padding: .05rem .6rem; border-radius: 999px; font-size: .8rem; border: 1px solid var(--line-strong); }
.ev-ok { color: var(--accent); }
.ev-ng { color: var(--block); border-color: var(--block); background: var(--block-bg); font-weight: 600; }
.ev-error { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
/* 要確認（ここでは確かめられない。合格ではない）/ to confirm, never a pass */
.ev-review { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.ev-row-ng td { color: var(--block); }
.ev-limits ul { padding-left: 1.2rem; }
.table { border-collapse: collapse; width: 100%; background: var(--panel); border: 1px solid var(--line); font-size: .9rem; }
.table th, .table td { padding: .5rem .65rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; }
.status-failed, .status-cancelled { color: var(--block); }
.status-succeeded { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: .6rem; }
.actions.end { justify-content: flex-end; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0 0 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.toggle { display: inline-flex; align-items: center; gap: .4rem; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.page-actions { display: flex; align-items: center; gap: .25rem; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .5rem 0; }
.inline-form input { min-width: 14rem; font-size: 1.1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.15rem; margin: 1rem 0; }
.card-title { font-size: 1rem; margin: 0 0 .35rem; }
.page .notice { margin: 0 0 1rem; max-width: none; }
.coming-soon { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.project-composer { margin: 1rem 0; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.file-list, .chat-cards { list-style: none; margin: .5rem 0; padding: 0; }
.file-list li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.file-list li:last-child { border-bottom: 0; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-picker fieldset { border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: .3rem; max-height: 14rem; overflow-y: auto; }
.chat-cards a { display: flex; align-items: center; gap: .6rem; padding: .6rem .5rem; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; border-radius: 8px; }
.chat-cards a:hover { background: var(--hover); }

/* --- 窓（設定など）/ dialogs ---------------------------------------------------------- */
.dialog { padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--raised); color: var(--ink); box-shadow: var(--shadow); width: min(52rem, calc(100vw - 2rem)); max-height: min(40rem, calc(100dvh - 2rem)); }
.dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog[open] { display: flex; flex-direction: column; }
.small-dialog { width: min(28rem, calc(100vw - 2rem)); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem .6rem 1.4rem; border-bottom: 1px solid var(--line); }
.dialog-title { margin: 0; font-size: 1.15rem; }
.dialog-body { flex: 1; min-height: 0; overflow: auto; padding: 1rem 1.4rem 1.25rem; }
.dialog-form { display: flex; flex-direction: column; gap: .4rem; }
.settings-dialog .dialog-body { padding: 0; }
.settings-layout { display: grid; grid-template-columns: 13rem minmax(0, 1fr); min-height: 28rem; height: 100%; }
.tabs { display: flex; flex-direction: column; gap: .15rem; padding: .75rem; border-right: 1px solid var(--line); }
.tab { border: 0; background: transparent; border-radius: 8px; justify-content: flex-start; padding: .5rem .65rem; width: 100%; text-align: left; }
.tab[aria-selected="true"] { background: var(--active); font-weight: 600; }
.tab-panels { min-width: 0; overflow-y: auto; }
.tab-panel { padding: .75rem 1.4rem 1.25rem; }
.tab-panel:focus-visible { outline-offset: -2px; }
.panel-title { font-size: 1rem; margin: .25rem 0 .75rem; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.setting-row label { display: flex; flex-direction: column; }
.setting-name { font-weight: 500; }
.setting-desc { font-size: .8rem; color: var(--muted); }
.setting-row select { max-width: 19rem; }
/* 表示名の入力と保存（一般のタブ）/ display-name input and save (General tab) */
.display-name-edit { display: flex; gap: .5rem; align-items: center; min-width: 0; }
.display-name-edit input { flex: 1 1 12rem; min-width: 0; max-width: 16rem; }
.setting-block { padding: .5rem 0 .9rem; border-bottom: 1px solid var(--line); }
.setting-block h4 { margin: .25rem 0 .35rem; font-size: .95rem; }
.pref-status { min-height: 1.4em; margin: .5rem 0 0; font-size: .85rem; }
.inst-form { display: flex; flex-direction: column; gap: .8rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label { font-weight: 500; font-size: .9rem; }
.storage-line { margin: .1rem 0 .35rem; }
.storage-meter { width: 100%; height: .7rem; }

/* --- ファイル（files-panel.js）/ files panel ------------------------------------------- */
.files-view { max-width: 62rem; }
.fp-title { font-size: 1.1rem; margin: .5rem 0; }
.fp-message:empty { display: none; }
.fp-message { margin: .5rem 0; padding: .4rem .7rem; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); font-size: .9rem; }
.fp-files { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); font-size: .9rem; }
.fp-files th, .fp-files td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.fp-files th { color: var(--muted); font-weight: 600; }
.fp-cell-name { overflow-wrap: anywhere; }
.fp-cell-size, .fp-cell-date { white-space: nowrap; color: var(--muted); }
.fp-status-badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; border: 1px solid var(--line); font-size: .8rem; }
.fp-status-ready { border-color: var(--accent); color: var(--accent); }
.fp-status-blocked, .fp-status-error { border-color: var(--block); color: var(--block); }
.fp-blocked-types { display: block; color: var(--block); font-size: .8rem; }
.fp-row-asking { background: var(--block-bg); }
.fp-delete-yes { border-color: var(--block); color: var(--block); }
.fp-message-info { background: var(--info-bg); color: var(--ink); }
.fp-message-error { background: var(--block-bg); color: var(--block); }
/* まとめて削除（ファイルの一覧）/ bulk delete in the file list */
.fp-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: .5rem 0; }
.fp-toolbar:empty { display: none; }
.fp-bulk-ask { overflow-wrap: anywhere; }
.fp-ask-note { display: block; color: var(--muted); font-size: .85rem; margin: .15rem 0 .3rem; }
.fp-cell-bulk, .fp-th-bulk { width: 1%; white-space: nowrap; }
.fp-bulk-delete, .fp-bulk-yes { border-color: var(--block); color: var(--block); }
.fp-bulk-delete:disabled { border-color: var(--line); color: var(--muted); }
/* データの保存（設定・管理）/ data retention (settings and admin) */
.retention-table select, .rt-policy input[type="number"] { max-width: 100%; }
.rt-policy input[type="number"] { width: 6.5rem; }
.rt-hold-add { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-top: .6rem; }
.rt-hold-add input { flex: 1 1 18rem; min-width: 0; font-family: ui-monospace, monospace; }
.retention .notice, .retention-admin .notice { max-width: none; margin: .6rem 0; }
.mono { font-family: ui-monospace, monospace; overflow-wrap: anywhere; }

/* --- 幅ごとの配置 / responsive -------------------------------------------------------- */
@media (max-width: 1023px) {
  .project-grid { grid-template-columns: 1fr; }
}

/* 767px 以下: 横の帯は引き出し（ハンバーガーで開く）/ phone: off-canvas drawer */
@media (max-width: 767px) {
  .app, .app.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(var(--side-w), 85vw); transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; box-shadow: var(--shadow); }
  .app.nav-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease, visibility 0s; }
  .side-inner { width: 100%; }
  .side-actions { opacity: 1; }
  /* 右の欄は右から出る引き出し / the side pane becomes a right-hand drawer */
  .session-pane { position: fixed; inset: 0 0 0 auto; z-index: 35; width: min(20rem, 88vw); max-width: 88vw; transform: translateX(100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; box-shadow: var(--shadow); padding-top: max(.75rem, env(safe-area-inset-top)); padding-bottom: max(1.25rem, env(safe-area-inset-bottom)); }
  .session-pane.open { transform: none; visibility: visible; transition: transform .2s ease, visibility 0s; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgb(0 0 0 / .4); }
  .topbar { padding-inline: .4rem; gap: .25rem; }
  .topbar-tools { flex: 1; justify-content: center; }
  .top-status { display: none; }
  .dh-dialog .kv, .evidence .kv { grid-template-columns: 1fr; gap: .1rem; }
  .dh-dialog .kv dd, .evidence .kv dd { margin-bottom: .5rem; }
  .model-picker { font-size: .95rem; padding: .35rem .4rem; }
  .view-body, .page, .card, .project-grid > *, .composer, .dialog-body, .tab-panel { min-width: 0; max-width: 100%; }
  .inline-form input { min-width: 0; flex: 1; }
  .model-sep, .model-level { font-size: .85rem; }
  .project-badge { display: none; }
  .chat-scroll { padding: .75rem .75rem 1rem; }
  .msg.user { max-width: 88%; }
  .msg.assistant { gap: .6rem; }
  .msg.assistant .avatar { display: none; }
  .composer-dock { padding-inline: .5rem; }
  .composer-note { font-size: .72rem; }
  .composer-note.disclaimer { display: none; }
  .empty-title { font-size: 1.35rem; }
  .suggestions { grid-template-columns: 1fr; }
  .suggestion:nth-child(n+3) { display: none; }
  .company-cards { grid-template-columns: 1fr; }
  .view-body { padding: .75rem .9rem 2rem; }
  .dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .small-dialog { height: auto; max-height: 100dvh; border-radius: 18px 18px 0 0; margin-top: auto; }
  .settings-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 0; }
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-right: 0; border-bottom: 1px solid var(--line); padding: .5rem; }
  .tab { width: auto; min-width: 0; white-space: normal; }
  .tab .icon { display: none; }
  .tab-panel { padding: .75rem 1rem 1.5rem; }
  .setting-row { flex-direction: column; align-items: stretch; gap: .4rem; }
  .setting-row select { max-width: none; }
  .display-name-edit input { max-width: none; }
  .fp-cell-date { display: none; }
  .retention-table th, .retention-table td, .rt-policy th, .rt-policy td { padding-inline: .35rem; }
  .rt-policy input[type="number"] { width: 5rem; }
}

/* とても狭い画面: 推論の量の文字を省く（選択の窓と読み上げには出る）/ very narrow: hide the level text */
@media (max-width: 400px) {
  .model-sep, .model-level { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .icon { stroke: CanvasText; }
  .send-btn { border: 1px solid ButtonText; }
}

/* --- サインイン / sign-in gate ------------------------------------------------------- */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.signin-card { width: min(26rem, 100%); text-align: center; }
.signin-card h1 { font-size: 1.3rem; margin: .25rem 0 .75rem; }
.signin-card p { color: var(--muted); margin: 0 0 1rem; }

/* --- 調べもの / research (15 3-5, 07 2-3a) -------------------------------------------- */
.rs-form { display: flex; flex-direction: column; gap: .4rem; }
.rs-form textarea, .rs-form select { width: 100%; max-width: 100%; }
.rs-refs { border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .75rem; margin: .5rem 0; min-width: 0; }
.rs-queries { list-style: none; margin: .5rem 0; padding: 0; }
.rs-query { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.rs-query:last-child { border-bottom: 0; }
.rs-query input[type="text"] { width: 100%; max-width: 100%; margin-top: .35rem; }
.rs-query[data-state="delete"] input[type="text"] { text-decoration: line-through; color: var(--muted); }
.rs-query-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.rs-sources { margin-top: 1rem; overflow-wrap: anywhere; }

/* 管理の区画・プリセットの本文（読むだけ）/ admin panels and read-only preset text */
.preset-text { white-space: pre-wrap; max-height: 16rem; overflow: auto; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-size: .85rem; }
.admin-panel .table td button { margin-right: .35rem; }
.admin-panel form { margin-bottom: 1rem; }

/* 組織の資料（投資先の選択）/ org knowledge picker */
.kn-anchor { position: relative; display: inline-flex; }
.kn-btn { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; }
.kn-pop { position: absolute; top: calc(100% + .25rem); left: 0; z-index: 30; width: min(20rem, 85vw); padding: .5rem; box-shadow: 0 4px 16px rgba(0, 0, 0, .18); }
.kn-pop[hidden] { display: none; }
.kn-search { width: 100%; box-sizing: border-box; }
.kn-list { list-style: none; margin: .4rem 0 0; padding: 0; max-height: 14rem; overflow-y: auto; }
.kn-item { width: 100%; text-align: left; background: none; border: 0; padding: .35rem .5rem; border-radius: .4rem; cursor: pointer; color: inherit; font: inherit; }
.kn-item:hover, .kn-item:focus-visible, .kn-item[aria-selected="true"] { background: var(--hover); }
.kn-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.kn-suggest[hidden] { display: none; }
.kn-table { border-collapse: collapse; width: 100%; }
.kn-table th, .kn-table td { text-align: left; padding: .3rem .6rem; border-bottom: 1px solid var(--hover); }

/* 検索の前の確認 / pre-search approval card */
.sa-panel .msg-body { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: .8rem 1rem; background: var(--raised); }
.sa-title { margin: 0 0 .4rem; font-size: 1rem; }
.sa-notes, .sa-explain { margin: .3rem 0; font-size: .9rem; }
.sa-explain { color: var(--muted); }
.sa-timer { font-size: .9rem; margin: .4rem 0; }
.sa-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.sa-rows { list-style: none; margin: .5rem 0; padding: 0; display: grid; gap: .6rem; }
.sa-row { border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem .7rem; display: grid; gap: .4rem; }
.sa-badges { display: flex; flex-wrap: wrap; gap: .3rem; }
.sa-badge { font-size: .78rem; padding: .05rem .45rem; border-radius: 999px; background: var(--info-bg); }
.sa-badge-flag { background: var(--warn-bg); color: var(--warn); }
.sa-badge-block { background: var(--block-bg); color: var(--block); }
.sa-qline { overflow-wrap: anywhere; }
.sa-mark { background: var(--warn-bg); color: var(--warn); outline: 1px solid var(--warn); border-radius: 3px; padding: 0 .1rem; }
.sa-choices { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.sa-choice { display: inline-flex; align-items: center; gap: .3rem; }
.sa-edit { width: 100%; }
.sa-hint { font-size: .82rem; color: var(--block); }
.sa-message { margin: .4rem 0; padding: .45rem .7rem; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); font-size: .9rem; }
.sa-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.sa-locked .sa-rows { opacity: .6; }

/* 書き起こし: 進み具合の帯（段階しか分からないので終わりの無い帯）と一覧の行 / transcriptions: indeterminate bar and rows */
.tr-bar { position: relative; height: .3rem; margin: .4rem 0; overflow: hidden; border-radius: 999px; background: var(--line); }
.tr-bar > span { position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; border-radius: inherit; background: var(--accent); animation: tr-slide 1.4s ease-in-out infinite; }
@keyframes tr-slide { 0% { left: -40%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .tr-bar > span { animation: none; left: 0; width: 100%; opacity: .55; } }
.tr-history-list .tr-row { margin-bottom: .6rem; }
.tr-history-list .tr-row .actions { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.tr-downloads { margin: .5rem 0; }
.tr-back { margin-bottom: .25rem; }
