.kkvc-chat{display:flex;gap:12px;border:1px solid #e5e5e5;border-radius:8px;min-height:520px;overflow:hidden;background:#fff}
.kkvc-chat__sidebar{width:32%;min-width:260px;border-right:1px solid #eee;display:flex;flex-direction:column}
.kkvc-chat__sidebar-header{padding:12px;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #eee}
.kkvc-chat__threads{overflow:auto;flex:1}
.kkvc-thread-item{padding:12px;border-bottom:1px solid #f0f0f0;cursor:pointer}
.kkvc-thread-item:hover{background:#fafafa}
.kkvc-thread-item.is-active{background:#f6f6f6}
.kkvc-thread-item small{display:block;opacity:.75;margin-top:4px}
.kkvc-chat__main{flex:1;display:flex;flex-direction:column}
.kkvc-chat__thread-header{padding:12px;border-bottom:1px solid #eee}
.kkvc-chat__messages{padding:12px;overflow:auto;flex:1;display:flex;flex-direction:column-reverse;gap:10px}
.kkvc-msg{max-width:84%;padding:10px 12px;border-radius:12px;border:1px solid #eee;white-space:pre-wrap;line-height:1.35}
.kkvc-msg.is-vendor{align-self:flex-end;background:#f7f7ff;border-color:#e3e3ff}
.kkvc-msg.is-customer{align-self:flex-start;background:#f8fafc;border-color:#e5e7eb}
.kkvc-msg__who{font-size:12px;font-weight:600;opacity:.85;margin-bottom:4px}
.kkvc-msg__body{font-size:14px}
.kkvc-msg__meta{font-size:12px;opacity:.7;margin-top:6px}
.kkvc-chat__composer{display:flex;gap:10px;padding:12px;border-top:1px solid #eee}
.kkvc-chat__composer textarea{flex:1;resize:vertical}
.kkvc-chat__composer button{padding:10px 14px}
.kkvc-badge{background:#111;color:#fff;border-radius:999px;padding:2px 8px;font-size:12px}

/* Responsive */
@media (max-width: 820px){
  .kkvc-chat{flex-direction:column;min-height:unset}
  .kkvc-chat__sidebar{width:100%;min-width:0;border-right:0;border-bottom:1px solid #eee}
  .kkvc-chat__messages{max-height:50vh}
  .kkvc-msg{max-width:100%}
}


.kkvc-thread-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.kkvc-pill{
  display:inline-block;
  min-width:20px;
  padding:2px 6px;
  border-radius:999px;
  font-size:12px;
  line-height:1;
  background:#eee;
  color:#333;
}
.kkvc-order-chat-actions{
  margin-top:20px;
}
.kkvc-order-chat-actions .kkvc-start-chat{
  margin-right:8px;
  margin-bottom:8px;
}

/* Responsive: stack sidebar and chat on smaller screens */
@media (max-width: 860px){
  .kkvc-chat{flex-direction:column;min-height:unset}
  .kkvc-chat__sidebar{width:100%;min-width:0;border-right:0;border-bottom:1px solid #eee;max-height:260px}
  .kkvc-chat__main{min-height:420px}
  .kkvc-chat__messages{max-height:380px}
}

/* My Account "Messages" menu badge */
.kk-message-badge{ position:relative; }
.kk-message-badge > a{ position:relative; }
.kkvc-menu-badge{
  position:absolute;
  top:-6px;
  right:-6px;
  min-width:18px;
  height:18px;
  padding:0 5px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  line-height:18px;
  text-align:center;
  background:#e53935;
  color:#fff !important;
  box-shadow:0 0 0 2px #fff;
z-index: 9999;
}

.kk-message-badge {
  overflow: visible !important;
}

.kkvc-chat__composer input[type="file"]{max-width:220px}
.kkvc-msg__attachments{margin-top:6px;font-size:13px}
.kkvc-msg__attachments a{display:inline-block;margin-right:10px}


/* Attachments input */
.kkvc-chat__composer input[type=file]{max-width:200px;font-size:12px;line-height:1.2}

/* Smarter header */
.kkvc-threadhead{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.kkvc-threadhead__title{font-weight:700}
.kkvc-threadhead__meta{font-size:12px;opacity:.8;margin-top:2px;line-height:1.3}
.kkvc-threadhead__btn{display:inline-flex;align-items:center;gap:6px;padding:8px 10px;border:1px solid #ddd;border-radius:10px;text-decoration:none;font-size:12px;white-space:nowrap}
.kkvc-threadhead__btn:hover{border-color:#bbb}

/* === UI Polish (2.0.14) === */
.kkvc-chat{box-shadow:0 1px 2px rgba(0,0,0,.04)}
.kkvc-chat__thread-header{background:#fafafa}
.kkvc-chat__messages{flex-direction:column;background:#fbfbfb;padding:14px;gap:12px}
.kkvc-msg{background:#fff;border-color:#e6e6e6;box-shadow:0 1px 1px rgba(0,0,0,.03)}
.kkvc-msg.is-vendor{background:#f3f4ff;border-color:#e1e4ff}
.kkvc-msg.is-customer{background:#ffffff;border-color:#e6e6e6}
.kkvc-msg__who{letter-spacing:.2px}
.kkvc-msg__meta{opacity:.6}
.kkvc-chat__composer{background:#fff;align-items:flex-end;flex-wrap:wrap}
.kkvc-chat__composer textarea{
  min-height:44px;
  max-height:140px;
  padding:10px 12px;
  border:1px solid #d9d9d9;
  border-radius:12px;
  outline:none;
}
.kkvc-chat__composer textarea:focus{border-color:#bdbdbd}
.kkvc-chat__composer input[type=file]{
  flex:0 0 auto;
  max-width:240px;
  border:1px solid #d9d9d9;
  border-radius:12px;
  padding:8px 10px;
  background:#fafafa;
}
.kkvc-chat__composer input[type=file]::file-selector-button{
  border:0;
  background:#111;
  color:#fff;
  border-radius:10px;
  padding:6px 10px;
  margin-right:10px;
  cursor:pointer;
}
.kkvc-chat__composer button{
  border-radius:999px;
  border:0;
  padding:12px 18px;
  cursor:pointer;
}
.kkvc-chat__composer button:disabled{opacity:.55;cursor:not-allowed}
.kkvc-msg__attachments a{
  padding:4px 8px;
  border:1px solid #e2e2e2;
  border-radius:999px;
  text-decoration:none;
  background:#fff;
}
.kkvc-msg__attachments a:hover{border-color:#cfcfcf}

/* Embedded chat (Order modal): remove sidebar, tighter height */
.kkvc-chat--embedded{min-height:unset}
.kkvc-chat--embedded .kkvc-chat__sidebar{display:none}
.kkvc-chat--embedded .kkvc-chat__main{min-height:360px}
.kkvc-chat--embedded .kkvc-chat__messages{max-height:360px}
