/* 社内FAQチャットボットの体験版。色は common/base.css のトークンだけを使う */
.faq { display: grid; grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); background: var(--paper); }
.side { min-height: 0; overflow-y: auto; padding: 16px 16px 24px; border-right: 1px solid var(--line-2); background: var(--surface); display: grid; gap: 22px; align-content: start; }
.side h2 { font-size: 13px; font-weight: 800; color: var(--ink-2); letter-spacing: .04em; margin-bottom: 8px; }
.side-sub { font-size: 12.5px; color: var(--ink-3); margin: -4px 0 8px; }
.ex-list { display: grid; gap: 8px; }
.ex-q { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; border: 1.5px solid var(--line-2); border-radius: var(--r-m); background: var(--surface); text-align: left; font-size: 14px; font-weight: 600; line-height: 1.5; min-height: 48px; }
.ex-q:hover { background: var(--paper); border-color: var(--brand-2); }
.ex-q .chip { height: 22px; font-size: 11.5px; }
.doc-list { list-style: none; display: grid; gap: 2px; }
.doc-list button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-s); text-align: left; font-size: 14px; min-height: 40px; }
.doc-list button:hover { background: var(--sunken); }
.doc-list small { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); flex: none; }
.bot-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; flex: none; }
.chat-head > div { min-width: 0; flex: 1; }
.chat-head b { display: block; font-size: 16px; font-weight: 800; line-height: 1.3; }
.chat-head span:not(.bot-mark) { display: block; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctrl-link { font-size: 12.5px; font-weight: 600; color: var(--brand-2); min-height: 28px; text-decoration: underline; text-underline-offset: 3px; flex: none; }
#btnDocs { display: none; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 20px 12px; display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: min(640px, 92%); padding: 11px 15px; border-radius: 4px var(--r-l) var(--r-l) var(--r-l); background: var(--surface); border: 1px solid var(--line); font-size: 15px; line-height: 1.75; box-shadow: var(--shadow-s); overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--brand); border-color: var(--brand); color: #fff; border-radius: var(--r-l) 4px var(--r-l) var(--r-l); box-shadow: none; }
.bubble.warn { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.bubble.none { background: var(--sunken); }
.msg.fresh .bubble { animation: pop .3s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.note { margin-bottom: 8px; padding: 6px 10px; border-radius: var(--r-s); background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn); font-size: 13px; line-height: 1.6; }
.ans { white-space: pre-line; }
.srcs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.srcs b { font-size: 12.5px; color: var(--ink-2); }
.src-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 11px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-2); font-size: 13px; font-weight: 600; text-align: left; line-height: 1.4; }
.src-chip:hover { background: var(--accent-soft); color: var(--accent-deep); }
.src-chip .ico { width: 15px; height: 15px; }
.mode { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.how { margin-top: 8px; font-size: 13px; }
.how summary { cursor: pointer; color: var(--brand-2); font-weight: 600; min-height: 28px; display: block; padding: 3px 0; }
.how ol { list-style: none; margin-top: 6px; display: grid; gap: 8px; padding: 10px 12px; background: var(--paper); border-radius: var(--r-s); color: var(--ink-2); }
.how li b { display: block; font-size: 12.5px; color: var(--ink); }
.how li span { display: block; line-height: 1.6; }
.bubble.warn .how ol { background: rgba(255, 255, 255, .6); }
.typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: dot 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-4px); opacity: .5; } }
.chips { display: none; gap: 8px; overflow-x: auto; padding: 8px 14px; background: var(--surface); border-top: 1px solid var(--line); flex: none; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-q { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.composer { display: flex; gap: 10px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); flex: none; }
.composer input { flex: 1; min-width: 0; height: 46px; padding: 0 16px; border: 1.5px solid var(--line-2); border-radius: 999px; background: var(--paper); font-size: 16px; }
.composer input:focus { outline: none; border-color: var(--brand-2); background: #fff; }
.composer .btn { min-width: 84px; height: 46px; border-radius: 999px; }

/* 資料の表示 */
.dlg { position: fixed; inset: 0; z-index: 900; background: rgba(12, 24, 32, .5); display: grid; place-items: center; padding: 16px; }
.dlg-box { width: min(560px, 100%); max-height: min(78vh, 640px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-l); overflow: hidden; }
.dlg-box header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-box header b { font-size: 16px; }
.dlg-x { width: 36px; height: 36px; border-radius: 8px; font-size: 22px; color: var(--ink-3); }
.dlg-x:hover { background: var(--sunken); }
.dlg-body { overflow-y: auto; padding: 14px 18px 20px; display: grid; gap: 12px; }
.dlg-doc { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dlg-doc span { font-size: 12px; color: var(--ink-3); }
.dlg-note { font-size: 12.5px; color: var(--ink-3); }
.sec { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--paper); }
.sec.hl { border-color: var(--accent); background: var(--accent-soft); }
.sec h3 { font-size: 14.5px; font-weight: 800; margin-bottom: 4px; }
.sec p { white-space: pre-line; font-size: 14px; line-height: 1.75; color: var(--ink-2); }
.dlg-docs { list-style: none; display: grid; gap: 6px; }
.dlg-docs button { width: 100%; text-align: left; padding: 11px 14px; border: 1.5px solid var(--line-2); border-radius: var(--r-s); font-weight: 600; min-height: 46px; }

@media (max-width: 899px) {
  .faq { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .chips { display: flex; }
  #btnDocs { display: inline-flex; }
  .chat-head { padding: 10px 14px; gap: 10px; }
  .chat-head span:not(.bot-mark) { display: none; }
  .chat-log { padding: 14px 14px 10px; }
  .composer { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  #btnClear { display: none; }
}
@media (max-width: 640px) {
  .bubble { max-width: 94%; font-size: 14.5px; }
  .dlg { place-items: end center; padding: 0; }
  .dlg-box { border-radius: var(--r-l) var(--r-l) 0 0; max-height: 82vh; }
}

.how-q { display: block; font-weight: 500; font-size: 12px; color: var(--ink-3); }
.how-for { margin: 6px 0 4px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
