/* ============================================================
   CSV CONSULTING LIMITED — AI相談窓口チャットウィジェット
   配色・書体はサイト本体（style.css）に準拠。装飾は最小限。
   ============================================================ */

.cw-btn{
  position:fixed; right:20px; bottom:20px; z-index:55;
  width:52px; height:52px; border-radius:50%;
  background:#1e2a3a;
  border:1px solid rgba(255,255,255,.25);
  cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 2px 10px rgba(20,28,40,.18);
  transition:background .3s;
}
.cw-btn:hover{ background:#2b3a4e; }
.cw-btn svg{ width:22px; height:22px; stroke:#fff; fill:none; stroke-width:1.5; }

.cw-panel{
  position:fixed; right:20px; bottom:86px; z-index:55;
  width:340px; max-width:calc(100vw - 32px);
  background:#fbfaf7;
  border:1px solid #d8d4ca;
  display:flex; flex-direction:column;
  box-shadow:0 6px 28px rgba(20,28,40,.16);
  opacity:0; transform:translateY(8px);
  visibility:hidden;
  transition:opacity .25s ease, transform .25s ease, visibility .25s;
}
.cw-panel.open{ opacity:1; transform:none; visibility:visible; }

.cw-head{
  background:#1e2a3a; color:#fff;
  padding:14px 16px;
  display:flex; justify-content:space-between; align-items:center;
}
.cw-head b{
  font-family:'Shippori Mincho','Hiragino Mincho ProN',serif;
  font-weight:600; font-size:15px; letter-spacing:.14em;
  display:block;
}
.cw-head small{ font-size:10px; letter-spacing:.2em; color:rgba(255,255,255,.65); }
.cw-x{
  color:rgba(255,255,255,.7); font-size:16px; line-height:1;
  background:none; border:none; cursor:pointer; padding:4px;
}
.cw-x:hover{ color:#fff; }

.cw-log{
  padding:16px; overflow-y:auto;
  height:min(400px, calc(100vh - 300px));
  height:min(400px, calc(100dvh - 300px));
  display:flex; flex-direction:column; gap:10px;
}
.cw-m{
  max-width:82%; padding:10px 14px;
  font-size:13.5px; line-height:1.7; letter-spacing:.02em;
  white-space:pre-wrap; word-break:break-word;
}
.cw-bot{ align-self:flex-start; background:#fff; border:1px solid #e4e1d9; color:#33383f; }
.cw-bot a{ color:#1e2a3a; word-break:break-all; }
.cw-user{ align-self:flex-end; background:#1e2a3a; color:#fff; }


.cw-form{ border-top:1px solid #e4e1d9; display:flex; align-items:flex-end; background:#fff; }
.cw-form textarea{
  flex:1; border:none; background:none;
  padding:14px; font-size:16px; font-family:inherit;
  color:#33383f; outline:none; min-width:0;
  line-height:1.6; resize:none; overflow-y:hidden;
  max-height:118px;
}
.cw-form textarea:focus-visible{ outline:2px solid #9c4a2a; outline-offset:-2px; }
.cw-send{
  border:none; background:#1e2a3a; color:#fff;
  font-size:13px; letter-spacing:.14em;
  padding:15px 20px; cursor:pointer; font-family:inherit;
  flex-shrink:0;
}
.cw-send:disabled{ opacity:.45; cursor:default; }

.cw-note{
  font-size:11px; color:#83817a; text-align:center;
  padding:12px 12px 14px; letter-spacing:.06em;
  background:#fbfaf7;
}

@media (max-width:768px){
  .cw-btn{ right:16px; bottom:16px; width:48px; height:48px; }
  .cw-panel{
    right:16px; bottom:76px;
    /* パネル全体で画面の約9割。上端は最低16px確保してはみ出し防止 */
    height:min(90vh, calc(100vh - 92px));
    height:min(90dvh, calc(100dvh - 92px));
  }
  .cw-head,.cw-form,.cw-note{ flex-shrink:0; }
  .cw-log{ height:auto; flex:1; min-height:0; }
}

@media (prefers-reduced-motion: reduce){
  .cw-panel{ transition:none; }
  .cw-btn{ transition:none; }
}
