/* 発送代行.com — スタッフ対応チャット
   色と書体はサイト本体に合わせる。橙は送信ボタンだけに使う。 */

.chat-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 22px 0 18px;
  border: 1px solid var(--ink); border-radius: 999px;
  background: var(--ink); color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 700; letter-spacing: 0.04em; line-height: 1.4;
  box-shadow: 0 8px 24px rgba(15, 28, 36, 0.22); cursor: pointer;
}
.chat-launcher:hover { background: #22323D; }
.chat-launcher .dot, .chat-status .dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: #4FD18B; }
.chat-launcher small { font-size: 12px; font-weight: 500; letter-spacing: 0.02em; color: #C9D1D6; }
.chat-launcher--off { background: #fff; color: var(--ink); }
.chat-launcher--off:hover { background: var(--tint); }
.chat-launcher--off .dot, .chat-status--off .dot { background: #9AA5AC; }
.chat-launcher--off small { color: var(--sub); }

.chat-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 901;
  display: flex; flex-direction: column;
  width: 372px; max-width: calc(100vw - 16px); height: min(580px, calc(100vh - 40px));
  border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden;
  background: #fff; color: var(--ink);
  box-shadow: 0 16px 48px rgba(15, 28, 36, 0.24);
  font-size: 15px; line-height: 1.75;
}
.chat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 12px 14px 20px; background: var(--ink); color: #fff; }
.chat-head h2 { font-size: 17px; line-height: 1.5; font-weight: 700; letter-spacing: 0.03em; }
.chat-status { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 13px; line-height: 1.6; color: #C9D1D6; }
.chat-status b { font-weight: 700; color: #fff; }
.chat-close { flex: 0 0 44px; width: 44px; height: 44px; margin: -6px 0 0; border: 0; border-radius: 6px; background: none; color: #fff; cursor: pointer; }
.chat-close:hover { background: #22323D; }
.chat-note { padding: 10px 20px; background: var(--tint); font-size: 12px; line-height: 1.7; color: var(--sub); }

.chat-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; }
.chat-sys { align-self: center; max-width: 100%; font-size: 12px; line-height: 1.7; color: var(--sub); text-align: center; }
.chat-msg { display: flex; flex-direction: column; gap: 4px; max-width: 86%; }
.chat-msg .who { font-size: 12px; line-height: 1.5; color: var(--sub); }
/* white-space: pre-wrap ＝ 送られた文章の改行を、そのまま表示する（Slack で改行して書いた返信も、訪問者が入れた改行も） */
.chat-msg .bubble { padding: 10px 14px; border-radius: 12px 12px 12px 4px; background: var(--tint); color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-msg .bubble a { color: var(--ink); font-weight: 700; text-underline-offset: 3px; word-break: break-all; }
.chat-msg .bubble a:hover { color: var(--orange-deep); }
.chat-msg--me { align-self: flex-end; align-items: flex-end; }
.chat-msg--me .bubble { border-radius: 12px 12px 4px 12px; background: var(--ink); color: #fff; }

.chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px 12px 20px; border-top: 1px solid var(--line); }
.chat-compose textarea, .chat-leave textarea, .chat-leave input {
  width: 100%; border: 1px solid #8A969E; border-radius: 6px; background: #fff; color: var(--ink);
  font-family: inherit; font-size: 16px; letter-spacing: 0.02em; line-height: 1.6;
}
.chat-compose textarea { flex: 1 1 auto; min-height: 48px; max-height: 120px; padding: 10px 12px; resize: none; }
.chat-send { flex: 0 0 auto; min-height: 48px; padding: 0 18px; border: 0; border-radius: 6px; background: var(--orange); color: var(--ink); font-family: inherit; font-size: 15px; font-weight: 700; letter-spacing: 0.04em; cursor: pointer; }
.chat-send:hover { background: #FF7F47; }
.chat-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; padding: 0 20px 12px; font-size: 12px; line-height: 1.7; color: var(--sub); }
.chat-hint { white-space: nowrap; }
@media (pointer: coarse) { .chat-hint { display: none; } }
.chat-foot a { font-weight: 700; white-space: nowrap; }

/* 受付時間外・返事がすぐにできないとき：用件と連絡先を預かる */
.chat-leave { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 20px; }
.chat-leave p { color: var(--text); }
.chat-leave label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; line-height: 1.6; }
.chat-leave label span { font-weight: 500; color: var(--sub); }
.chat-leave textarea { min-height: 96px; padding: 10px 12px; resize: vertical; }
.chat-leave input { min-height: 48px; padding: 0 12px; }
.chat-leave .chat-send { width: 100%; min-height: 52px; font-size: 16px; }
.chat-leave .alt { font-size: 13px; line-height: 1.8; color: var(--sub); }

@media (max-width: 600px) {
  .chat-launcher { right: 12px; bottom: 12px; min-height: 48px; padding: 0 18px 0 14px; font-size: 14px; }
  .chat-launcher small { display: none; }
  .chat-panel { right: 8px; left: 8px; bottom: 8px; width: auto; max-width: none; height: calc(100dvh - 16px); }
}
@media print { .chat-launcher, .chat-panel { display: none !important; } }

/* 画面の切り替え・エラー・送信後 */
.chat-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.chat-err { padding: 10px 12px; border-radius: 6px; background: var(--err-bg); color: var(--err); font-size: 13px; line-height: 1.7; }
.chat-done { justify-content: center; text-align: center; }
.chat-done p { font-size: 16px; font-weight: 700; color: var(--ink); }
.chat-send:disabled { opacity: 0.6; cursor: default; }
