/* チャットの骨組み（見た目は各画面で上書き） */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain; }
.chat-empty { margin: auto; opacity: .6; font-size: 14px; }
.chat-day { align-self: center; font-size: 12px; margin: 14px 0 8px; padding: 2px 10px; }
.chat-msg { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; max-width: 100%; }
.chat-msg.cont { margin-top: 2px; }
.chat-msg.mine { justify-content: flex-end; }
.chat-avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; font-size: 14px; }
.chat-msg.cont .chat-avatar { visibility: hidden; height: 0; }
.chat-col { display: flex; flex-direction: column; max-width: min(78%, 520px); min-width: 0; position: relative; }
.chat-msg.mine .chat-col { align-items: flex-end; }
.chat-meta { display: flex; gap: 8px; font-size: 12px; margin-bottom: 3px; align-items: baseline; }
.chat-meta b { font-weight: 600; }
.chat-bubble { padding: 8px 12px; word-break: break-word; display: flex; flex-direction: column; gap: 6px; }
.chat-text { white-space: pre-wrap; line-height: 1.6; }
.chat-text a { color: inherit; text-decoration: underline; }
.chat-img img { display: block; max-width: 100%; max-height: 260px; object-fit: contain; }
.chat-file { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; padding: 8px; min-width: 200px; }
.chat-file-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.chat-file-info { display: flex; flex-direction: column; min-width: 0; }
.chat-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file-size { font-size: 12px; opacity: .7; }
.chat-note { font-size: 11px; opacity: .7; margin-top: 2px; }
.chat-drop { display: none; position: absolute; inset: 0; z-index: 5; place-items: center; font-size: 18px; }
.chat.dragging .chat-drop { display: grid; }
.chat-form { padding: 8px 10px 10px; }
.chat-pending { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-pending:not(:empty) { margin-bottom: 8px; }
.chat-chip { display: flex; align-items: center; gap: 6px; padding: 4px 6px; font-size: 12px; max-width: 220px; }
.chat-chip img { width: 32px; height: 32px; object-fit: cover; }
.chat-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-chip button { border: none; background: none; cursor: pointer; font-size: 16px; color: inherit; }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-row textarea { flex: 1; resize: none; font: inherit; font-size: 16px; line-height: 1.5; padding: 8px 10px; min-height: 40px; max-height: 160px; }
.chat-attach, .chat-send { flex: none; height: 40px; cursor: pointer; font: inherit; }
.chat-attach { width: 40px; display: grid; place-items: center; font-size: 20px; }
.chat-send { padding: 0 16px; }
.chat-hint { font-size: 11px; opacity: .6; margin-top: 6px; }
@media (max-width: 600px) { .chat-hint { display: none; } }

/* 操作メニュー（ホバー / スマホはタップ） */
.chat-tools { display: none; position: absolute; top: -20px; z-index: 3; gap: 1px; padding: 3px; white-space: nowrap; }
.chat-msg.theirs .chat-tools { left: 0; }
.chat-msg.mine .chat-tools { right: 0; }
@media (hover: hover) { .chat-msg:hover .chat-tools { display: flex; } }
.chat-msg.active .chat-tools { display: flex; }
.chat-tools button { border: none; background: none; cursor: pointer; padding: 4px 6px; font-size: 13px; line-height: 1.2; color: inherit; font-family: inherit; }
.chat-tools .chat-tool-emoji { font-size: 16px; font-family: system-ui, sans-serif; }
.chat-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chat-react { font: inherit; font-size: 12px; padding: 1px 8px; cursor: pointer; border-radius: 12px; border: 1px solid; }
.chat-quote { display: flex; flex-direction: column; text-align: left; border: none; border-left: 3px solid; padding: 4px 8px; font: inherit; font-size: 12px; cursor: pointer; color: inherit; background: rgba(0,0,0,.06); max-width: 100%; }
.chat-quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; }
.chat-msg.flash .chat-bubble { outline: 3px solid #ffcd75; outline-offset: 2px; }
.chat-replying { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 6px 8px; margin-bottom: 8px; border-left: 3px solid; }
.chat-replying span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-replying b { margin-right: 8px; }
.chat-replying button { border: none; background: none; cursor: pointer; font-size: 16px; color: inherit; }
