/* 絵文字フォント（Noto Color Emoji。unicode-range で分割し、使う文字の分だけ読み込む） */
@import url('../fonts/noto-color-emoji/noto-color-emoji.css');

/* ==========================================================================
   Logiscope2.Chat.UI スタイル（UI設計書 6章）
   配色は外部設計書の画面イメージから採取した実測値。
   画面モック docs/mock/index.html と同一の値を使用する。
   ========================================================================== */

:root {
    /* 外部設計書から採取した実測色 */
    --chat-navy: #10243E;          /* サイドメニュー・上部バー */
    --chat-navy-selected: #17375E; /* 一覧の選択行（反転表示） */
    --chat-link: #0070C0;          /* リンク・既読表示 */
    --chat-badge: #C00000;         /* 未読件数バッジ */
    --chat-chip: #DAEDF3;          /* 選択済みチップ・自身のリアクション */

    /* 設計書 6章 テーマ色 */
    --chat-bubble-mine: #B7DDE8;
    --chat-bubble-other: #D9D9D9;
    --chat-bubble-edit: #FFF2A8;
    --chat-row-odd: #F2F2F2;

    --chat-text: #1A1A1A;
    --chat-text-sub: #767676;
    --chat-line: #D8D8D8;
    --chat-cover: rgba(0, 0, 0, .2);

    --chat-rail: 52px;
    --chat-side-open: 176px;
    --chat-side-sub: 236px;
}

/* 絵文字（リアクション一覧・リアクション選択）の書体（UI設計書 5.6）。
   同梱の Noto Color Emoji で全端末の絵柄をそろえる。本文などほかの文字には指定しない */
.emoji-font {
    font-family: 'Logichat Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

.chat-root {
    /* 本体（Logiscope2.Server/wwwroot/app.css が最後に適用する値）と同じ書体にする。
       日本語は OS 既定（macOS はヒラギノ、Windows は游ゴシック等）へフォールバックする */
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: normal; /* Bootstrap body の 1.5 を打ち消し、従来の行送りへ戻す */
    color: var(--chat-text);
}

/* ---------- ChatLayout ----------
   ヘッダー・サイドメニューの枠は本体様式の AfMainLayout / AfNavMenu
   （Logiscope2.App.UI のスコープ CSS）が担い、ここは本文フレームのみ。 */
.chat-frame {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: #fff;
    /* position は指定しない。ここを positioned にすると、内部に描画される
       Drawer（Cover/Dock）の基準が本体レイアウトの article からここへ移り、
       article の padding 分の余白がドロワーの周囲に出てしまう */
}

.chat-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
}

/* ---------- NavMenu（AfNavMenu への差し込み分） ---------- */

/* 未読ドット（レール表示時もアイコン右上に見える位置） */
.nav-outer li a { position: relative; }

.nav-dot {
    position: absolute;
    top: 8px;
    left: 40px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--chat-badge);
}

/* サイドメニュー2段目（AfNavMenu のサブメニュー。外部設計書 スライド4）。
   AfNavMenu のスコープ CSS（ul li nav[b-*]）より優先させるため .sidebar から指定する。
   背景は Logiscope 本体と同じく、1段目と同じ紺〜紫のグラデーション（AfNavMenu の nav の指定）のまま変えない。
   件数が多い場合は2段目の中でスクロールする。
   狭い画面（スマホ幅）で2段目を開くと、App.UI の AfMainLayout が1段目をアイコンの幅に縮め、2段目を残りの幅いっぱいに出す
   （AfMainLayout.razor.css。ここの幅・位置より優先する。修正候補 No.21）。ここの min() で画面外にはみ出さないよう
   右端を画面の右端に揃えて1段目に重ねるのは、狭い画面でホバーだけで出た2段目（ホバーのある端末で radio を選ばないとき）だけになる。 */
.sidebar .nav-outer li nav {
    width: var(--chat-side-sub);
    left: min(calc(15em + 1px), calc(100vw - var(--chat-side-sub)));
    overflow-y: auto;
    overscroll-behavior: contain;
    /* AfNavMenu はホバー中のサブメニューを半透明（0.9）にするが、2段目は背後の本文が透けて
       読みにくくなるため不透明にする（画面モックの SideMenuSubPanel と同じ） */
    opacity: 1 !important;
    /* 1段目の行（a。未読ドットのため position: relative）より上に描く。指定が無いと、1段目に重なる所で、
       文書の順で2段目より後の親メニュー（トークの2段目に対するグループ）の「＞」が2段目の上に描かれていた（修正候補 No.116） */
    z-index: 1;
}

.sidebar .nav-outer li nav ul {
    height: auto;
    flex-shrink: 0;
}

.sidebar .nav-outer li nav a {
    align-items: center;
}

/* 長いトークルーム名は省略表示する */
.sidebar .nav-outer li nav a > span.flex-grow-1 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 1段目の項目名も、行に収まらなければ末尾を「…」で省略し、未読件数のバッジと「＞」を行（1段目の幅 15em）の中に収める（UI設計書 4.1。修正候補 No.140）。
   Android の OS の文字サイズ（TextZoom）は字だけを大きくし、1段目の幅（em）は変えないため、2.0 では項目名・バッジ・「＞」が幅に収まらない。
   1段目（nav。.nav-outer の中の伸び縮みの要素）の最小の幅が既定（中身の最小の幅。折り返さない項目名の全体）のままだと、1段目が中身に合わせて
   広がり、.nav-outer（overflow: hidden。狭い画面ではサイドバーの幅）で右端が切られて、バッジの右端が欠けて「99-」のように見え、「＞」も見えなかった。
   最小の幅を 0 にして 1段目を 15em に保ち、項目名を縮める。字が収まる大きさでは見た目は変わらない */
.sidebar .nav-outer > nav { min-width: 0; }
.sidebar .nav-outer > nav > ul > li a > span.flex-grow-1 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* トークアイコン（TalkRoomIcon の s = 24px）を前置する項目（リンク a・リンクにしない span.nav-text の両方）。
   アイコンと名前の間隔を詰め、上下の余白を減らして行の高さを従来とほぼ同じ（約40px）に保つ */
.sidebar .nav-outer li nav a.has-prefix,
.sidebar .nav-outer li nav .nav-text.has-prefix {
    align-items: center;
    gap: .75em;
    padding-top: 8px;
    padding-bottom: 8px;
}

/* 前置表示の入れ物（AfNavMenu の span.nav-prefix）。アイコンの大きさのまま縮めない */
.sidebar .nav-outer li nav .nav-prefix {
    display: inline-flex;
    flex-shrink: 0;
    line-height: 0;
}

/* グループの共通アイコン。AfNavMenu のスコープ CSS は項目内の svg を 1.6em に固定するため、
   円の中の大きさ（TalkRoomIcon の 62%）に戻す */
.sidebar .nav-outer li nav .nav-prefix .avatar.group-icon svg {
    width: 62% !important;
    height: 62% !important;
}

/* 紺色の円が2段目の紺〜紫の背景に埋もれないよう、2段目の中でだけ白の細い枠を付ける */
.sidebar .nav-outer li nav .avatar.group-icon {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .55);
}

/* UnreadBadge（ラベルの右。100件以上は 99+）。
   border-box のため高さ・最小幅は padding 込み。1桁はほぼ円になり、桁数に応じて横に伸びる。
   サイドメニュー（1段目・2段目）とトーク一覧で同じ見た目にする（親の太字などは継承しない）。
   高さは固定せず、min-height と単位なしの line-height（20/13 より僅かに小さく、13px では 20px 未満）で決める。
   Android の OS の文字サイズ（TextZoom）は字と単位なしの line-height だけを大きくし px は変えないため、
   height・px の line-height で固定すると 2.0 で字がはみ出して日時に重なる（UI設計書 6章 / 修正候補 No.94）。
   角丸は高さが伸びても両端が半円になるよう大きくとる（20px の高さでは従来の 10px と同じ）。
   height は auto にせず fit-content にして、中身の高さのまま行の高さへ引き伸ばさない
   （サイドメニュー1段目の a は align-items が既定の stretch のため、auto ではアイコンの高さまで伸びる） */
.unread-badge {
    box-sizing: border-box;
    min-width: 22px;
    min-height: 20px;
    height: fit-content;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--chat-badge);
    color: #fff;
    font-size: 13px;
    line-height: 1.538;
    text-align: center;
    font-weight: 400;
    flex-shrink: 0;
}

/* AvatarImage */
.avatar {
    border-radius: 50%;
    flex: 0 0 auto;
    background: #BFBFBF;
    object-fit: cover;
}

.avatar.s { width: 24px; height: 24px; }
.avatar.m { width: 34px; height: 34px; }
.avatar.l { width: 62px; height: 62px; }

/* TalkRoomIcon: グループトークの共通アイコン（アバターと同じ大きさの円） */
.avatar.group-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--chat-navy-selected);
    color: #fff;
}

/* ---------- 画面ヘッダ ----------
   見出しは共通の BreadCrumb（Logiscope2.App.UI）を使う。
   トークルームの「検索」「グループ設定」は共通の Anchor（a.anchor。青字・アイコンも青）で、
   文字の大きさはドロワー内の Anchor と同じ 12.5px にする（UI設計書 4.3 トークルーム）。 */
.anchor.room-action {
    flex: 0 0 auto;
    align-self: center;
    font-size: 12.5px;
    white-space: nowrap;
}

/* 読み込み中（Disabled）は Anchor の無効の見た目（opacity .6）のまま、押せる見た目にしない */
.anchor.room-action.disabled { cursor: default; }

/* スマホ幅（640px 以下）ではトークルームの見出しを画面の幅いっぱいに使い、2 行までで末尾を「…」で省略する。
   「検索」「グループ設定」は見出しの下の行に右寄せで置く。ブラウザのタブのタイトル（PageTitle）は全文のまま。
   共通の BreadCrumb の外側の要素にはクラスを付けられないため、見出しの data-testid で対象を絞る
   （トーク一覧の見出しは変えない）。 */
@media screen and (max-width: 640px) {
    .d-flex:has(> h2[data-testid="talk-room-title"]) {
        flex-wrap: wrap;
        justify-content: flex-end;
        row-gap: 4px;
    }

    .d-flex > h2[data-testid="talk-room-title"] {
        flex: 1 0 100%;
        min-width: 0;
        font-size: 22px;
        line-height: 1.35;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        overflow-wrap: anywhere;
        margin-bottom: 0;
    }
}

/* ---------- TalkList（QuickGrid） ---------- */
.talk-list {
    flex: 1;
    overflow-y: auto;
    /* 右はスクロールバーとコンテンツの間の余白 */
    padding: 0 5px 16px 0;
}

.talk-list table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
    table-layout: fixed;
}

.talk-list tr { cursor: pointer; }
.talk-list td { padding: 0 !important; }
.talk-list tbody tr:nth-child(odd) td { background: var(--chat-row-odd); }
/* :hover はマウスなどで指せる端末だけ（タッチ端末の WebView はタップの後もその位置に :hover を残す。修正候補 No.120。以下の @media (hover: hover) も同じ） */
@media (hover: hover) { .talk-list tbody tr:hover td { background: #E7EEF4; } }

.tr-item { padding: 10px 14px; }

.tr-item .line1 {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

/* 1行目は、トーク名を縮めて（末尾を「…」で省略）投稿日時を全部見せる。ただしトーク名は頭の 1〜2 字と「…」が見える幅（4.5em。名前が短ければその幅）より
   縮めず、それでも収まらない分は投稿日時を縮める（末尾を「…」で省略。UI設計書 4.2。修正候補 No.140）。
   Android の OS の文字サイズ 2.0（TextZoom）では、投稿日時と未読件数のバッジが縮まずにトーク名だけが 0 まで縮み、99+ の行は名前が 1 字も見えず、
   投稿日時も行の右へはみ出していた。トーク名は幅 0 から名前の長さ（max-content）まで伸び、伸びきった残りは投稿日時の左の余白（margin-left: auto）になる。
   名前が最小の幅で収まらない間だけ、伸び縮みの基準が 0 のトーク名は縮まず、投稿日時が縮む。
   最小の幅の calc-size() を使えないブラウザ（Safari・Firefox など）は min-width: 0 のまま（従来と同じく名前が 0 まで縮みうる）。
   字が収まる大きさでは見た目は変わらない */
.tr-item .name {
    flex: 1 1 0%;
    min-width: 0;
    min-width: calc-size(max-content, min(size, 4.5em));
    max-width: max-content;
    font-size: 12.5px;
    letter-spacing: .08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tr-item .when {
    margin-left: auto;
    min-width: 0;
    font-size: 11px;
    color: var(--chat-text-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tr-item .line2 {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 6px;
}

.tr-item .preview {
    max-width: calc(66% + 24px); /* border-box のため padding 分を加算して従来の実効幅を維持 */
    padding: 7px 12px;
    font-size: 12px;
    line-height: 1.6;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tr-item .preview.other { background: var(--chat-bubble-other); }
.tr-item .preview.mine { background: var(--chat-bubble-mine); margin-left: auto; }

/* トークルームの吹き出し（UI設計書 4.3 PostBubble）と同じ形にそろえる:
   相手の投稿は左上、自分の投稿は右上の角を直角。他の角は角丸のまま */
.tr-item .preview.other { border-top-left-radius: 0; }
.tr-item .preview.mine { border-top-right-radius: 0; }

/* 投稿の無い新規ルーム（吹き出し枠なしの薄字） */
.tr-item .preview.none {
    background: none;
    padding: 7px 0;
    color: var(--chat-text-sub);
    font-size: 11px;
}

/* ---------- TalkRoom ---------- */
.talk-room {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* タイムラインと「新しい投稿があります」を重ねる枠。ボタンはスクロールせずタイムラインの下部に留める */
.post-timeline-frame {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.post-timeline {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    /* 右はスクロールバーとコンテンツの間の余白 */
    padding: 0 5px 16px 0;
}

/* 過去の投稿の読み込みの間（JS の beginPrepend から補正の後まで）は、ブラウザのスクロールアンカリングを止め、先頭への挿入の補正を
   JS（adjustScrollAfterPrepend）だけにする（Chromium は自分でも補正し、二重になって新しい側へ飛んでいた。修正候補 No.86）。
   常に止めると上側の高さの変化（縮小画像の読み込み・リアクション・編集・削除）をブラウザが補正しなくなるため、読み込みの間だけにする */
.post-timeline.prepending { overflow-anchor: none; }

/* 「新しい投稿があります」（UI設計書 4.3）。遡って読んでいる途中に他の人の投稿が届いたら下部中央に出す。
   表示・非表示はフェードで切り替え、隠している間（フェードの後）は visibility: hidden で押せなくする */
.new-posts-button {
    position: absolute;
    left: 50%;
    bottom: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 14px;
    border: 0;
    border-radius: 16px;
    background: var(--chat-navy);
    color: #fff;
    font: inherit;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(6px);
    transition: opacity .3s, transform .3s, visibility 0s .3s;
}

.new-posts-button.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%);
    transition: opacity .2s, transform .2s, visibility 0s;
}

/* AssetIcon のインラインの大きさ（1.4em）より優先する */
.new-posts-button svg {
    width: 14px !important;
    height: 14px !important;
}

/* 「新しい投稿があります」の読み上げ（aria-live）。画面には表示しない */
.new-posts-announcer {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* トークルームを開く・切り替えるときの読み込み中表示（UI設計書 4.3）。
   投稿タイムラインの領域だけを占め、中央に共通デザインの Spinner を出す */
.talk-room-loading {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 投稿の読み込みに失敗した（通信エラー）。タイムラインの領域の中央に案内と「再読み込み」を出す（UI設計書 4.3） */
.talk-room-failed {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 12.5px;
    color: var(--chat-text);
    text-align: center;
}

.talk-room-failed-icon {
    display: inline-flex;
    color: #9AA7B4;
}

.talk-room-failed-icon svg {
    width: 34px !important;
    height: 34px !important;
}

/* リンク風のボタン（トーク一覧の取得に失敗したときの「再読み込み」も同じ見た目。UI設計書 4.2） */
.talk-room-reload,
.talk-list-reload {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 6px;
    border: 0;
    background: none;
    color: var(--chat-link);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
}

.talk-room-reload svg,
.talk-list-reload svg {
    width: 15px !important;
    height: 15px !important;
}

@media (hover: hover) {
    .talk-room-reload:hover,
    .talk-list-reload:hover {
        text-decoration: underline;
    }
}

/* トーク一覧の取得に失敗した。一覧の欄のエラーの下に「再読み込み」を中央に出す（UI設計書 4.2） */
.talk-list-failed {
    display: flex;
    justify-content: center;
    padding: 12px 16px;
}

.tl-start {
    text-align: center;
    font-size: 10.5px;
    color: var(--chat-text-sub);
    padding: 2px 0 8px;
}

/* 過去投稿の自動読み込み。トリガーは表示位置の検知専用で高さを持たない */
#load-older-trigger { height: 0; }

.tl-spinner {
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-right: 6px;
    vertical-align: -2px;
    border-radius: 50%;
    border: 2px solid var(--chat-line);
    border-top-color: var(--chat-navy);
    animation: tl-spin .8s linear infinite;
}

@keyframes tl-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .tl-spinner { animation: none; }
}

.date-sep {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 6px 0 16px;
    color: var(--chat-text-sub);
}

.date-sep::before,
.date-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--chat-line);
}

.date-sep span { font-size: 11px; white-space: nowrap; }

.post {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.post.mine { align-items: flex-end; }

.post .meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 11px;
}

.post .meta .tm { color: var(--chat-text-sub); }

.post .body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: min(620px, 76%);
}

/* スマホ幅（640px 以下。サイドメニューの切り替えと同じ境界）では投稿の行の最大幅の制限をなくし、
   アバターとボタン以外の幅をすべて吹き出しに使う（UI設計書 4.3 PostBubble）。
   76% のままでは 375px 前後の画面で吹き出しが約 150px しか使えないため。
   短い投稿は文字の長さに合わせた幅のまま（吹き出しは引き伸ばさない）で、長い投稿だけが広がる。 */
@media screen and (max-width: 640px) {
    .post .body { max-width: 100%; }
}

/* アバターは縮めず、吹き出し（添付）の側を縮めて折り返す */
.post .body > .avatar-btn { flex-shrink: 0; }

.bubble {
    min-width: 0;
    padding: 9px 13px;
    font-size: 12.5px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--chat-bubble-other);
    border-radius: 8px;
}

.post.mine .bubble { background: var(--chat-bubble-mine); }

/* 吹き出しの形（UI設計書 4.3 PostBubble）。投稿者の側の上の角を直角にし、誰の投稿かを形でも示す:
   相手の投稿は左上、自分の投稿は右上。他の角は角丸のまま。編集中（黄色の背景）も同じ形。
   添付ファイル・画像の縮小表示の枠（.thumb-btn / .file-btn）も同じ角を直角にして形をそろえる */
.post.other .bubble,
.post.other .attachment .thumb-btn,
.post.other .attachment .file-btn { border-top-left-radius: 0; }

.post.mine .bubble,
.post.mine .attachment .thumb-btn,
.post.mine .attachment .file-btn { border-top-right-radius: 0; }

.bubble a { color: var(--chat-link); text-decoration: underline; }

/* タッチ操作の端末（主な入力がホバーできない）では、長押しで吹き出しの文字を選択させない（UI設計書 4.3 PostBubble。修正候補 No.6・決定 Q34）。
   Android は長押しで文字の選択（つまみ・Chrome の「タップして検索」）がアプリのメニューと同時に出てメニューを隠し、
   iOS は OS の選択の吹き出しになってメニューが開かなかった。本文はメニューの「コピー」で写せる。
   条件に pointer: coarse を含めない（確認用の Android エミュレーターは主なポインターを fine と報告する。修正候補 No.7）。
   リンクの長押し（-webkit-touch-callout）は変えない（ブラウザ版はリンクのプレビューを残し、アプリ版は app.css の指定のまま） */
@media (hover: none) {
    .bubble {
        -webkit-user-select: none;
        user-select: none;
    }
}

.post .meta .edited { color: var(--chat-text-sub); font-size: 10.5px; }

/* ブックマーク・リアクション・⋮ は投稿者名・投稿日時（編集済み）の行の右に置く（修正候補 No.23）。
   日時との間を少し広げ、縮めない */
.post .meta > .post-actions { margin-left: 6px; flex-shrink: 0; }

/* 編集モード中の投稿は吹き出しを黄色にして編集対象を示す（UI設計書 6章 --chat-bubble-edit）。
   編集そのものは投稿内容入力欄で行う。自身／他者の背景色より詳細度を高くして必ず上書きする。 */
.post.mine .bubble.editing,
.post.other .bubble.editing {
    background: var(--chat-bubble-edit);
}

/* ---------- エラー表示 ---------- */
.chat-error {
    flex: 0 0 auto;
    margin: 0;
    padding: 8px 18px;
    background: #FDECEA;
    border-bottom: 1px solid var(--chat-line);
    color: var(--chat-badge);
    font-size: 12px;
}

/* 案内（編集中の投稿の削除、グループの削除・参加者からの除外など）。エラーと区別し、閉じるボタンを持つ */
.chat-notice {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 6px 12px 6px 18px;
    background: var(--chat-bubble-edit);
    border-bottom: 1px solid var(--chat-line);
    font-size: 12px;
}

.chat-notice > span { flex: 1 1 auto; }

.chat-notice-close {
    flex: 0 0 auto;
    display: inline-flex;
    padding: 2px;
    border: none;
    background: transparent;
    color: var(--chat-text-sub);
    cursor: pointer;
}

.chat-notice-close svg { width: 14px; height: 14px; }

/* ---------- 添付ファイル（PostAttachmentContent） ---------- */
.attachments { display: flex; flex-wrap: wrap; gap: 12px; min-width: 0; }
/* 自身の投稿は、添付が 1 行に収まらず折り返したときも各行を右へ寄せる（入れ物が幅いっぱいになっても左に並ばない。修正候補 No.94） */
.post.mine .attachments { justify-content: flex-end; }

.attachment {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 200px;
}

.attachment .thumb-btn,
.attachment .file-btn {
    border: 1px solid var(--chat-line);
    background: #fff;
    padding: 0;
    cursor: pointer;
    line-height: 0;
    border-radius: 4px;
    overflow: hidden;
}

.attachment .thumb-btn img { display: block; max-width: 200px; max-height: 200px; }

.attachment .thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 90px;
    color: var(--chat-text-sub);
    font-size: 11px;
    line-height: 1;
}

.attachment .file-btn { padding: 10px 14px; }

/* ファイル名・サイズの右に ⋮（タッチ操作の端末のみ） */
.attachment-meta { display: flex; align-items: flex-start; gap: 4px; font-size: 11px; }
.attachment-meta .nm-sz { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* ファイル名は 2 行までで、超える分は末尾を「…」で省略する（長い名前で添付 1 件が画面の半分を占めないように。修正候補 No.94） */
.attachment-meta .nm {
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.attachment-meta .sz { color: var(--chat-text-sub); }

/* ファイル形式アイコン。色は旧ロジチャットの区分に合わせる。 */
.file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
    background: #767676;
}

.file-icon.xlsx { background: #217346; }
.file-icon.docx { background: #2B579A; }
.file-icon.pptx { background: #C43E1C; }
.file-icon.pdf { background: #C00000; }
.file-icon.img { background: #0070C0; }
.file-icon.etc { background: #767676; }

/* ---------- LightboxDialog ---------- */
.lightbox .lightbox-frame {
    position: relative;
    margin: 0;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.lightbox img { max-width: 90vw; max-height: 78vh; background: #fff; }

/* 覆い（--chat-cover）は薄く白地の画面では白文字が読めないため、文字の下に半透明の黒を敷く。
   白地の画面の上でも白文字とのコントラストは約 7.8:1（WCAG AA の 4.5:1 以上） */
.lightbox figcaption,
.lightbox .lightbox-loading {
    margin: 0;
    padding: 4px 10px;
    border-radius: 4px;
    color: #fff;
    background: rgba(0, 0, 0, .6);
    font-size: 12px;
}

.lightbox figcaption:empty { display: none; }

.lightbox:focus { outline: none; }

.lightbox .lightbox-page { margin-left: 8px; }

/* 閉じるボタン（画面モック）。読み込み中・エラー表示でも重ならないよう画面の右上に置く */
.lightbox .lightbox-close {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    width: 32px;
    height: 32px;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(0, 0, 0, .5);
    cursor: pointer;
}

.lightbox .lightbox-close svg { width: 15px; height: 15px; }

/* 複数枚のときの前後ボタン。画像の左右端に重ねる */
.lightbox .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(0, 0, 0, .5);
    cursor: pointer;
}

.lightbox .lightbox-nav.prev { left: 8px; }
.lightbox .lightbox-nav.next { right: 8px; }
.lightbox .lightbox-nav:disabled { opacity: .3; cursor: default; }

/* ---------- ブックマーク・リアクションのボタン ---------- */
/* 投稿者名・投稿日時の行（.meta）の末尾に置く。ReactionPicker はこの要素（親要素）の近くに出す（placePopup） */
.post-actions { display: flex; align-items: center; gap: 6px; position: relative; }

.pbtn {
    border: 0;
    background: none;
    padding: 2px;
    cursor: pointer;
    color: var(--chat-text-sub);
    line-height: 0;
}

.pbtn svg { width: 15px; height: 15px; }
/* ホバー色はホバーのある端末だけ。タッチ端末ではタップの後も :hover が残り、iOS でブックマークを外した直後も
   ON と同じ青のまま見えるため（修正候補 No.92） */
@media (hover: hover) {
    .pbtn:hover { color: var(--chat-link); }
}

/* ブックマーク ON はブルー（外部設計書 スライド6） */
.pbtn.on { color: var(--chat-link); }

/* ⋮（コンテキストメニューを開く）。PC・スマホとも常に表示する（右クリック・長押しでも同じメニューを開く）。
   iOS の Safari は長押しで contextmenu を発生させず、主なポインターを fine と報告するタッチ端末もあるため、
   端末の判定に頼らず常に出す。アイコンの SVG は塗りの指定が無いため文字色で塗る */
.pbtn.more svg { fill: currentColor; }

/* ---------- ReactionBar ---------- */
.reaction-bar { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.post.mine .reaction-bar { justify-content: flex-end; }

.rchip {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-size: 11px;
    color: var(--chat-text-sub);
}

.rchip .em {
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #BFBFBF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.rchip.mine .em { background: var(--chat-chip); }
.rchip.mine .cnt { color: var(--chat-link); }

/* ---------- ReactionPicker ---------- */
/* 旧ロジチャット（Rocket.Chat 2.x）の絵文字ピッカーと同じ構成（UI設計書 4.3）。
   位置は JS（placePopup）がリアクションボタンの近くの画面内に置く。
   JS が動くまでは画面中央に出す。
   高さは見えている範囲（App.UI の viewport-height.js が入れる --app-height）に収める。キーボードを開くと見えている範囲だけが縮み、
   100dvh は縮まないため、検索欄をタップしてキーボードを開くと一覧の下半分がキーボードに隠れていた（修正候補 No.109）。
   変数が無いとき（スクリプトを読み込まない常駐アプリ、ホーム画面の PWA でキーボードが閉じている間）は 100dvh。
   幅は左右の安全領域（App.UI の --app-safe-left・--app-safe-right。ブラウザ版の横向きの iPhone）を除いた画面の幅に収める（修正候補 No.160） */
.reaction-picker-cover { position: fixed; inset: 0; z-index: 119; }

.reaction-picker {
    position: fixed;
    z-index: 120;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(344px, calc(100vw - 16px - var(--app-safe-left, 0px) - var(--app-safe-right, 0px)));
    height: min(380px, calc(100vh - 16px));
    height: min(380px, calc(100dvh - 16px));
    height: min(380px, calc(var(--app-height, 100dvh) - 16px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--chat-line);
    box-shadow: 0 4px 16px rgba(16, 36, 62, .3);
    font-size: 11px;
    color: var(--chat-text);
    text-align: left;
    outline: none;
}

.reaction-picker .ep-tabs { display: flex; border-bottom: 1px solid var(--chat-line); }

.reaction-picker .ep-tabs button {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: .45;
}

@media (hover: hover) { .reaction-picker .ep-tabs button:hover { opacity: 1; } }
.reaction-picker .ep-tabs button.active { opacity: 1; border-bottom-color: var(--chat-link); }

.reaction-picker .ep-search { padding: 6px 8px; }

.reaction-picker .ep-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 1px solid var(--chat-line);
    font-size: 12px;
}

.reaction-picker .ep-body {
    position: relative; /* scrollToChild の基準 */
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 4px 6px;
}

/* 画面外のカテゴリは描画を省き、絵文字フォントもその分は読み込まない */
.reaction-picker .ep-section { content-visibility: auto; }

.reaction-picker .grp { padding: 6px 4px 2px; font-weight: 700; font-size: 10.5px; }
.reaction-picker .ep-none { padding: 4px 4px 8px; color: var(--chat-text-sub); }

.reaction-picker .ep-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
}

.reaction-picker .ep-grid button {
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

@media (hover: hover) { .reaction-picker .ep-grid button:hover { background: #EFEFEF; } }

/* ---------- ReadReceipt ---------- */
.read-receipt {
    align-self: flex-end;
    margin-top: 4px;
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
    font-size: 11px;
    color: var(--chat-link);
}

/* ---------- PostContextMenu ---------- */
.ctx-cover { position: fixed; inset: 0; z-index: 110; }

.ctx-menu {
    position: fixed;
    z-index: 120;
    min-width: 170px;
    background: #fff;
    border: 1px solid var(--chat-line);
    box-shadow: 0 4px 16px rgba(16, 36, 62, .3);
    padding: 4px 0;
}

.ctx-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 0;
    background: none;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
}

@media (hover: hover) { .ctx-menu button:hover { background: #EFEFEF; } }

/* 開いたときにメニューへフォーカスを移す（Esc で閉じるため）。枠線は出さない */
.ctx-menu:focus { outline: none; }
.ctx-menu button svg { width: 15px; height: 15px; }

/* ---------- ダイアログ（ConfirmDialog / ReadEmployeeList） ---------- */
.dialog-host {
    position: fixed;
    inset: 0;
    /* Drawer のカバー（.cover: z-index 300）より上に重ねる */
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-cover { position: absolute; inset: 0; background: var(--chat-cover); }

.dialog {
    position: relative;
    background: #fff;
    min-width: 280px;
    max-width: min(420px, 90vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 28px rgba(16, 36, 62, .35);
}

.dlg-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--chat-navy);
    color: #fff;
    padding: 8px 12px;
    font-size: 12.5px;
}

.dlg-close { border: 0; background: none; color: #fff; cursor: pointer; line-height: 0; padding: 0; }
.dlg-close svg { width: 14px; height: 14px; }

.dlg-body { padding: 14px 16px; font-size: 12.5px; overflow-y: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 10px 16px 14px; }

.btn {
    border: 1px solid var(--chat-line);
    background: #fff;
    padding: 5px 16px;
    font-size: 12px;
    cursor: pointer;
    /* Bootstrap の .btn / reboot（label）から引き継がれる値を従来の見た目へ戻す */
    color: var(--chat-text);
    line-height: normal;
    margin: 0;
}

/* 本体グローバル CSS（App.UI app.css）の *[disabled] { background:#eee !important } への対抗。
   チャットのボタンは opacity による無効表示を持つため、配色は通常時と同じにする */
.btn:disabled, .btn[disabled] {
    background: #fff !important;
    color: var(--chat-text) !important;
    -webkit-text-fill-color: var(--chat-text) !important;
}

.btn.primary:disabled {
    background: var(--chat-navy) !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}

.btn.primary { background: var(--chat-navy); border-color: var(--chat-navy); color: #fff; }

/* ---------- Drawer 内のダイアログ本文（本体様式の Drawer に差し込む内容） ---------- */
.drawer-body {
    font-size: 12.5px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* グループ設定の初期表示の読み込み中（UI設計書 4.4）。フォームの代わりに本文の中央へ共通デザインの Spinner を出す */
.drawer-loading {
    flex: 1;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 一覧のスクロールバーは濃紺（外部設計書のイメージ） */
.drawer-body .select-list::-webkit-scrollbar,
.drawer-body .search-results::-webkit-scrollbar { width: 7px; }
.drawer-body .select-list::-webkit-scrollbar-thumb,
.drawer-body .search-results::-webkit-scrollbar-thumb { background: var(--chat-navy); border-radius: 4px; }

.drawer-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.drawer-head h2 { flex: 1; margin: 0; font-size: 28px; font-weight: 500; line-height: 1.2; }

/* タッチ操作の端末では、見出しの右の「登録」「選択」の押せる範囲を 44px 四方にする（UI設計書 4.4。修正候補 No.95）。
   見た目の文字の位置は変えず、見出しの文字と下端（ベースライン）をそろえたまま上下左右に広げる。
   条件はタッチの判定（hover: none）にそろえる（PC の見た目は変えない。pointer: coarse を使わない理由は修正候補 No.7） */
@media (hover: none) {
    .drawer-head .anchor {
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }
}

/* ドロワー内の項目名・件数・注記などは本文と同じ大きさの黒文字（外部設計書 スライド10〜14） */
.drawer-body .count { margin: 8px 0 0; color: var(--chat-text); font-size: 12.5px; }

/* トーク内検索の条件行（ブックマーク絞り込み + 検索リンク） */
.search-cond-row { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.search-cond-row .check-row { margin-bottom: 0; }
.search-cond-row .anchor.search-run { margin-left: auto; }

/* 検索結果のフッタ（ページャ）。一覧の下＝ドロワー下端に固定する */
.search-foot { flex: 0 0 auto; margin-top: auto; padding-top: 8px; }

.pager-nav { display: flex; align-items: center; justify-content: center; gap: 3px; }

.pager-nav .pg {
    min-width: 20px;
    height: 20px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 10.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-text);
    padding: 0 3px;
}

.pager-nav .pg svg { width: 13px; height: 13px; }
.pager-nav .pg.num.current { color: var(--chat-link); font-weight: 700; }

/* 本体グローバル CSS の *[disabled] { background:#eee !important } への対抗 */
.pager-nav .pg:disabled {
    background: transparent !important;
    opacity: .35;
    pointer-events: none;
}

/* タッチ操作の端末では、ページ送りを指で押せるよう 44px 四方にし、間を空けずに並べる（UI設計書 4.4。修正候補 No.95）。
   ドロワーの最小幅（300px。内側は 240px）には 44px のボタンが 5 個までしか入らず、9 個（≪ ＜ 5 ページ ＞ ≫）では 1 個が約 27px になるため、
   ページ番号は今のページだけを出し、「≪ ＜ 今のページ ＞ ≫」の 5 個にする（ほかのページへは ＜ ＞ ≪ ≫ で移る。全体のページ数は下の行に出る）。
   PC（マウス）は従来どおり今のページを中心に最大 5 ページの番号を出す */
@media (hover: none) {
    .pager-nav { gap: 0; }
    .pager-nav .pg {
        flex: 0 1 44px;
        min-width: 0;
        height: 44px;
        padding: 0;
        font-size: 12.5px;
    }
    .pager-nav .pg.num:not(.current) { display: none; }
    .pager-nav .pg svg { width: 15px; height: 15px; }
}

.search-foot .pager { margin: 4px 0 0; text-align: right; font-size: 10px; color: var(--chat-text); }

.anchor.danger { color: var(--chat-badge); fill: var(--chat-badge); }

/* 注記（内線番号選択・投稿者情報の電話など） */
.drawer-note { margin: 14px 0 0; font-size: 12.5px; color: var(--chat-text); line-height: 1.7; }

/* ---------- 内線番号選択（1〜30 を 5列×6行のボタンから選ぶ。UI設計書 4.4） ---------- */
.ext-hint { margin: 0 0 8px; font-size: 12.5px; color: var(--chat-text); }

/* PC 幅・スマホ幅のどちらでも 30個がスクロールなしで収まるよう、
   幅はドロワーの内寸とし、上限（360px）と画面の高さから求めた値で抑える。
   高さの差し引き分は見出し・案内・注記とドロワーの上下 padding の合計の目安 */
.ext-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    /* 100dvh を解釈しないブラウザ向けの代替（後の宣言が無効なら、こちらが使われる） */
    width: min(100%, 360px, calc((100vh - 230px) * 5 / 6));
    width: min(100%, 360px, calc((100dvh - 230px) * 5 / 6));
    flex: 0 0 auto;
}

.ext-num {
    aspect-ratio: 1 / 1;
    min-width: 0;
    padding: 0;
    border: 1px solid #BFBFBF;
    border-radius: 0;
    background: #fff;
    color: var(--chat-text);
    font: inherit;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.ext-num:hover,
.ext-num:focus-visible,
.ext-num:focus {
    background: var(--chat-navy-selected);
    border-color: var(--chat-navy-selected);
    color: #fff;
    outline: none;
}

/* ドロワー末尾の操作（グループ設定の削除など） */
.drawer-tail { margin-top: 16px; text-align: right; }

/* ---------- ダイアログ内の入力・一覧 ---------- */
/* 検索欄は残りの幅いっぱいに伸び縮みし（min-width: 0。指定が無いと入力欄の既定の幅（字の大きさに比例）より縮まない）、「検索」は縮めない。
   Android の OS の文字サイズ 2.0（TextZoom）で、ユーザー検索の検索欄がドロワーの右へはみ出し、「検索」が画面の外に出ていた（UI設計書 4.4。修正候補 No.140） */
.filter-row { display: flex; gap: 8px; margin-bottom: 10px; }
.filter-row input { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--chat-line); font: inherit; }
.filter-row > .anchor { flex: 0 0 auto; white-space: nowrap; }

/* ドロワー内（トーク内検索の「ブックマークのみ」）でのみ使う。本文と同じ大きさの黒文字 */
.check-row { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 12.5px; color: var(--chat-text); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field .lb { font-size: 12.5px; color: var(--chat-text); }
.field input,
.field textarea {
    padding: 5px 8px;
    border: 1px solid var(--chat-line);
    font: inherit;
    resize: vertical;
}

.field .hint { margin: 0; font-size: 12.5px; color: var(--chat-text); }

.select-list { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; min-height: 0; overflow-y: auto; }

.select-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    cursor: pointer;
    font-size: 12.5px;  /* 氏名と №・会社名を本文と同じ大きさにそろえる（外部設計書 スライド12） */
    line-height: 1.5;
}

@media (hover: hover) { .select-list li:hover { background: #EFEFEF; } }

/* 単一選択の確定待ち（ユーザー検索で個人間トークを開いている間）。他の行は押せない */
.select-list.busy li { cursor: progress; }
.select-list.busy li:not(.confirming) { opacity: .5; }
@media (hover: hover) { .select-list.busy li:hover { background: none; } }
.select-list li.confirming { background: #EFEFEF; }
.select-list .row-loading { margin-left: auto; color: var(--chat-text); font-size: 12.5px; white-space: nowrap; flex: 0 0 auto; }

/* 選択中の行は反転表示（外部設計書 スライド12） */
.select-list li.selected { background: var(--chat-navy-selected); color: #fff; }

.select-list .nm { flex: 1; letter-spacing: .08em; }

/* 2段表示の行（従業員選択の №・会社名 / 内線番号選択のラベル） */
.select-list .emp { display: flex; flex-direction: column; flex: 1; min-width: 0; }
/* №・会社名は1行に収め、はみ出す分は末尾を「…」で省略する（行末の「開いています…」と並んでも折り返さない） */
.select-list .sb {
    font-size: 12.5px;
    color: var(--chat-text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.select-list li.selected .sb { color: #fff; }

/* スマホ幅（640px 以下。ドロワーは最小幅 300px）では省略せずに折り返す。
   全文の title はタッチ操作では見られず、会社名・部署が途中で切れて読めないため（修正候補 No.94） */
@media screen and (max-width: 640px) {
    .select-list .sb {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* ---------- 選択済みチップ ---------- */
.chip-row,
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--chat-chip);
    padding: 2px 6px 2px 8px;
    font-size: 11.5px;
    border-radius: 2px;
}

.chip button {
    border: 0;
    background: none;
    cursor: pointer;
    padding: 0 2px;
    font-size: 12px;
    line-height: 1;
    color: var(--chat-text-sub);
}

/* タッチ操作の端末では、チップの「×」（参加者・投稿者の除去）の押せる範囲を 44px 四方にする（UI設計書 4.4。修正候補 No.95）。
   チップの見た目は高さ 32px にとどめ、「×」をチップの上下へ 6px ずつはみ出させる。チップの行の間を 12px 空けて、
   上下の行の「×」の押せる範囲を重ねない */
@media (hover: none) {
    .chip-row,
    .chip-list { gap: 12px 6px; padding-top: 6px; }
    .chip { min-height: 32px; padding: 0 0 0 10px; }
    .chip button {
        min-width: 44px;
        min-height: 44px;
        margin: -6px 0;
        font-size: 15px;
    }
}

/* ---------- 検索結果（日時・投稿者・本文の3段重ね。幅19.6%のドロワーに収める） ---------- */
.search-results { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; min-height: 0; overflow-y: auto; }

.search-results li {
    display: block;
    padding: 7px 9px;
    cursor: pointer;
    line-height: 1.55;
}

@media (hover: hover) { .search-results li:hover { background: #EFEFEF; } }
.search-results li.selected { background: var(--chat-navy-selected); color: #fff; }
/* 日時・投稿者・本文はいずれも本文と同じ大きさの黒文字（選択行は白） */
.search-results li { color: var(--chat-text); }
.search-results .tm { display: block; font-size: 12.5px; color: var(--chat-text); }
.search-results li.selected .tm { color: #fff; }
.search-results .nm { display: block; font-size: 12.5px; letter-spacing: .08em; }
.search-results .bd { display: block; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dlg-foot .pager { margin-right: auto; font-size: 12.5px; color: var(--chat-text); }
.dlg-foot .count { margin-right: auto; font-size: 12.5px; color: var(--chat-text); }

.btn:disabled,
.btn.disabled { opacity: .4; pointer-events: none; }

/* ---------- 投稿者情報（中央寄せの縦並び。外部設計書 スライド10） ---------- */
.profile { text-align: center; padding: 8px 0 2px; }
.profile .nm { display: block; font-size: 15px; letter-spacing: .14em; margin-top: 12px; }
.profile .kana { display: block; font-size: 12.5px; letter-spacing: .14em; color: var(--chat-text); margin-top: 3px; }
.profile .corp { display: block; font-size: 13px; letter-spacing: .1em; margin-top: 14px; }
.profile .greeting { margin: 14px 0 0; font-size: 12.5px; color: var(--chat-text); line-height: 1.85; letter-spacing: .04em; text-align: left; white-space: pre-wrap; }

/* 名刺・電話・メール／トーク・ピン留め の3列折返し */
.profile-actions { display: flex; flex-wrap: wrap; gap: 10px 8px; margin-top: 18px; }
.profile-actions .anchor { flex: 0 0 calc(33.333% - 6px); }

/* ---------- 設定（アバター選択）。ラベルと選択リンクを同じ行に並べ（ラベルが左、リンクが右）、
   その下にアバターを中央表示する（外部設計書 スライド14） ---------- */
.avatar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}
.avatar-head .lb { flex: 0 1 auto; min-width: 0; white-space: nowrap; }

/* label は a 要素ではないため、本体 Anchor（a.anchor）と同じ見た目を明示する */
.avatar-picker .anchor {
    flex: 0 0 auto;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #0071c1;
    fill: #0071c1;
    cursor: pointer;
    margin-bottom: 0;
    font-weight: normal;
}
.avatar-picker .anchor input[type="file"] { display: none; }
.avatar-preview { display: flex; justify-content: center; margin: 14px 0 4px; }

/* ---------- 設定（通知）。ブラウザ版のみ（仕様追加。UI設計書 4.4） ---------- */
.notification-setting { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--chat-line); }
.notification-setting h3 { margin: 0 0 10px; font-size: 13px; font-weight: bold; }
.notification-setting .hint { margin: -4px 0 10px; font-size: 12.5px; color: var(--chat-text); }
.notification-setting .notification-status[data-state="blocked"] { color: var(--chat-danger, #c0392b); }
.notification-setting .notification-test { margin: 0 0 10px; font-size: 12.5px; color: var(--chat-text); }

/* 投稿者アイコンはクリックできる（投稿者情報を開く） */
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; line-height: 0; }

img.avatar { object-fit: cover; }

.read-list-items { list-style: none; margin: 0; padding: 0; }

.read-list-items li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.read-list-items .nm { flex: 1; }
.read-list-items .tm { color: var(--chat-text-sub); font-size: 11px; }

/* ---------- PostEditor ---------- */
/* 下端には安全領域（ホームインジケーター。App.UI の app-shell.css の --app-safe-bottom）の分の余白を取り、入力欄・送信などのボタンを
   その上に出す（UI設計書 4.3 PostEditor。決定 Q41・修正候補 No.51）。本文（AfMainLayout の article）の下の余白 20px と合わせて、
   入力欄の下端を安全領域の上端から 8px 上に置く（iPhone の 34pt で 22px を足す）。安全領域が 12px 以下の画面・キーボードの表示中は 0 で変わらない */
.post-editor {
    flex: 0 0 auto;
    padding: 10px 0 0;
    padding-bottom: max(0px, calc(var(--app-safe-bottom, 0px) - 12px));
}

/* 入力欄の初期の高さは 1 行分（font-size 12.5px × line-height 1.6 = 20px ＋ 上下 padding 16px ＋ 枠線 2px）。
   アイコン（.ebtn）は下揃えのまま下に (1 行分の高さ − アイコンの高さ) / 2 の余白を付け、
   1 行のときは入力欄と上下中央で揃い、行が増えて入力欄が上へ伸びても位置が変わらないようにする */
.editor-row {
    --editor-line-height: 38px;
    --editor-icon-size: 26px;
    display: flex;
    align-items: flex-end;
    gap: 14px;
}

.editor-row textarea {
    flex: 1;
    resize: none;
    font: inherit;
    font-size: 12.5px;
    line-height: 1.6;
    padding: 8px 12px;
    border: 1px solid #BFBFBF;
    border-radius: 2px;
    background: #fff;
    box-sizing: border-box;
    min-height: var(--editor-line-height);  /* 1 行分（padding・枠線込み） */
    max-height: 168px;
    /* 枠が低いとき（iPhone の Safari の横向きでキーボードが無いと見えている範囲は 292px）は、上限を枠に収まる高さに抑える（修正候補 No.170）。
       枠（App.UI の --app-height）から、入力欄の上下に要る高さ 170px（ヘッダー 50・本文の上下の余白 20 ずつ・見出し行とその下の余白
       （iPhone の Safari の横向きの実測で計 54）・入力部の上の余白 10・タイムラインに残す 16）と下端の安全領域の分を除く。
       入力欄の下の案内（.editor-hint。失敗・超過のときだけ出る 1 行）の高さは含めず、出ている間はその分だけタイムラインが縮むか下端が見切れる。
       1 行分を下限とし、168px を超えない。枠が 338px 以上（縦向き・PC・キーボードを閉じた 390px 以上の横向き）では 168px のまま。
       キーボードの表示中で枠が低い間は、下の data-app-short・data-app-tiny の規則が優先する */
    max-height: max(var(--editor-line-height), min(168px, calc(var(--app-height, 100vh) - 170px - max(0px, calc(var(--app-safe-bottom, 0px) - 12px)))));
    overflow-y: auto;
}

.editor-row textarea:focus { outline: none; border-color: var(--chat-navy); }

/* 編集モードは投稿内容入力欄の背景を黄色にする（UI設計書 4.3 PostEditor / 6章 --chat-bubble-edit） */
.post-editor.editing .editor-row textarea { background: var(--chat-bubble-edit); }

/* 読み込み中（トークルームの切り替え中）は入力欄ごと薄く表示し、操作できなくする */
.post-editor.disabled { opacity: .5; }
.post-editor.disabled .editor-row textarea {
    background: #fff !important;
    cursor: not-allowed;
}

/* 送信・内線通知・ファイルアップロード・編集の取り消し（×）のアイコンは共通の Anchor と同じ青 */
.ebtn {
    width: var(--editor-icon-size, 26px);
    height: var(--editor-icon-size, 26px);
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
    margin: 0; /* reboot の label { margin-bottom: .5rem } を打ち消す（アップロードは label） */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0071c1;
    fill: #0071c1;
}

.ebtn svg { width: 19px; height: 19px; }

/* ホバーは Anchor（本体 app.css の a:hover）と同じく明るくする。ホバーのある端末だけ（タッチ端末ではタップの後も
   :hover が残り、送信などのアイコンが明るいままになるため。修正候補 No.92） */
@media (hover: hover) {
    .ebtn:hover { filter: brightness(1.3); }
}

/* 使えないとき（空の送信・読み込み中など）は Anchor の無効と同じ薄さ（opacity .6）。
   本体グローバル CSS の *[disabled] { background:#eee !important } 等への対抗で色も明示する */
.ebtn:disabled {
    background: transparent !important;
    color: #0071c1 !important;
    -webkit-text-fill-color: #0071c1 !important;
    opacity: .6;
    cursor: not-allowed;
    filter: none;
}

/* 入力部の行の中のアイコンだけに下余白を付ける。.ebtn の margin: 0 より詳細度が高いため、
   アップロード（label.ebtn.upload）にも効く */
.editor-row > .ebtn {
    flex: 0 0 auto;
    margin-bottom: calc((var(--editor-line-height) - var(--editor-icon-size)) / 2);
}

/* ファイル選択は label で包み、既定の input を隠してアイコンだけを見せる */
.ebtn.upload { position: relative; overflow: hidden; }

.ebtn.upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* 読み込み中（Disabled）はファイルアップロードを使えない */
.ebtn.upload.disabled { opacity: .6; cursor: not-allowed; }
@media (hover: hover) {
    .ebtn.upload.disabled:hover { filter: none; }
}
.ebtn.upload.disabled input[type="file"] { cursor: not-allowed; }

/* アップロードの応答待ち（修正候補 No.95）。アイコンに代えてスピナーを出し、薄くしない（送信中と分かるように） */
.ebtn.upload.busy { opacity: 1; cursor: progress; }
.ebtn.upload.busy input[type="file"] { cursor: progress; }

.ebtn-spinner {
    display: block;
    width: 17px;
    height: 17px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid var(--chat-line);
    border-top-color: #0071c1;
    animation: tl-spin .8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .ebtn-spinner { animation: none; }
}

/* 入力欄の下の案内（アップロード・送信の失敗、本文の上限文字数の超過）。出ている間だけ表示する。
   操作の説明（Shift+Enter・Esc）の行は出さない（編集の取り消しは「×」のボタンで行う） */
.editor-hint {
    font-size: 10.5px;
    padding: 7px 0 0;
}

.editor-hint.editor-error { color: var(--chat-badge); }

/* 枠が低い間（App.UI の viewport-height.js が付ける data-app-short。スマホの横向きでキーボードを開くと、見えている範囲は
   Android で約 107px、iPhone で約 153pt）は、入力欄を見出し行より優先して見せる（UI設計書 4.3 PostEditor。修正候補 No.108）。
   トークルームの見出し行（トーク名・検索・グループ設定）を畳み、タイムラインの下の余白・入力部の上の余白を詰める
   （本文の上下の余白は AfMainLayout が詰める）。入力欄の上限の高さは、枠からヘッダー（50px）と詰めた余白（本文の上下 4px ずつと
   入力部の上 4px）を除いた高さにし（通常の上限 168px は超えない）、超えた分は入力欄の中でスクロールする。ヘッダーは見えたまま（App.UI設計書 4.1）。
   見出し行は Bootstrap の d-flex（display: flex !important）のため !important で畳む。キーボードを閉じれば元に戻る */
html[data-app-short] .talk-room > .d-flex:has(> h2[data-testid="talk-room-title"]) { display: none !important; }
html[data-app-short] .post-timeline { padding-bottom: 0; }
html[data-app-short] .post-editor { padding-top: 4px; }
html[data-app-short] .editor-row textarea {
    max-height: max(var(--editor-line-height), min(168px, calc(var(--app-height, 100vh) - 50px - 12px)));
}
/* 枠がさらに低い間（App.UI の data-app-tiny。iPhone の Safari の横向きでキーボードを開くと約 43pt）は、AfMainLayout がヘッダーも畳み、
   本文の上の余白を 0・下の余白を 2px に詰める。入力部の上の余白も 2px に詰め、入力欄の上限の高さを枠から詰めた余白（計 4px）を除いた高さにする
   （1 行分の 38px を下限とし、43pt では入力欄の 1 行分（38 ＋ 余白 4 ＝ 42px）と送信ボタンが収まる。修正候補 No.164） */
html[data-app-tiny] .post-editor { padding-top: 2px; }
html[data-app-tiny] .editor-row textarea {
    max-height: max(var(--editor-line-height), min(168px, calc(var(--app-height, 100vh) - 4px)));
}

/* ---------- スクロールバー ---------- */
.talk-list::-webkit-scrollbar,
.post-timeline::-webkit-scrollbar { width: 7px; }

.talk-list::-webkit-scrollbar-thumb,
.post-timeline::-webkit-scrollbar-thumb {
    background: var(--chat-navy);
    border-radius: 4px;
}

/* ---------- 接続状態のバナー（M8 / PWA） ---------- */
.connection-banner {
    flex: 0 0 auto;
    padding: 5px 18px;
    font-size: 11.5px;
    text-align: center;
}

.connection-banner.offline { background: #FDECEA; color: var(--chat-badge); }

/* 再接続が 10 秒続いた・接続を試みるのをやめた: 覆いの代わりの帯（下の画面を操作できる）。「再試行」を文言の右に置く（UI設計書 4.1。決定 Q20） */
.connection-banner.reconnecting {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 10px;
    background: #FFF4E5;
    color: var(--chat-text);
}

.connection-retry {
    padding: 2px 6px;
    border: 0;
    background: none;
    color: var(--chat-link);
    font: inherit;
    cursor: pointer;
}

@media (hover: hover) { .connection-retry:hover { text-decoration: underline; } }

/* 接続中・再接続中: ページ領域の中央に本体 Spinner をオーバーレイ表示（モックと同値）。
   基準は本体レイアウトの article（Drawer の Cover と同じ。ヘッダー下の全域を覆う）。
   5 秒続いたら Spinner の下に文言を添える（決定 Q20） */
.conn-overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, .55);
}

.conn-overlay-message {
    margin: 0;
    font-size: 12.5px;
    color: var(--chat-text);
}

/* ---------- 認証パネル（ログイン・ログアウト後など。UI設計書 4.7） ----------
   背景・影・枠は付けない（白い画面に中身だけを置く）。
   中身は幅 100%・最大 360px の列を水平中央に置き、各要素は中央揃え。
   タイトルの位置は全状態で共通にするため、上下中央にせず上端から 128px に固定する。 */
.auth-panel {
    min-height: 100%;
    box-sizing: border-box;
    padding: 128px 16px 32px;
    background: #fff;
}

.auth-panel-column {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    text-align: center;
}

/* 「Logichat2」の文字の中心を画面の水平中央に置くため、中央列に文字・左列にアイコンを置く */
.auth-panel-title {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    column-gap: 4px;
    align-items: center;
    margin-bottom: 22px;
}

.auth-panel-logo {
    grid-column: 1;
    justify-self: end;
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

.auth-panel-app-name {
    grid-column: 2;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--chat-navy);
    letter-spacing: .04em;
}

.auth-panel-status {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-panel-status.success { background: #E3F1E6; color: #2E7D46; }
.auth-panel-status.error { background: #FBE5E5; color: var(--chat-badge); }

/* スピンナーの上下の余白はともに 24px（タイトルの下の 22px に 2px を足す）。
   上の 2px を margin にするとタイトルの margin-bottom と相殺されて 22px になるため padding で足す */
.auth-panel-spinner {
    display: flex;
    justify-content: center;
    margin: 0 0 24px;
    padding-top: 2px;
}

.auth-panel-heading {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--chat-text);
}

.auth-panel-description {
    margin: 0 0 20px;
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--chat-text-sub);
}

.auth-panel-detail {
    margin: 0 0 20px;
    padding: 8px 10px;
    font-size: 11.5px;
    line-height: 1.6;
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #F5F5F5;
    border-left: 3px solid var(--chat-badge);
    color: var(--chat-text);
}

.auth-panel-button {
    display: block;
    width: 100%;
    padding: 10px 0;
    border: none;
    border-radius: 3px;
    background: var(--chat-navy);
    color: #fff;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

@media (hover: hover) { .auth-panel-button:hover { background: var(--chat-navy-selected); } }
.auth-panel-button:disabled { opacity: .6; cursor: default; }

/* 起動時の読み込み中の画面（UI設計書 4.7 StartupScreen / 修正候補 No.17）。
   ホストの index.html の起動中の表示（静的な HTML）も同じクラスで描き、差し替わりが見えないようにする。
   画面全体に重ね、準備中の画面（ヘッダー・サイドメニュー・本文）は見えないようにする。
   Blazor のエラー表示（#blazor-error-ui。z-index 1000）は上に出す */
.startup-screen {
    position: fixed;
    inset: 0;
    z-index: 900;
    overflow-y: auto;
    background: #fff;
}

.startup-content.is-starting {
    visibility: hidden;
}

/* スタブ認証の利用者一覧（開発・E2E 用） */
.auth-panel-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
