/* AIチャット（お問い合わせ）。setup.html の .setup-contact-dialog と index.html の #ovAboutDetail
   の両方から、同じマークアップ・同じクラス名で描画される。どちらの画面にも --panel / --border / --text /
   --text-dim / --accent / --accent-soft が定義されているため、色はそれらだけを参照して自然に合わせる。 */
/* 高さは会話の量に合わせて伸び、外側のモーダルの上限（画面の85%）に達したら会話欄だけがスクロールする。
   入力欄は常に下に残る。 */
.ai-chat{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;white-space:normal}
.ai-chat-banner{margin:0 0 10px;padding:8px 10px;border:1px solid var(--border);border-radius:8px;
  background:rgba(245,166,35,.1);color:var(--text-dim);font-size:11px;line-height:1.6}

.ai-chat-messages{flex:1 1 auto;min-height:200px;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:18px;padding:2px 2px 2px 0}
.ai-chat-msg{display:flex;align-items:flex-end;gap:6px}
.ai-chat-msg--ai{justify-content:flex-start}
.ai-chat-msg--user{justify-content:flex-end}
.ai-chat-bubble{max-width:82%;padding:10px 14px;border-radius:14px;font-size:14px;line-height:1.75;word-break:break-word}
.ai-chat-msg--ai .ai-chat-bubble{background:var(--panel);border:1px solid var(--border);color:var(--text);border-bottom-left-radius:4px}
.ai-chat-msg--user .ai-chat-bubble{background:var(--accent);color:#fff;border-bottom-right-radius:4px}
.ai-chat-bubble code{background:rgba(127,127,127,.22);border-radius:4px;padding:1px 5px;font-size:12px}
.ai-chat-bubble .ai-chat-code{margin:6px 0 0;padding:8px 10px;background:rgba(0,0,0,.25);border-radius:8px;
  font-size:12px;white-space:pre-wrap;word-break:break-word;overflow-x:auto}
.ai-chat-msg--user .ai-chat-bubble a{color:#fff;text-decoration:underline}
.ai-chat-msg--ai .ai-chat-bubble a{color:var(--accent)}

.ai-chat-typing{display:flex;gap:4px;align-items:center;padding:11px 14px}
.ai-chat-typing span{width:6px;height:6px;border-radius:50%;background:var(--text-dim);display:inline-block;animation:ai-chat-bounce 1.1s infinite ease-in-out}
.ai-chat-typing span:nth-child(2){animation-delay:.15s}
.ai-chat-typing span:nth-child(3){animation-delay:.3s}
@keyframes ai-chat-bounce{0%,80%,100%{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}

.ai-chat-msg-attachments{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.ai-chat-chips{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0 0}
.ai-chat-chip{display:inline-flex;align-items:center;gap:6px;max-width:220px;padding:4px 8px;border-radius:999px;
  background:rgba(127,127,127,.14);border:1px solid var(--border);font-size:11px;color:inherit}
.ai-chat-chip img{width:20px;height:20px;border-radius:5px;object-fit:cover;flex:none}
.ai-chat-chip-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ai-chat-chip-remove{background:none;border:0;color:inherit;opacity:.7;cursor:pointer;padding:0 0 0 2px;font-size:13px;line-height:1}
.ai-chat-chip-remove:hover{opacity:1}

.ai-chat-error{margin:8px 0 0;color:var(--down,#ef5350);font-size:11.5px;line-height:1.6}
.ai-chat-error[hidden]{display:none}

.ai-chat-inputrow{flex:none;display:flex;align-items:flex-end;gap:8px;margin-top:10px;padding-top:10px;border-top:1px solid var(--border)}
.ai-chat-attach,.ai-chat-send{flex:none;display:flex;align-items:center;justify-content:center;width:34px;height:34px;
  border-radius:8px;border:1px solid var(--border);background:var(--panel);color:var(--text-dim);cursor:pointer}
.ai-chat-attach:hover{color:var(--text);border-color:var(--accent)}
.ai-chat-attach svg,.ai-chat-send svg{width:17px;height:17px}
.ai-chat-send{background:var(--accent);border-color:var(--accent);color:#fff}
.ai-chat-send:hover{filter:brightness(1.08)}
.ai-chat-send:disabled{opacity:.5;cursor:not-allowed}
.ai-chat-textarea{flex:1;min-width:0;resize:none;max-height:120px;padding:8px 10px;border-radius:8px;
  border:1px solid var(--border);background:var(--panel);color:var(--text);font:inherit;font-size:13px;line-height:1.5}
.ai-chat-textarea:focus-visible{outline:2px solid var(--accent);outline-offset:1px}

@media(max-width:480px){
  .ai-chat-messages{min-height:160px}
  .ai-chat-bubble{max-width:88%}
}
/* A software keyboard can leave very little height. Shrink the conversation,
   rather than clipping the composer outside the modal. */
@media(max-height:550px){.ai-chat-messages{min-height:0}}

.ai-chat-provider{display:flex;align-items:center;gap:4px;margin:0 0 10px;font-size:13px;color:var(--text-dim,#aab5c8);white-space:nowrap}
.qt-head-extra.ai-chat-provider{margin:0 auto 0 18px;min-width:0}
.ai-chat-provider select{max-width:100%;min-width:0;padding:4px 26px 4px 8px;color:inherit;background:var(--bg-panel,#1c2331);border:1px solid #40516a;border-radius:6px;font:inherit}
.ai-chat-handoff-choices{display:flex;gap:8px;flex-wrap:wrap;padding:8px 0}
.ai-chat-handoff-choices[hidden]{display:none}
.ai-chat-handoff-choices button{border:1px solid #6685a9;border-radius:6px;padding:8px 12px;background:#244e7c;color:#fff;cursor:pointer}
.ai-chat-end-notice{position:fixed;z-index:100000;bottom:24px;left:50%;transform:translateX(-50%);max-width:calc(100vw - 24px);padding:12px 18px;background:#244e7c;color:#fff;border-radius:8px;box-shadow:0 4px 16px #0004;font-size:14px}
.ai-chat-time{flex:none;font-size:11px;color:var(--text-dim);font-variant-numeric:tabular-nums;white-space:nowrap;padding-bottom:2px}
.ai-chat-day{align-self:center;margin:4px 0;padding:2px 12px;border-radius:999px;background:rgba(127,127,127,.18);color:var(--text-dim);font-size:11px}
.ai-chat-textarea{font-size:14px}
