/* Shaavir Live Chat — Phase 2.1 */
/* All vars resolved against Attendance_Board.html theme tokens.
   Light/dark contrast handled automatically because --tx flips with theme. */

.shv-chat-launcher {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--or), var(--or2));
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(245, 166, 35, 0.35), 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 9998;
  font-size: 28px;
  transition: transform 160ms cubic-bezier(0.2, 0.8, 0.3, 1.1), box-shadow 160ms ease;
}
.shv-chat-launcher:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 32px rgba(245, 166, 35, 0.45), 0 6px 16px rgba(0, 0, 0, 0.3);
}
.shv-chat-launcher:active { transform: translateY(0) scale(0.98); }
.shv-chat-launcher.is-visible { display: flex; }

.shv-chat-launcher-badge {
  display: none;
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--co);
  color: #fff;
  border-radius: 50%;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg0);
}
.shv-chat-launcher-badge.is-visible { display: flex; }

.shv-chat-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
html.light-mode .shv-chat-modal { background: rgba(15, 23, 42, 0.42); }
.shv-chat-modal.is-open {
  display: flex;
  animation: shv-chat-modal-fade-in 160ms ease-out;
}
.shv-chat-modal.is-open .shv-chat-panel {
  animation: shv-chat-panel-pop-in 220ms cubic-bezier(0.2, 0.8, 0.3, 1.1);
}

.shv-chat-panel {
  width: 84vw;
  max-width: 1180px;
  height: 82vh;
  background: var(--bg1);
  border: 1px solid var(--bd);
  border-radius: 16px;
  display: flex;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
html.light-mode .shv-chat-panel {
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.04) inset;
}

/* ── Rail (left conversation list) ───────────────────────────── */
.shv-chat-rail {
  width: 288px;
  min-width: 288px;
  border-right: 1px solid var(--bd);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
}

.shv-chat-rail-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--bd);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shv-chat-rail-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--tx);
  letter-spacing: 0.2px;
}

.shv-chat-rail-add-btn {
  background: linear-gradient(135deg, var(--or), var(--or2));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: filter 120ms ease, transform 120ms ease;
  box-shadow: 0 2px 6px rgba(245, 166, 35, 0.25);
}
.shv-chat-rail-add-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.shv-chat-rail-add-btn:active { transform: translateY(0); }

.shv-chat-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.shv-chat-conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 16px);
  margin: 3px 8px;
  padding: 11px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  color: var(--tx);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.shv-chat-conv-item:hover { background: var(--bg3); }
.shv-chat-conv-item.is-active {
  background: var(--ord);
  border-color: var(--or);
}

.shv-chat-conv-body {
  flex: 1;
  min-width: 0;
}
.shv-chat-conv-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shv-chat-conv-preview {
  font-size: 11px;
  color: var(--tx2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shv-chat-conv-unread {
  background: var(--co);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Main pane ───────────────────────────────────────────────── */
.shv-chat-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg1);
  position: relative; /* anchor for new-pill */
  min-width: 0;
}

.shv-chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--bd);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg2);
}

.shv-chat-header-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--tx);
}

.shv-chat-close-btn {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--tx2);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 120ms ease, color 120ms ease;
}
.shv-chat-close-btn:hover {
  background: var(--bg3);
  color: var(--tx);
}

.shv-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.shv-chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--tx2);
  font-size: 14px;
  padding: 40px 20px;
  text-align: center;
}
.shv-chat-empty-icon {
  font-size: 40px;
  margin-bottom: 4px;
  opacity: 0.7;
}

.shv-chat-date-sep {
  align-self: center;
  background: var(--bg2);
  border: 1px solid var(--bd);
  color: var(--tx2);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  margin: 12px 0 6px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.shv-chat-new-pill {
  display: none;
  position: absolute;
  right: 24px;
  bottom: 96px;
  background: linear-gradient(135deg, var(--or), var(--or2));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(245, 166, 35, 0.35);
  z-index: 1;
}
.shv-chat-new-pill.is-visible { display: block; animation: shv-chat-pill-in 200ms ease-out; }

/* ── Composer ────────────────────────────────────────────────── */
.shv-chat-compose-wrap {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--bd);
  background: var(--bg2);
  display: none;
}
.shv-chat-compose-wrap.is-visible { display: block; }

.shv-chat-compose-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.shv-chat-compose-input {
  flex: 1;
  resize: none;
  padding: 11px 14px;
  background: var(--bg1);
  border: 1px solid var(--bd);
  border-radius: 12px;
  color: var(--tx);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  min-height: 42px;
  max-height: 140px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.shv-chat-compose-input::placeholder { color: var(--tx3); }
.shv-chat-compose-input:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--ord);
}

.shv-chat-send-btn {
  background: linear-gradient(135deg, var(--or), var(--or2));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 11px 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease, opacity 120ms ease;
  box-shadow: 0 4px 12px rgba(245, 166, 35, 0.3);
  flex-shrink: 0;
}
.shv-chat-send-btn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.shv-chat-send-btn:active:not(:disabled) { transform: translateY(0); }
.shv-chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Bubbles ─────────────────────────────────────────────────── */
.shv-chat-bubble-row {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  align-items: flex-end;
  animation: shv-chat-bubble-in 180ms cubic-bezier(0.2, 0.8, 0.3, 1.1);
}
.shv-chat-bubble-row.is-own {
  justify-content: flex-end;
}
.shv-chat-bubble-row.is-grouped { margin-top: -6px; }

.shv-chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin-bottom: 2px;
  user-select: none;
}
.shv-chat-bubble-row.is-grouped .shv-chat-avatar {
  visibility: hidden;
}
.shv-chat-bubble-row.is-own .shv-chat-avatar {
  display: none;
}

.shv-chat-bubble {
  max-width: 68%;
  min-width: 92px;
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 9px 13px 8px;
  background: var(--bg2);
  color: var(--tx);
  position: relative;
  word-break: break-word;
}
.shv-chat-bubble.is-own {
  background: linear-gradient(135deg, var(--or), var(--or2));
  color: #fff;
  border-color: transparent;
  border-bottom-right-radius: 4px;
}
.shv-chat-bubble:not(.is-own) {
  border-bottom-left-radius: 4px;
}
.shv-chat-bubble.is-grouped.is-own {
  border-top-right-radius: 4px;
}
.shv-chat-bubble.is-grouped:not(.is-own) {
  border-top-left-radius: 4px;
}

.shv-chat-bubble-meta {
  font-size: 11px;
  color: var(--tx2);
  margin-bottom: 3px;
  font-weight: 500;
}
.shv-chat-bubble.is-own .shv-chat-bubble-meta {
  color: rgba(255, 255, 255, 0.85);
}
.shv-chat-bubble-meta.is-grouped { display: none; }

.shv-chat-bubble-body {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.shv-chat-bubble-body.is-deleted {
  font-style: italic;
  opacity: 0.65;
}

/* Tooltip on hover for grouped messages */
.shv-chat-bubble-tip {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--tx3);
  background: var(--bg2);
  border: 1px solid var(--bd);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 2;
}
.shv-chat-bubble-row:not(.is-own) .shv-chat-bubble-tip {
  right: -8px;
  transform: translate(100%, -50%);
}
.shv-chat-bubble-row.is-own .shv-chat-bubble-tip {
  left: -8px;
  transform: translate(-100%, -50%);
}
.shv-chat-bubble-row:hover .shv-chat-bubble.is-grouped .shv-chat-bubble-tip {
  opacity: 1;
}

/* Action toolbar (delete, react) */
.shv-chat-bubble-tools {
  position: absolute;
  top: -14px;
  display: flex;
  gap: 2px;
  background: var(--bg1);
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 3px 4px;
  opacity: 0;
  transition: opacity 140ms ease;
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.shv-chat-bubble-row:not(.is-own) .shv-chat-bubble-tools { right: -8px; }
.shv-chat-bubble-row.is-own .shv-chat-bubble-tools { left: -8px; }
.shv-chat-bubble:hover .shv-chat-bubble-tools,
.shv-chat-bubble-tools:hover {
  opacity: 1;
  pointer-events: auto;
}

.shv-chat-bubble-tool-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--tx);
  transition: background 100ms ease;
  line-height: 1;
}
.shv-chat-bubble-tool-btn:hover { background: var(--bg3); }
.shv-chat-bubble-tool-btn.is-del { color: var(--co); }

/* Reaction strip below bubble */
.shv-chat-reactions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.shv-chat-bubble-row.is-own .shv-chat-reactions { justify-content: flex-end; }
.shv-chat-reactions:empty { display: none; }

.shv-chat-reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--tx);
  transition: background 100ms ease, border-color 100ms ease;
  user-select: none;
}
.shv-chat-reaction-pill:hover {
  background: var(--bg3);
  border-color: var(--bd2);
}
.shv-chat-reaction-pill.is-mine {
  background: var(--ord);
  border-color: var(--or);
}
.shv-chat-reaction-pill-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--tx2);
}
.shv-chat-reaction-pill.is-mine .shv-chat-reaction-pill-count {
  color: var(--or);
}

/* ── New DM picker ───────────────────────────────────────────── */
.shv-newdm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}
html.light-mode .shv-newdm-overlay { background: rgba(15, 23, 42, 0.42); }
.shv-newdm-overlay.is-open {
  display: flex;
  animation: shv-chat-modal-fade-in 140ms ease-out;
}

.shv-newdm-modal {
  width: 460px;
  max-width: 92vw;
  background: var(--bg1);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  animation: shv-chat-panel-pop-in 200ms cubic-bezier(0.2, 0.8, 0.3, 1.1);
}

.shv-newdm-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--tx);
  margin-bottom: 12px;
}

.shv-newdm-search {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: 10px;
  color: var(--tx);
  font-size: 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.shv-newdm-search::placeholder { color: var(--tx3); }
.shv-newdm-search:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--ord);
}

.shv-newdm-results {
  margin-top: 12px;
  max-height: 320px;
  overflow-y: auto;
}

.shv-newdm-result-row {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 6px;
  text-align: left;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--bg2);
  cursor: pointer;
  color: var(--tx);
  transition: background 120ms ease, border-color 120ms ease;
}
.shv-newdm-result-row:hover {
  background: var(--bg3);
  border-color: var(--or);
}
.shv-newdm-result-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
}
.shv-newdm-result-row-sub {
  font-size: 11px;
  color: var(--tx2);
  margin-top: 2px;
}

.shv-newdm-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.shv-newdm-cancel-btn {
  background: var(--bg2);
  color: var(--tx);
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 120ms ease;
}
.shv-newdm-cancel-btn:hover { background: var(--bg3); }

/* ── Scrollbars ──────────────────────────────────────────────── */
.shv-chat-conv-list::-webkit-scrollbar,
.shv-chat-messages::-webkit-scrollbar,
.shv-newdm-results::-webkit-scrollbar {
  width: 8px;
}
.shv-chat-conv-list::-webkit-scrollbar-track,
.shv-chat-messages::-webkit-scrollbar-track,
.shv-newdm-results::-webkit-scrollbar-track {
  background: transparent;
}
.shv-chat-conv-list::-webkit-scrollbar-thumb,
.shv-chat-messages::-webkit-scrollbar-thumb,
.shv-newdm-results::-webkit-scrollbar-thumb {
  background: var(--bd2);
  border-radius: 4px;
}
.shv-chat-conv-list::-webkit-scrollbar-thumb:hover,
.shv-chat-messages::-webkit-scrollbar-thumb:hover,
.shv-newdm-results::-webkit-scrollbar-thumb:hover {
  background: var(--tx3);
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes shv-chat-modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes shv-chat-panel-pop-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes shv-chat-bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shv-chat-pill-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .shv-chat-modal.is-open,
  .shv-chat-modal.is-open .shv-chat-panel,
  .shv-chat-bubble-row,
  .shv-chat-new-pill.is-visible,
  .shv-newdm-overlay.is-open,
  .shv-newdm-modal {
    animation: none !important;
  }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .shv-chat-panel {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
  }
  .shv-chat-rail {
    width: 240px;
    min-width: 240px;
  }
  .shv-chat-bubble { max-width: 80%; }
}
@media (max-width: 540px) {
  .shv-chat-rail {
    width: 100%;
    min-width: 0;
    display: none;
  }
  .shv-chat-rail.is-mobile-visible {
    display: flex;
  }
}

.shv-chat-conn-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--tl);
  display: inline-block;
  margin-left: 8px;
  transition: background .2s ease;
}
.shv-chat-conn-dot.disconnected { background: var(--co); animation: shvPulse 1.5s ease infinite; }
@keyframes shvPulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) {
  .shv-chat-conn-dot.disconnected { animation: none; }
}

.shv-chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.shv-chat-header-search-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--tx2);
  line-height: 1;
}
.shv-chat-header-search-toggle:hover {
  background: var(--bg3);
  color: var(--tx);
}

.shv-chat-typing-line {
  padding: 4px 16px;
  font-size: 11px;
  color: var(--tx3);
  font-style: italic;
  min-height: 18px;
  transition: opacity 120ms ease;
}
.shv-chat-typing-line:empty { opacity: 0; }
.shv-chat-typing-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 4px;
  vertical-align: middle;
}
.shv-chat-typing-dots span {
  width: 4px; height: 4px;
  background: var(--tx3);
  border-radius: 50%;
  animation: shvTypingDot 1.2s infinite;
}
.shv-chat-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.shv-chat-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes shvTypingDot {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .shv-chat-typing-dots span { animation: none; opacity: 0.6; }
}

.shv-chat-bubble-quote {
  border-left: 3px solid var(--or);
  padding: 4px 8px;
  margin-bottom: 6px;
  background: var(--bg2);
  border-radius: var(--rs);
  font-size: 11px;
  cursor: pointer;
  transition: background 120ms ease;
}
.shv-chat-bubble-quote:hover { background: var(--bg3); }
.shv-chat-bubble.is-own .shv-chat-bubble-quote {
  background: rgba(255,255,255,0.18);
  border-left-color: rgba(255,255,255,0.6);
}
.shv-chat-bubble-quote-sender { font-weight: 600; color: var(--tx2); }
.shv-chat-bubble.is-own .shv-chat-bubble-quote-sender { color: rgba(255,255,255,0.92); }
.shv-chat-bubble-quote-snippet { color: var(--tx3); margin-top: 1px; }
.shv-chat-bubble.is-own .shv-chat-bubble-quote-snippet { color: rgba(255,255,255,0.78); }

.shv-chat-reply-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 0 12px 6px;
  background: var(--bg2);
  border-left: 3px solid var(--or);
  border-radius: var(--rs);
  font-size: 11px;
  color: var(--tx2);
}
.shv-chat-reply-pill .x {
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.shv-chat-reply-pill .x:hover { background: var(--bg3); color: var(--co); }

.is-pulse { animation: shvChatBubblePulse 1.2s ease; }
@keyframes shvChatBubblePulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--ord); }
  50% { box-shadow: 0 0 0 6px var(--ord); }
}

.shv-chat-pins-bar {
  background: var(--bg2);
  border-bottom: 1px solid var(--bd);
  padding: 6px 12px;
  font-size: 11px;
  color: var(--tx2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.shv-chat-pins-bar:hover { background: var(--bg3); }
.shv-chat-pins-list {
  max-height: 240px;
  overflow-y: auto;
  border-bottom: 1px solid var(--bd);
  background: var(--bg1);
}
.shv-chat-pins-list[hidden] { display: none; }
.shv-chat-pin-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--bd);
  cursor: pointer;
  transition: background 120ms ease;
}
.shv-chat-pin-item:hover { background: var(--bg2); }
.shv-chat-pin-item-meta { font-size: 10px; color: var(--tx3); margin-bottom: 2px; }

.shv-chat-bubble.is-pinned::before {
  content: '📌';
  position: absolute;
  top: -6px; right: -4px;
  font-size: 12px;
}

.shv-chat-bubble-react-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}
.shv-chat-picker-divider {
  width: 1px;
  background: var(--bd);
  margin: 2px 4px;
  align-self: stretch;
}
.shv-chat-bubble-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background 120ms ease, transform 120ms ease;
}
.shv-chat-bubble-action-btn:hover { background: var(--bg3); transform: scale(1.18); }

.shv-chat-search-bar {
  padding: 6px 12px;
  border-bottom: 1px solid var(--bd);
  background: var(--bg2);
}
.shv-chat-search-bar[hidden] { display: none; }
.shv-chat-search-input {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg3);
  border: 1px solid var(--bd);
  border-radius: var(--rs);
  color: var(--tx);
  font-size: 12px;
}
.shv-chat-search-input:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 2px var(--ord);
}
.shv-chat-search-count {
  font-size: 10px;
  color: var(--tx3);
  margin-top: 4px;
}
.shv-chat-search-older-btn {
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: var(--rs);
  border: 1px solid var(--bd);
  background: var(--bg3);
  color: var(--tx2);
  cursor: pointer;
}
.shv-chat-search-older-btn:hover { background: var(--bg2); }
.is-search-hidden { display: none !important; }
.shv-chat-bubble-body mark {
  background: var(--ord);
  color: var(--or);
  padding: 0 2px;
  border-radius: 2px;
}
.shv-chat-search-older-sep {
  align-self: center;
  padding: 4px 12px;
  margin: 8px 0;
  background: var(--bg2);
  border: 1px dashed var(--bd);
  border-radius: 999px;
  font-size: 11px;
  color: var(--tx3);
}

.shv-chat-attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 6px;
}
.shv-chat-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: var(--rs);
  font-size: 11px;
  color: var(--tx2);
  max-width: 200px;
}
.shv-chat-attach-chip-img {
  width: 24px; height: 24px;
  object-fit: cover;
  border-radius: 4px;
}
.shv-chat-attach-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shv-chat-attach-chip-x {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  color: var(--tx3);
}
.shv-chat-attach-chip-x:hover { color: var(--co); background: var(--bg3); }

.shv-chat-attach-img {
  max-width: 300px;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--rs);
  margin-top: 6px;
  cursor: pointer;
  display: block;
}
.shv-chat-attach-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-top: 6px;
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: var(--rs);
  font-size: 11px;
  color: var(--tx2);
  text-decoration: none;
  transition: background 120ms ease;
}
.shv-chat-attach-file:hover { background: var(--bg3); }
.shv-chat-attach-name { font-weight: 600; }
.shv-chat-attach-size { color: var(--tx3); }

.shv-chat-pane.is-drop-target::after {
  content: 'Drop to attach';
  position: absolute;
  inset: 12px;
  border: 2px dashed var(--or);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ord);
  color: var(--or);
  font-weight: 600;
  pointer-events: none;
  z-index: 10;
}

.shv-chat-read-indicator {
  font-size: 10px;
  color: var(--tx3);
  margin-top: 2px;
  text-align: right;
}
.shv-chat-read-indicator.is-read { color: var(--or); }
.shv-chat-read-indicator.is-delivered { color: var(--tx2); }
.shv-chat-bubble.is-own .shv-chat-read-indicator { color: rgba(255,255,255,0.7); }
.shv-chat-bubble.is-own .shv-chat-read-indicator.is-read { color: rgba(255,255,255,1); }

.shv-chat-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.shv-chat-attach-btn {
  flex-shrink: 0;
  background: var(--bg3);
  border: 1px solid var(--bd);
  border-radius: var(--rs);
  font-size: 16px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--tx2);
}
.shv-chat-attach-btn:hover { background: var(--bg2); color: var(--tx); }

.shv-chat-pinlimit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shv-chat-pinlimit-overlay[hidden] { display: none; }
.shv-chat-pinlimit-modal {
  background: var(--bg1);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 16px;
  max-width: 360px;
  color: var(--tx);
}
.shv-chat-pinlimit-title { font-size: 13px; margin-bottom: 10px; color: var(--tx2); }
.shv-chat-pinlimit-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.shv-chat-pinlimit-item {
  text-align: left;
  padding: 8px;
  border: 1px solid var(--bd);
  border-radius: var(--rs);
  background: var(--bg2);
  color: var(--tx);
  cursor: pointer;
  font-size: 12px;
}
.shv-chat-pinlimit-item:hover { background: var(--bg3); }
.shv-chat-pinlimit-cancel {
  padding: 6px 12px;
  border-radius: var(--rs);
  border: 1px solid var(--bd);
  background: var(--bg3);
  color: var(--tx2);
  cursor: pointer;
}
