/* Support widget — floating chat для radarshield.mooo.com */
.rs-chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ffb703;
  color: #0d1b2a;
  border: none;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: transform .15s ease, box-shadow .15s ease;
}
.rs-chat-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,0.45); }
.rs-chat-fab:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.rs-chat-fab svg { width: 34px; height: 34px; }
.rs-chat-fab.is-hidden { display: none; }

.rs-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font: 600 12px/20px Inter,system-ui,sans-serif;
  text-align: center;
  display: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.rs-chat-badge.is-on { display: block; }

/* Tooltip-облачко слева от FAB */
.rs-chat-promo {
  position: fixed;
  right: 100px;
  bottom: 32px;
  max-width: 260px;
  background: #12243a;
  color: #eef3f9;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 36px 12px 14px;
  font: 14px/1.4 Inter,system-ui,sans-serif;
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
  cursor: pointer;
  z-index: 9999;
  display: none;
}
.rs-chat-promo.is-on { display: block; animation: rs-promo-in .22s ease-out; }
.rs-chat-promo::after {
  content: '';
  position: absolute;
  right: -7px;
  top: 22px;
  width: 14px;
  height: 14px;
  background: #12243a;
  border-right: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transform: rotate(-45deg);
}
.rs-promo-close {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  color: #7f8fa3;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 0;
}
.rs-promo-close:hover { background: rgba(255,255,255,0.05); color: #eef3f9; }
.rs-promo-close svg { width: 12px; height: 12px; }
@keyframes rs-promo-in {
  from { transform: translateY(6px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@media (max-width: 480px) {
  .rs-chat-promo {
    right: 70px;
    bottom: 20px;
    max-width: calc(100vw - 100px);
    font-size: 13.5px;
  }
}

.rs-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 420px;
  max-width: calc(100vw - 28px);
  height: 640px;
  max-height: calc(100vh - 48px);
  background: #12243a;
  color: #eef3f9;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font: 14px/1.45 Inter,system-ui,sans-serif;
}
.rs-chat-panel.is-open { display: flex; }

.rs-chat-head {
  padding: 14px 16px;
  background: #0d1b2a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.rs-chat-head h4 {
  margin: 0;
  font: 700 15px/1.2 Manrope,system-ui,sans-serif;
  flex: 1;
}
.rs-chat-status {
  font: 500 12px/1 Inter,system-ui,sans-serif;
  color: #b7c4d3;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rs-chat-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7f8fa3;
}
.rs-chat-status.is-online::before { background: #83d043; box-shadow: 0 0 6px rgba(131,208,67,0.6); }
.rs-chat-close {
  background: none;
  border: none;
  color: #b7c4d3;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
}
.rs-chat-close:hover { background: rgba(255,255,255,0.05); color: #eef3f9; }
.rs-chat-close svg { width: 18px; height: 18px; }

.rs-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.rs-chat-body::-webkit-scrollbar { width: 6px; }
.rs-chat-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.rs-chat-msg {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.rs-chat-msg.user {
  align-self: flex-end;
  background: #ffb703;
  color: #0d1b2a;
  border-bottom-right-radius: 4px;
}
.rs-chat-msg.op {
  align-self: flex-start;
  background: rgba(255,255,255,0.06);
  color: #eef3f9;
  border-bottom-left-radius: 4px;
}
.rs-chat-msg.sys {
  align-self: center;
  background: transparent;
  color: #7f8fa3;
  font-size: 12.5px;
  text-align: center;
  padding: 4px 8px;
  max-width: 100%;
}
.rs-chat-msg .ts {
  display: block;
  font: 500 10.5px/1 Inter,system-ui,sans-serif;
  opacity: .65;
  margin-top: 4px;
}

/* Pending-row — миниатюры выбранных файлов до отправки */
.rs-pending-files {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  overflow-x: auto;
  scrollbar-width: thin;
}
.rs-pending-files.is-empty { display: none; }
.rs-pending-item {
  position: relative;
  flex: 0 0 auto;
  min-width: 56px;
  max-width: 200px;
  height: 56px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 22px;
}
.rs-pending-item img { width: 56px; height: 56px; object-fit: cover; display: block; }
.rs-pending-icon { font-size: 22px; padding-left: 10px; }
.rs-pending-name {
  font: 12px/1.3 Inter,system-ui,sans-serif;
  color: #b7c4d3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 4px;
}
.rs-pending-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.rs-pending-remove:hover { background: rgba(0,0,0,0.85); }
.rs-pending-remove svg { width: 11px; height: 11px; }

.rs-chat-foot {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.rs-chat-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  color: #eef3f9;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 9px 12px;
  font: 14px/1.4 Inter,system-ui,sans-serif;
  resize: none;
  max-height: 110px;
  min-height: 38px;
  outline: none;
}
.rs-chat-input:focus { border-color: rgba(255,183,3,0.6); }
.rs-chat-send {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: #ffb703;
  color: #0d1b2a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s ease;
}
.rs-chat-send:disabled { opacity: .4; cursor: not-allowed; }
.rs-chat-send svg { width: 18px; height: 18px; }

.rs-chat-attach {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: #b7c4d3;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.rs-chat-attach:hover { background: rgba(255,255,255,0.08); color: #eef3f9; }
.rs-chat-attach:disabled { opacity: .4; cursor: not-allowed; }
.rs-chat-attach svg { width: 18px; height: 18px; }

.rs-chat-msg.has-file {
  padding: 4px;
  max-width: 72%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rs-chat-msg.has-file .ts { padding: 0 6px 4px; }
.rs-chat-msg.has-file.is-pending { opacity: .55; }
.rs-chat-msg.has-file.is-error { outline: 1px solid #ef4444; outline-offset: -1px; }

.rs-file-caption {
  padding: 2px 6px 4px;
  font: 14px/1.4 Inter,system-ui,sans-serif;
}

.rs-file-batch {
  display: grid;
  gap: 2px;
  border-radius: 10px;
  overflow: hidden;
  max-width: 280px;
}
.rs-file-batch-cell { line-height: 0; }
.rs-file-batch .rs-file-img { border-radius: 0; display: block; }
.rs-file-batch .rs-file-img img {
  max-width: none;
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.rs-file-img {
  display: block;
  line-height: 0;
  border-radius: 10px;
  overflow: hidden;
}
.rs-file-img img {
  display: block;
  width: 100%;
  max-width: 240px;
  max-height: 300px;
  object-fit: cover;
}

.rs-file-doc {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font: 13px/1.3 Inter,system-ui,sans-serif;
}
.rs-chat-msg.user .rs-file-doc { background: rgba(0,0,0,0.08); color: #0d1b2a; }
.rs-file-doc:hover { filter: brightness(1.1); }
.rs-file-icon { font-size: 16px; flex: 0 0 auto; }
.rs-file-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.rs-file-size { opacity: .65; font-size: 11.5px; flex: 0 0 auto; }

@media (max-width: 480px) {
  .rs-chat-fab { right: 14px; bottom: 14px; width: 64px; height: 64px; opacity: .94; }
  .rs-chat-fab svg { width: 30px; height: 30px; }
  .rs-chat-fab:active { opacity: 1; }
  /* Mobile-panel — почти full, но видна верхняя часть сайта (8dvh запас сверху). */
  .rs-chat-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 92dvh;
    max-height: 92dvh;
    border-radius: 14px 14px 0 0;
    border: 1px solid rgba(255,255,255,0.08);
    border-bottom: none;
  }
}

/* Closing card (благодарность + оценка) внизу панели */
.rs-chat-close-card {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 14px;
  display: none;
  flex-direction: column;
  gap: 10px;
  background: rgba(255,255,255,0.02);
}
.rs-chat-close-card.is-on { display: flex; }
.rs-chat-close-card h5 {
  margin: 0;
  font: 700 14px/1.3 Manrope,system-ui,sans-serif;
}
.rs-chat-close-card p {
  margin: 0;
  font: 13px/1.4 Inter,system-ui,sans-serif;
  color: #b7c4d3;
}
.rs-stars {
  display: flex;
  gap: 6px;
  align-items: center;
}
.rs-star {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: #4f5b6c;
  transition: color .12s ease;
}
.rs-star:hover, .rs-star.is-hot { color: #ffb703; }
.rs-star svg { width: 24px; height: 24px; display: block; }
.rs-chat-close-card textarea {
  background: rgba(255,255,255,0.04);
  color: #eef3f9;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 10px;
  font: 13px/1.4 Inter,system-ui,sans-serif;
  resize: vertical;
  min-height: 50px;
  max-height: 120px;
  outline: none;
  display: none;
}
.rs-chat-close-card textarea.is-on { display: block; }
.rs-chat-close-card textarea:focus { border-color: rgba(255,183,3,0.6); }
.rs-close-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.rs-btn {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: #eef3f9;
  font: 600 12.5px/1 Inter,system-ui,sans-serif;
  cursor: pointer;
}
.rs-btn:hover { background: rgba(255,255,255,0.08); }
.rs-btn.primary { background: #ffb703; color: #0d1b2a; border-color: #ffb703; }
.rs-btn.primary:disabled { opacity: .5; cursor: not-allowed; }
.rs-btn.rs-unresolved {
  width: 100%;
  margin-top: 8px;
  background: rgba(255,82,82,0.08);
  border-color: rgba(255,82,82,0.3);
  color: #ff8a80;
}
.rs-btn.rs-unresolved:hover { background: rgba(255,82,82,0.16); }
.rs-btn.rs-unresolved:disabled { opacity: .5; cursor: not-allowed; }

@media (prefers-reduced-motion: no-preference) {
  .rs-chat-panel.is-open { animation: rs-chat-up .18s ease-out; }
  @keyframes rs-chat-up {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }
}

/* Lightbox */
.rs-chat-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .18s ease;
  user-select: none;
}
.rs-chat-lightbox.is-on { opacity: 1; }

.rs-lb-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  z-index: 2;
}
.rs-lb-counter {
  font: 600 15px/1 Inter,system-ui,sans-serif;
  color: rgba(255,255,255,0.85);
}
.rs-lb-actions { display: flex; gap: 10px; }

.rs-lb-close, .rs-lb-download {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s ease;
  text-decoration: none;
}
.rs-lb-close:hover, .rs-lb-download:hover { background: rgba(255,255,255,0.2); }
.rs-lb-close svg, .rs-lb-download svg { width: 22px; height: 22px; }

.rs-lb-img {
  max-width: calc(100% - 64px);
  max-height: calc(100% - 160px);
  object-fit: contain;
  border-radius: 6px;
  display: block;
  z-index: 1;
}

/* Prev / Next стрелки */
.rs-lb-prev, .rs-lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background .12s ease;
}
.rs-lb-prev { left: 12px; }
.rs-lb-next { right: 12px; }
.rs-lb-prev:hover, .rs-lb-next:hover { background: rgba(255,255,255,0.22); }
.rs-lb-prev svg, .rs-lb-next svg { width: 26px; height: 26px; }

/* Thumbnail strip внизу */
.rs-lb-thumbs {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end; /* нижняя граница */
  gap: 10px;
  z-index: 2;
  max-width: 90vw;
  overflow-x: auto;
  padding: 4px 0;
}
.rs-lb-thumb {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.45;
  border: 2px solid transparent;
  transition: all .2s ease;
  padding: 0;
  background: none;
}
.rs-lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rs-lb-thumb span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 20px; }
.rs-lb-thumb.is-active {
  width: 56px; height: 56px;
  opacity: 1;
  border-color: #ffb703;
}

@media (max-width: 480px) {
  .rs-lb-img { max-width: calc(100% - 24px); }
  .rs-lb-prev { left: 4px; }
  .rs-lb-next { right: 4px; }
  .rs-lb-header { padding: 10px 12px; }
}

/* Identity strip — «Вопрос по аккаунту @user?» (Этап 4) */
.rs-identity-strip {
  display: none;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: rgba(255,183,3,0.07);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font: 13px/1.4 Inter,system-ui,sans-serif;
}
.rs-identity-strip.is-on { display: flex; }
.rs-id-q { color: #eef3f9; }
.rs-id-q b { color: #ffb703; }
.rs-id-btns { display: flex; gap: 6px; margin-left: auto; }
.rs-id-yes, .rs-id-no {
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 8px;
  padding: 5px 11px;
  font: 600 12.5px/1 Inter,system-ui,sans-serif;
  cursor: pointer;
  transition: background .12s ease;
}
.rs-id-yes { color: #83d043; }
.rs-id-yes:hover { background: rgba(131,208,67,0.12); }
.rs-id-no { color: #ef6b6b; }
.rs-id-no:hover { background: rgba(239,107,107,0.12); }
