/* OKKwork — боковая панель «Чат с поддержкой» */

:root {
  --okkwork-support-slide-ms: var(--okkwork-profile-slide-ms, 0.4s);
  --okkwork-support-slide-ease: var(--okkwork-profile-slide-ease, ease-in-out);
  --okkwork-support-panel-width: min(720px, 100vw);
}

#okkwork-support-chat-panel,
#okkwork-support-chat-panel .okkwork-support-chat__shell {
  font-family: "Rubik", "Rubik-Medium", system-ui, sans-serif;
  color: rgba(81, 95, 108, 1);
  -webkit-font-smoothing: antialiased;
}

#okkwork-support-chat-panel {
  display: none !important;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#okkwork-support-chat-panel.is-open {
  display: block !important;
  position: fixed !important;
  z-index: 101590 !important;
  inset: 0 !important;
  pointer-events: none !important;
}

#okkwork-support-chat-panel.is-open.is-slide-open,
#okkwork-support-chat-panel.is-open.is-profile-entering {
  pointer-events: auto !important;
}

.okkwork-support-chat__backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(15, 23, 42, 0.22);
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--okkwork-support-slide-ms) var(--okkwork-support-slide-ease);
}

#okkwork-support-chat-panel.is-open.is-slide-open .okkwork-support-chat__backdrop,
#okkwork-support-chat-panel.is-open.is-profile-entering .okkwork-support-chat__backdrop {
  opacity: 1;
}

.okkwork-support-chat__shell {
  position: fixed;
  z-index: 1;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--okkwork-support-panel-width);
  max-width: 100vw;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid rgba(6, 88, 162, 0.16);
  box-shadow: -8px 0 28px rgba(15, 23, 42, 0.12);
  transform: translateX(100%);
  transition: transform var(--okkwork-support-slide-ms) var(--okkwork-support-slide-ease);
  overflow: hidden;
}

#okkwork-support-chat-panel.is-open.is-slide-open .okkwork-support-chat__shell {
  transform: translateX(0);
}

#okkwork-support-chat-panel.is-open.is-profile-leaving .okkwork-support-chat__shell {
  transform: translateX(100%);
}

.okkwork-support-chat__close {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: -42px;
}

.okkwork-support-chat__layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
  min-height: 0;
}

.okkwork-support-chat__sidebar {
  background: #eaf2fa;
  border-right: 1px solid rgba(6, 88, 162, 0.1);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.okkwork-support-chat__sidebar-head {
  padding: 16px 14px 10px;
}

.okkwork-support-chat__sidebar-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #0658a2;
  margin-bottom: 10px;
}

.okkwork-support-chat__new-btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  background: #0658a2;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.okkwork-support-chat__ticket-list {
  flex: 1;
  overflow: auto;
  padding: 0 10px 12px;
}

.okkwork-support-chat__ticket {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  font: inherit;
}

.okkwork-support-chat__ticket.is-active {
  background: #fff;
  border-color: rgba(6, 88, 162, 0.25);
  box-shadow: 0 2px 8px rgba(6, 88, 162, 0.08);
}

.okkwork-support-chat__ticket-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.okkwork-support-chat__ticket-subject {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: #0658a2;
  line-height: 1.3;
  word-break: break-word;
}

.okkwork-support-chat__ticket-status {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.okkwork-support-chat__ticket-status svg {
  width: 20px;
  height: 20px;
  display: block;
}

.okkwork-support-chat__ticket-status--in_progress {
  color: #f39108;
}

.okkwork-support-chat__ticket-status--resolved {
  color: #11bc20;
}

.okkwork-support-chat__ticket-status--unresolved {
  color: #e11d48;
}

.okkwork-support-chat__ticket-meta {
  font-size: 11px;
  color: rgba(81, 95, 108, 0.85);
}

.okkwork-support-chat__status {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.okkwork-support-chat__status--in_progress {
  background: rgba(243, 145, 8, 0.15);
  color: #c76a00;
}

.okkwork-support-chat__status--resolved {
  background: rgba(17, 188, 32, 0.12);
  color: #0a8a18;
}

.okkwork-support-chat__status--unresolved {
  background: rgba(225, 29, 72, 0.1);
  color: #be123c;
}

.okkwork-support-chat__main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.okkwork-support-chat__header {
  padding: 20px 22px 12px;
  background: linear-gradient(180deg, #0658a2 0%, #0658a2 100%);
  color: #fff;
}

.okkwork-support-chat__title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 6px;
}

.okkwork-support-chat__lead {
  font-size: 13px;
  opacity: 0.9;
  margin: 0;
}

.okkwork-support-chat__view {
  flex: 1;
  overflow: auto;
  padding: 18px 22px 24px;
}

.okkwork-support-chat__section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #0658a2;
  margin-bottom: 10px;
}

.okkwork-support-chat__topics {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.okkwork-support-chat__topic {
  border: 1px solid rgba(6, 88, 162, 0.2);
  border-radius: 10px;
  padding: 10px 14px;
  background: #f7fafd;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.okkwork-support-chat__topic.is-active {
  border-color: #0658a2;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(6, 88, 162, 0.1);
}

.okkwork-support-chat__topic-title {
  color: #0658a2;
  font-weight: 600;
  font-size: 14px;
}

.okkwork-support-chat__topic-eta {
  font-size: 11px;
  letter-spacing: 0.1em;
  margin-top: 4px;
  color: rgba(81, 95, 108, 0.85);
}

.okkwork-support-chat__field {
  margin-bottom: 14px;
}

.okkwork-support-chat__field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: rgba(81, 95, 108, 0.95);
  font-family: "Rubik", "Rubik-Medium", sans-serif;
}

.okkwork-support-chat__field textarea,
.okkwork-support-chat__reply textarea {
  width: 100%;
  border: 1px solid rgba(6, 88, 162, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}

/* Выбор проекта — как поля этапа 4 / CRM dropdown */
.okkwork-support-chat__project-root {
  position: relative;
}

.okkwork-support-chat__project-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(6, 88, 162, 0.45);
  border-radius: 10px;
  background: rgba(220, 231, 242, 1);
  font-family: "Inter-SemiBold", "Inter-Medium", sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #0658a2;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.okkwork-support-chat__project-root.is-filled .okkwork-support-chat__project-trigger,
.okkwork-support-chat__project-root.is-open .okkwork-support-chat__project-trigger {
  background: rgba(6, 88, 162, 0.14);
}

.okkwork-support-chat__project-trigger:focus-visible {
  outline: 2px solid rgba(6, 88, 162, 0.35);
  outline-offset: 2px;
}

.okkwork-support-chat__project-trigger-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.okkwork-support-chat__project-chevron {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border-right: 2px solid #0658a2;
  border-bottom: 2px solid #0658a2;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.okkwork-support-chat__project-root.is-open .okkwork-support-chat__project-chevron {
  transform: rotate(-135deg);
}

.okkwork-support-chat__project-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 120;
  margin: 0;
  padding: 0;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(6, 88, 162, 0.25);
  box-shadow:
    0 10px 40px rgba(6, 40, 72, 0.14),
    0 2px 8px rgba(0, 0, 0, 0.06);
  max-height: min(280px, 40vh);
  overflow: auto;
  box-sizing: border-box;
}

.okkwork-support-chat__project-dropdown[hidden] {
  display: none !important;
}

.okkwork-support-chat__project-list {
  list-style: none;
  margin: 0;
  padding: 4px 0 8px;
}

.okkwork-support-chat__project-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 14px;
  font-family: "Inter-Medium", "Inter-Regular", sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: rgba(72, 87, 101, 1);
  cursor: pointer;
  line-height: 1.35;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.okkwork-support-chat__project-option:hover,
.okkwork-support-chat__project-option:focus-visible {
  background: rgba(6, 88, 162, 0.08);
  color: #0658a2;
  outline: none;
}

.okkwork-support-chat__project-option.is-selected {
  background: rgba(6, 88, 162, 0.12);
  color: #0658a2;
  font-weight: 600;
}

.okkwork-support-chat__project-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: rgba(81, 95, 108, 0.9);
  line-height: 1.45;
}

.okkwork-support-chat__drop {
  border: 1px dashed rgba(6, 88, 162, 0.35);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  background: #f7fafd;
  margin-bottom: 14px;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.okkwork-support-chat__drop.is-dragover {
  border-color: rgba(6, 88, 162, 0.65);
  background: rgba(6, 88, 162, 0.06);
}

.okkwork-support-chat__drop.has-file {
  text-align: left;
  padding-bottom: 12px;
}

.okkwork-support-chat__drop.has-file .okkwork-support-chat__attach-btn {
  display: none;
}

.okkwork-support-chat__attach-btn {
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
  color: inherit;
}

.okkwork-support-chat__attach-btn strong {
  color: #0658a2;
  text-decoration: underline;
}

.okkwork-support-chat__attach-preview {
  margin-top: 4px;
}

.okkwork-support-chat__attach-preview[hidden] {
  display: none !important;
}

.okkwork-support-chat__attach-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(6, 88, 162, 0.16);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 14px rgba(6, 40, 72, 0.08);
}

.okkwork-support-chat__attach-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(6, 88, 162, 0.1);
  color: #0658a2;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.okkwork-support-chat__attach-remove:hover {
  background: rgba(6, 88, 162, 0.18);
}

.okkwork-support-chat__attach-thumb {
  flex: none;
  width: 112px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(6, 88, 162, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.okkwork-support-chat__attach-item--video .okkwork-support-chat__attach-thumb,
.okkwork-support-chat__attach-item--pdf .okkwork-support-chat__attach-thumb {
  width: 140px;
  height: 96px;
}

.okkwork-support-chat__attach-img,
.okkwork-support-chat__attach-vid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #fff;
}

.okkwork-support-chat__attach-pdf {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}

.okkwork-support-chat__attach-file {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(6, 88, 162, 0.92);
}

.okkwork-support-chat__attach-meta {
  flex: 1;
  min-width: 0;
  padding-right: 28px;
  padding-top: 4px;
}

.okkwork-support-chat__attach-name {
  font-size: 13px;
  font-weight: 600;
  color: #0658a2;
  line-height: 1.35;
  word-break: break-word;
}

.okkwork-support-chat__attach-size {
  margin-top: 4px;
  font-size: 11px;
  color: rgba(81, 95, 108, 0.85);
}

.okkwork-support-chat__send {
  background: #0658a2;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.okkwork-support-chat__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.okkwork-support-chat__error {
  color: #be123c;
  font-size: 13px;
  margin-top: 8px;
}

.okkwork-support-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.okkwork-support-chat__msg {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
}

.okkwork-support-chat__msg--user {
  margin-left: auto;
  background: #eaf2fa;
  border: 1px solid rgba(6, 88, 162, 0.12);
}

.okkwork-support-chat__msg--staff {
  background: #fff;
  border: 1px solid rgba(6, 88, 162, 0.15);
}

.okkwork-support-chat__msg time {
  display: block;
  font-size: 10px;
  margin-top: 6px;
  opacity: 0.65;
}

.okkwork-support-chat__msg-attach {
  margin-bottom: 8px;
}

.okkwork-support-chat__msg-attach-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.okkwork-support-chat__msg-attach .okkwork-support-chat__attach-thumb {
  width: 100%;
  min-width: 0;
  max-width: 260px;
  height: auto;
  min-height: 72px;
}

.okkwork-support-chat__msg-attach--image .okkwork-support-chat__attach-thumb {
  max-height: 220px;
}

.okkwork-support-chat__msg-attach--image .okkwork-support-chat__attach-img {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  display: block;
}

.okkwork-support-chat__msg-attach--video .okkwork-support-chat__attach-thumb,
.okkwork-support-chat__msg-attach--pdf .okkwork-support-chat__attach-thumb {
  width: 100%;
  max-width: 260px;
  height: 160px;
}

.okkwork-support-chat__msg-attach--video .okkwork-support-chat__attach-vid,
.okkwork-support-chat__msg-attach--pdf .okkwork-support-chat__attach-pdf {
  width: 100%;
  height: 100%;
}

.okkwork-support-chat__reply {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(6, 88, 162, 0.1);
  padding-top: 14px;
}

.okkwork-support-chat__empty {
  font-size: 13px;
  color: rgba(81, 95, 108, 0.8);
  padding: 8px 4px;
}

body.okkwork-support-chat-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .okkwork-support-chat__layout {
    grid-template-columns: 1fr;
  }

  .okkwork-support-chat__sidebar {
    max-height: 180px;
    border-right: none;
    border-bottom: 1px solid rgba(6, 88, 162, 0.1);
  }

  .okkwork-support-chat__close {
    left: auto;
    right: 12px;
    top: 10px;
  }
}
