.sf-live-chat-launcher,
.sf-live-chat-panel {
  --chat-green: #0b7a67;
  --chat-green-dark: #075b4e;
  --chat-mint: #dff4ec;
  --chat-paper: #f8fbfa;
  --chat-ink: #17352e;
  --chat-muted: #6a7c76;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sf-live-chat-launcher {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 1600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 16px 8px 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--chat-green), #10977d);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  box-shadow: 0 14px 38px rgba(4, 67, 56, .3);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.sf-live-chat-launcher:hover,
.sf-live-chat-launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(4, 67, 56, .38);
  outline: none;
}

.sf-live-chat-launcher-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  color: #fff;
  background: rgba(255,255,255,.17);
  border-radius: 50%;
}

.sf-live-chat-launcher-icon svg {
  width: 25px;
  height: 25px;
}

.sf-live-chat-launcher-copy {
  display: grid;
  text-align: left;
  line-height: 1.08;
}

.sf-live-chat-launcher-copy b { font-size: 13px; }
.sf-live-chat-launcher-copy small { margin-top: 4px; color: rgba(255,255,255,.78); font-size: 10px; }

.sf-live-chat-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  color: #fff;
  background: #d74343;
  border: 2px solid #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.sf-live-chat-panel {
  position: fixed;
  left: 20px;
  bottom: 90px;
  z-index: 1599;
  width: min(410px, calc(100vw - 40px));
  height: min(610px, calc(100vh - 120px));
  overflow: hidden;
  color: var(--chat-ink);
  background: #fff;
  border: 1px solid #cbdad5;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(18, 52, 43, .28);
}

.sf-live-chat-panel.admin { width: min(780px, calc(100vw - 40px)); }

.sf-live-chat-panel[hidden] { display: none !important; }

.sf-live-chat-header {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 70px;
  padding: 12px 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--chat-green-dark), var(--chat-green));
}

.sf-live-chat-header-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  background: rgba(255,255,255,.17);
  border: 1px solid rgba(255,255,255,.27);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.sf-live-chat-header-copy {
  display: grid;
  min-width: 0;
  margin-right: auto;
}

.sf-live-chat-header-copy b,
.sf-live-chat-header-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sf-live-chat-header-copy b { font-size: 14px; }
.sf-live-chat-header-copy small { margin-top: 4px; color: rgba(255,255,255,.76); font-size: 10px; }

.sf-live-chat-close {
  width: 36px;
  height: 36px;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 25px;
  cursor: pointer;
}

.sf-live-chat-close:hover { background: rgba(255,255,255,.13); }

.sf-live-chat-body {
  display: grid;
  grid-template-columns: 1fr;
  height: calc(100% - 70px);
  min-height: 0;
}

.sf-live-chat-panel.admin .sf-live-chat-body { grid-template-columns: 250px minmax(0, 1fr); }

.sf-chat-inbox {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  border-right: 1px solid #dbe5e1;
  background: #f4f8f6;
}

.sf-chat-thread-search {
  width: calc(100% - 20px);
  margin: 10px;
  padding: 10px 12px;
  color: var(--chat-ink);
  background: #fff;
  border: 1px solid #cbd9d4;
  border-radius: 10px;
  font: inherit;
  font-size: 12px;
}

.sf-chat-thread-search:focus { border-color: var(--chat-green); outline: 2px solid rgba(11,122,103,.12); }

.sf-chat-thread-list { overflow: auto; padding: 0 7px 10px; }

.sf-chat-thread {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 8px;
  color: var(--chat-ink);
  background: transparent;
  border: 0;
  border-radius: 11px;
  text-align: left;
  cursor: pointer;
}

.sf-chat-thread:hover { background: #e8f1ee; }
.sf-chat-thread.active { background: #dceee8; }

.sf-chat-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  background: var(--chat-green);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.sf-chat-thread-copy,
.sf-chat-thread-meta { display: grid; min-width: 0; }
.sf-chat-thread-copy b,
.sf-chat-thread-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-chat-thread-copy b { font-size: 12px; }
.sf-chat-thread-copy small { margin-top: 3px; color: var(--chat-muted); font-size: 10px; }
.sf-chat-thread-meta { justify-items: end; gap: 5px; }
.sf-chat-thread-meta time { color: var(--chat-muted); font-size: 9px; }
.sf-chat-thread-meta i {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  color: #fff;
  background: var(--chat-green);
  border-radius: 999px;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  line-height: 19px;
  text-align: center;
}

.sf-chat-empty-threads { padding: 16px 10px; color: var(--chat-muted); font-size: 11px; line-height: 1.5; }

.sf-chat-conversation {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  min-width: 0;
  min-height: 0;
  background: #eef3f1;
}

.sf-chat-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  background-color: #eef3f1;
  background-image: radial-gradient(rgba(11,122,103,.055) 1px, transparent 1px);
  background-size: 18px 18px;
  scroll-behavior: smooth;
}

.sf-chat-message-row { display: flex; margin: 6px 0; }
.sf-chat-message-row.own { justify-content: flex-end; }

.sf-chat-bubble {
  position: relative;
  max-width: 82%;
  padding: 9px 11px 7px;
  color: var(--chat-ink);
  background: #fff;
  border-radius: 4px 13px 13px 13px;
  box-shadow: 0 1px 2px rgba(25,55,47,.12);
}

.sf-chat-message-row.own .sf-chat-bubble { background: #d8f1e7; border-radius: 13px 4px 13px 13px; }
.sf-chat-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.45; }
.sf-chat-bubble time { display: block; margin-top: 4px; color: var(--chat-muted); font-size: 8px; text-align: right; }
.sf-chat-sender { display: block; margin-bottom: 4px; color: var(--chat-green); font-size: 9px; }

.sf-chat-day {
  width: max-content;
  margin: 12px auto;
  padding: 4px 9px;
  color: var(--chat-muted);
  background: rgba(255,255,255,.86);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(25,55,47,.08);
  font-size: 9px;
}

.sf-chat-empty {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100%;
  padding: 30px;
  color: var(--chat-muted);
  text-align: center;
}

.sf-chat-empty b { color: var(--chat-ink); font-size: 13px; }
.sf-chat-empty span { max-width: 290px; margin-top: 7px; font-size: 11px; line-height: 1.55; }

.sf-chat-status {
  padding: 8px 12px;
  color: #5b4b1a;
  background: #fff4c9;
  border-top: 1px solid #eddc99;
  font-size: 10px;
}

.sf-chat-status.error { color: #8d2929; background: #fff0f0; border-color: #efc7c7; }

.sf-chat-composer {
  display: grid;
  grid-template-columns: minmax(0,1fr) 42px;
  align-items: end;
  gap: 8px;
  padding: 10px 11px 7px;
  background: #fff;
  border-top: 1px solid #dbe5e1;
}

.sf-chat-composer textarea {
  width: 100%;
  min-height: 40px;
  max-height: 110px;
  resize: vertical;
  padding: 10px 12px;
  color: var(--chat-ink);
  background: var(--chat-paper);
  border: 1px solid #cbd9d4;
  border-radius: 18px;
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
}

.sf-chat-composer textarea:focus { border-color: var(--chat-green); outline: 2px solid rgba(11,122,103,.11); }
.sf-chat-composer textarea:disabled { opacity: .55; cursor: not-allowed; }

.sf-chat-send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #fff;
  background: var(--chat-green);
  border: 0;
  border-radius: 50%;
  font-size: 17px;
  cursor: pointer;
}

.sf-chat-send:disabled { opacity: .42; cursor: not-allowed; }
.sf-chat-send:not(:disabled):hover { background: var(--chat-green-dark); }

.sf-chat-privacy {
  padding: 0 12px 9px;
  color: var(--chat-muted);
  background: #fff;
  font-size: 8px;
  text-align: center;
}

@media (max-width: 720px) {
  .sf-live-chat-launcher {
    left: 14px;
    bottom: 14px;
    min-height: 54px;
    padding: 6px;
  }

  .sf-live-chat-launcher-copy { display: none; }
  .sf-live-chat-launcher-icon { width: 42px; height: 42px; }

  .sf-live-chat-panel,
  .sf-live-chat-panel.admin {
    left: 0;
    bottom: 0;
    width: 100vw;
    height: min(82vh, 720px);
    border: 0;
    border-radius: 18px 18px 0 0;
  }

  .sf-live-chat-panel.admin .sf-live-chat-body { grid-template-columns: 118px minmax(0,1fr); }
  .sf-chat-inbox { min-width: 0; }
  .sf-chat-thread-search { width: calc(100% - 12px); margin: 6px; padding: 8px; font-size: 10px; }
  .sf-chat-thread-list { padding: 0 4px 8px; }
  .sf-chat-thread { grid-template-columns: 32px minmax(0,1fr); gap: 5px; padding: 7px 4px; }
  .sf-chat-avatar { width: 30px; height: 30px; font-size: 9px; }
  .sf-chat-thread-meta { display: none; }
  .sf-chat-thread-copy b { font-size: 10px; }
  .sf-chat-thread-copy small { font-size: 8px; }
  .sf-chat-bubble { max-width: 90%; }
}
