/* ===== tgconsult widget ===== */
#tgconsult-root,
#tgconsult-root * {
  box-sizing: border-box;
}

#tgconsult-root {
  position: fixed;
  left: auto;
  right: auto;
  bottom: var(--tgc-bottom, 70px);
  z-index: 2147483647;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

#tgconsult-root.tgc-pos-right {
  right: var(--tgc-side, 22px) !important;
  left: auto !important;
}

#tgconsult-root.tgc-pos-left {
  left: var(--tgc-side, 22px) !important;
  right: auto !important;
}

#tgconsult-root .tgc-button {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--tgc-color, #0D6EFD);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .2);
  cursor: pointer;
  user-select: none;
}

#tgconsult-root.tgc-pos-left .tgc-button {
  left: 0;
  right: auto;
}

#tgconsult-root .tgc-button svg {
  width: 22px;
  height: 22px;
  display: block;
}

#tgconsult-root .tgc-window {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 360px;
  max-width: calc(100vw - 40px);
  background: #f6f7f9;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
  overflow: hidden;
}

#tgconsult-root.tgc-pos-left .tgc-window {
  left: 0;
  right: auto;
}

#tgconsult-root .tgc-window[hidden] {
  display: none !important;
}

@media (max-width: 480px) {
  #tgconsult-root .tgc-window {
    width: 92vw;
  }
}

#tgconsult-root .tgc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #243a73, #1b2e59);
  padding: 12px 14px;
  color: #fff;
}

#tgconsult-root .tgc-ava {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: block;
}

#tgconsult-root .tgc-title {
  flex: 1;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tgconsult-root .tgc-close {
  background: none;
  border: 0;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

#tgconsult-root .tgc-body {
  height: 320px;
  overflow: auto;
  padding: 14px;
  background: #f5f6f8;
}

#tgconsult-root .tgc-msg {
  padding: 10px 12px;
  border-radius: 14px;
  max-width: 82%;
  margin: 8px 0;
  white-space: pre-wrap;
}

#tgconsult-root .tgc-msg-author {
  font-size: 11px;
  opacity: .75;
  margin-bottom: 4px;
}

#tgconsult-root .tgc-msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}

#tgconsult-root .tgc-msg-text a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#tgconsult-root .tgc-attachment {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

#tgconsult-root .tgc-attachment-preview {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

#tgconsult-root .tgc-attachment-thumb {
  display: block;
  width: 132px;
  max-width: 100%;
  height: 92px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, .35);
}

#tgconsult-root .tgc-attachment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}

#tgconsult-root .tgc-msg-manager .tgc-attachment-card {
  background: #f8fafc;
  border-color: #d9e2ec;
}

#tgconsult-root .tgc-msg-visitor .tgc-attachment-card {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .18);
}

#tgconsult-root .tgc-attachment-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  background: rgba(15, 23, 42, .08);
}

#tgconsult-root .tgc-msg-visitor .tgc-attachment-icon {
  background: rgba(255, 255, 255, .16);
}

#tgconsult-root .tgc-attachment-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#tgconsult-root .tgc-attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#tgconsult-root .tgc-msg-manager {
  background: #fff;
  color: #222;
  border: 1px solid #e5e7eb;
  margin-right: auto;
}

#tgconsult-root .tgc-msg-visitor {
  background: var(--tgc-color, #0D6EFD);
  color: #fff;
  margin-left: auto;
}

#tgconsult-root .tgc-scroll-down {
  position: absolute;
  right: 12px;
  bottom: 128px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: #1f2937;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
}

#tgconsult-root.tgc-pos-left .tgc-scroll-down {
  left: 12px;
  right: auto;
}

#tgconsult-root .tgc-scroll-down[hidden] {
  display: none !important;
}

#tgconsult-root .tgc-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border-top: 1px solid #eee;
}

#tgconsult-root .tgc-form-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#tgconsult-root .tgc-file-input {
  display: none;
}

#tgconsult-root .tgc-attach {
  width: 42px;
  height: 42px;
  border: 1px solid #dfe3e7;
  border-radius: 12px;
  background: #fff;
  color: #425466;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

#tgconsult-root .tgc-attach svg {
  width: 20px;
  height: 20px;
  display: block;
}

#tgconsult-root .tgc-file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #dbe4ee;
  color: #334155;
  font-size: 12px;
}

#tgconsult-root .tgc-file-chip[hidden] {
  display: none !important;
}

#tgconsult-root .tgc-file-chip-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#tgconsult-root .tgc-file-chip-clear {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

#tgconsult-root .tgc-input {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #dfe3e7;
  border-radius: 12px;
  font-size: 14px;
  width: 100%;
}

#tgconsult-root .tgc-send {
  width: 44px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--tgc-color, #0D6EFD);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#tgconsult-root .tgc-hp {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

#tgconsult-root .tgc-image-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .76);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#tgconsult-root .tgc-image-modal[hidden] {
  display: none !important;
}

#tgconsult-root .tgc-image-modal-dialog {
  max-width: min(92vw, 840px);
  max-height: 84vh;
}

#tgconsult-root .tgc-image-modal-img {
  display: block;
  max-width: 100%;
  max-height: 84vh;
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, .34);
  background: #fff;
}

#tgconsult-root .tgc-image-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
