/* OKKwork — правая страница «Интеграции» (паттерн как «Права доступа») */
:root {
  --okkwork-integrations-panel-width: min(560px, 100vw);
  --okkwork-integrations-slide-ms: 0.4s;
  --okkwork-integrations-slide-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.okkwork-integrations-page {
  position: fixed;
  inset: 0;
  /* Ниже меню (101560), рядом с ним — не под ним: shell сдвигается на --okkwork-menu-rail-width */
  z-index: 101540;
  display: none;
  pointer-events: none;
  visibility: hidden;
}

.okkwork-integrations-page.is-open {
  display: block;
  visibility: visible;
}

.okkwork-integrations-page.is-open.is-profile-entering,
.okkwork-integrations-page.is-open.is-slide-open {
  pointer-events: auto;
}

.okkwork-integrations-page.is-open.is-profile-leaving {
  pointer-events: none;
}

.okkwork-integrations-page__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  opacity: 0;
  transition: opacity var(--okkwork-integrations-slide-ms) var(--okkwork-integrations-slide-ease);
  cursor: pointer;
}

.okkwork-integrations-page.is-open.is-profile-entering .okkwork-integrations-page__backdrop,
.okkwork-integrations-page.is-open.is-slide-open .okkwork-integrations-page__backdrop {
  opacity: 1;
}

.okkwork-integrations-page__shell {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--okkwork-integrations-panel-width);
  max-width: min(560px, 100vw);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid rgba(6, 88, 162, 0.16);
  box-shadow: -4px 0 24px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  transform: translateX(100%);
  transform-origin: right center;
  transition: transform var(--okkwork-integrations-slide-ms) var(--okkwork-integrations-slide-ease);
  will-change: transform;
}

/* Открытое меню слева от rail — иначе панель уезжает под «Интеграция с CRM» */
body.okkwork-user-menu-slider-open .okkwork-integrations-page.is-open .okkwork-integrations-page__shell {
  right: var(--okkwork-menu-rail-width, 280px);
  width: min(560px, calc(100vw - var(--okkwork-menu-rail-width, 280px)));
  max-width: min(560px, calc(100vw - var(--okkwork-menu-rail-width, 280px)));
}

body.okkwork-integrations-page-open .okkwork-user-menu-book.is-slider-open {
  width: var(--okkwork-menu-rail-width, 280px) !important;
  min-width: var(--okkwork-menu-rail-width, 280px) !important;
  max-width: var(--okkwork-menu-rail-width, 280px) !important;
}

.okkwork-integrations-page.is-open.is-profile-entering .okkwork-integrations-page__shell,
.okkwork-integrations-page.is-open.is-slide-open .okkwork-integrations-page__shell {
  transform: translateX(0);
}

.okkwork-integrations-page.is-open.is-profile-leaving .okkwork-integrations-page__shell {
  transform: translateX(100%);
}

.okkwork-integrations-page__collapse.profile-panel__close {
  position: absolute;
  top: 12px;
  right: 17px;
  left: auto;
  z-index: 6;
}

.okkwork-integrations-page.is-open .okkwork-integrations-page__collapse .profile-panel__close-ico {
  transform: rotate(90deg);
}

.okkwork-integrations-page__header {
  padding: 18px 52px 12px 22px;
  border-bottom: 1px solid #e8eef5;
  flex-shrink: 0;
}

.okkwork-integrations-page__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
}

.okkwork-integrations-page__subtitle {
  margin: 6px 0 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: #64748b;
}

.okkwork-integrations-page__scroll {
  flex: 1;
  overflow: auto;
  padding: 16px 20px 28px;
}

.okkwork-integrations-page__help-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.okkwork-integrations-page__btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: #0658a2;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.okkwork-integrations-page__btn:hover {
  background: #054a88;
}

.okkwork-integrations-page__btn--help {
  background: #0658a2;
  color: #fff;
}

.okkwork-integrations-page__btn--help:hover {
  background: #054a88;
}

.okkwork-integrations-page__btn-ico {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: brightness(0) invert(1);
  pointer-events: none;
}

.okkwork-integrations-page__btn--ghost {
  background: #f1f5f9;
  color: #0f172a;
}

.okkwork-integrations-page__btn--ghost:hover {
  background: #e2e8f0;
}

.okkwork-integrations-page__btn--danger {
  background: #fef2f2;
  color: #b91c1c;
}

.okkwork-integrations-page__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.okkwork-int-steps {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.okkwork-int-steps__item {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.okkwork-int-steps__item.is-active {
  color: #0658a2;
  border-color: rgba(6, 88, 162, 0.35);
  background: rgba(6, 88, 162, 0.08);
}

.okkwork-int-steps__item.is-done {
  color: #047857;
  border-color: rgba(4, 120, 87, 0.3);
  background: rgba(4, 120, 87, 0.08);
}

.okkwork-int-tip {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f0f7ff;
  border: 1px solid rgba(6, 88, 162, 0.18);
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.45;
}

.okkwork-int-tip strong {
  color: #0658a2;
}

.okkwork-int-warn {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 0.9rem;
  line-height: 1.45;
}

.okkwork-int-section-title {
  margin: 8px 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.okkwork-int-project {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.okkwork-int-project:hover,
.okkwork-int-project.is-selected {
  border-color: rgba(6, 88, 162, 0.45);
  box-shadow: 0 0 0 3px rgba(6, 88, 162, 0.08);
}

.okkwork-int-project__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.okkwork-int-project__main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.okkwork-int-project__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.okkwork-int-project__title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.okkwork-int-project__avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #e8eef5;
  box-shadow: inset 0 0 0 1px rgba(6, 88, 162, 0.12);
}

.okkwork-int-project__name {
  margin: 0;
  font-weight: 700;
  color: #0f172a;
  font-size: 1rem;
  line-height: 1.25;
  min-width: 0;
}

.okkwork-int-project__meta {
  margin: 0;
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.3;
}

.okkwork-int-provider-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  max-width: 100%;
}

.okkwork-int-provider-chip__icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
  flex: 0 0 auto;
  background: #fff;
}

.okkwork-int-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.okkwork-int-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.okkwork-int-badge--working {
  background: #ecfdf5;
  color: #047857;
}

.okkwork-int-badge--broken {
  background: #fef2f2;
  color: #b91c1c;
}

.okkwork-int-badge--degraded {
  background: #fffbeb;
  color: #b45309;
}

.okkwork-int-badge--not_connected,
.okkwork-int-badge--platform_not_ready {
  background: #f1f5f9;
  color: #64748b;
}

.okkwork-int-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.okkwork-int-stat {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px;
}

.okkwork-int-stat__label {
  margin: 0;
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.okkwork-int-stat__value {
  margin: 4px 0 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.okkwork-int-detail {
  margin-top: 8px;
}

.okkwork-int-systems {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.okkwork-int-system {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 12px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.okkwork-int-system:hover,
.okkwork-int-system.is-selected {
  border-color: rgba(6, 88, 162, 0.45);
  box-shadow: 0 0 0 3px rgba(6, 88, 162, 0.08);
}

.okkwork-int-system.is-soon {
  opacity: 0.92;
}

.okkwork-int-system__logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  flex: 0 0 auto;
  background: #fff;
}

.okkwork-int-system__label {
  flex: 1 1 auto;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
}

.okkwork-int-system__soon {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 3px 8px;
}

.okkwork-int-provider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.okkwork-int-provider img,
.okkwork-int-provider__logo,
.okkwork-int-system__logo.okkwork-int-provider__logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  flex: 0 0 auto;
}

@media (max-width: 520px) {
  .okkwork-int-systems {
    grid-template-columns: 1fr;
  }
}

.okkwork-int-form {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.okkwork-int-field {
  display: grid;
  gap: 4px;
  font-size: 0.82rem;
  color: #334155;
}

.okkwork-int-field input,
.okkwork-int-field select {
  height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
  color: #0f172a;
  background: #fff;
}

.okkwork-int-field input:focus,
.okkwork-int-field select:focus {
  outline: 2px solid #93c5fd;
  border-color: #60a5fa;
}

.okkwork-int-dd {
  position: relative;
  width: 100%;
}

.okkwork-int-dd__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  border: 1px solid #c9dcea;
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.okkwork-int-dd__trigger:hover {
  border-color: #93c5fd;
}

.okkwork-int-dd.is-open .okkwork-int-dd__trigger,
.okkwork-int-dd__trigger:focus-visible {
  outline: none;
  border-color: #0658a2;
  box-shadow: 0 0 0 3px rgba(6, 88, 162, 0.12);
}

.okkwork-int-dd__chevron {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  color: #64748b;
  transition: transform 0.15s ease;
}

.okkwork-int-dd.is-open .okkwork-int-dd__chevron {
  transform: rotate(180deg);
  color: #0658a2;
}

.okkwork-int-dd__list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid #e4eef7;
  border-radius: 12px;
  background: #fff;
  box-shadow:
    0 10px 28px rgba(15, 23, 42, 0.1),
    0 2px 8px rgba(15, 23, 42, 0.05);
  max-height: min(240px, 40vh);
  overflow: auto;
}

.okkwork-int-dd__list[hidden] {
  display: none !important;
}

.okkwork-int-dd__opt {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 0.12s ease,
    color 0.12s ease;
}

.okkwork-int-dd__opt + .okkwork-int-dd__opt {
  margin-top: 2px;
}

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

.okkwork-int-dd__opt.is-active {
  background: #e7f3ff;
  color: #0658a2;
  font-weight: 600;
}

.okkwork-int-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}

.okkwork-int-amo-btn-host {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.okkwork-int-amo-btn-host[hidden] {
  display: none !important;
}

.okkwork-int-amo-btn-host .okkwork-int-amo-oauth-btn,
.okkwork-int-amo-btn-host iframe,
.okkwork-int-amo-btn-host button {
  max-width: 100%;
}

.okkwork-int-soon {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.okkwork-int-soon ul {
  margin: 6px 0 0;
  padding-left: 1.1rem;
  color: #64748b;
  font-size: 0.9rem;
}

.okkwork-int-events {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.okkwork-int-events li {
  font-size: 0.82rem;
  color: #475569;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
}

.okkwork-int-back {
  margin-bottom: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .okkwork-integrations-page__shell,
  .okkwork-integrations-page__backdrop {
    transition: none;
  }
}
