.ck-consult-widget {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 100;
}

.ck-consult-widget [hidden] { display: none !important; }

.ck-consult-panel {
  width: min(292px, calc(48dvh), calc(100vw - 24px));
  animation: ck-consult-enter 250ms ease-out both;
}

.ck-consult-poster-link, .ck-consult-poster {
  display: block;
  width: 100%;
}

.ck-consult-poster {
  height: auto;
  filter: drop-shadow(0 10px 24px #10254f38);
}

.ck-consult-controls {
  display: flex;
  width: max-content;
  margin: 0 6% 2px auto;
  padding: 2px;
  border: 1px solid #c4dbfb;
  border-radius: 12px;
  background: #f5f9ff;
  box-shadow: 0 4px 14px #14478a20;
}

.ck-consult-control {
  position: relative;
  display: grid;
  width: 40px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1458b8;
  cursor: pointer;
}

.ck-consult-control + .ck-consult-control::before {
  position: absolute;
  inset: 8px auto 8px 0;
  width: 1px;
  background: #d1e2fb;
  content: "";
}

.ck-consult-control:hover {
  background: #e3efff;
  color: #0b438e;
}

.ck-consult-control span {
  position: relative;
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
}

.ck-consult-control span::before, .ck-consult-close span::after {
  position: absolute;
  width: 13px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  content: "";
}

.ck-consult-close span::before { transform: rotate(45deg); }
.ck-consult-close span::after { transform: rotate(-45deg); }

.ck-consult-dialog-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid #fff9;
  border-radius: 50%;
  background: #082041d9;
  color: #fff;
  font: 24px/1 system-ui, sans-serif;
  cursor: pointer;
}

.ck-consult-dialog-close:hover {
  background: #124eb3;
}

.ck-consult-launch {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: #1677e8;
  box-shadow: 0 8px 26px #12275536;
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.ck-consult-launch:hover { background: #0d59bc; }

.ck-mobile-consult, .ck-advisor-mobile { display: none; }

.ck-consult-widget :focus-visible, .ck-consult-dialog :focus-visible {
  outline: 3px solid #ffc64b;
  outline-offset: 3px;
}

.ck-consult-control:focus-visible {
  outline: 2px solid #0d63d2;
  outline-offset: -3px;
}

.ck-consult-dialog {
  position: fixed;
  inset: 0;
  width: min(400px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 30px 24px 22px;
  overflow: auto;
  border: 1px solid #d8e5fa;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 16px 54px #09244d3d;
  color: #102650;
  text-align: center;
}

.ck-consult-dialog::backdrop { background: #071f3d96; backdrop-filter: blur(4px); }

.ck-consult-dialog-close {
  position: absolute;
  right: 10px;
  top: 10px;
}

.ck-consult-dialog h2, .ck-advisor-card h2 {
  margin: 4px 0 14px;
  font-size: clamp(22px, 5vw, 28px);
  color: #102650;
}

.ck-advisor-qr {
  display: block;
  width: min(240px, 100%);
  height: auto;
  margin: 0 auto;
  border: 1px solid #e1ebfa;
  border-radius: 10px;
}

.ck-advisor-instructions {
  margin: 12px 0 0;
  color: #102650;
  font-size: 15px;
  font-weight: 700;
}

.ck-advisor-tip {
  max-width: 330px;
  margin: 7px auto 0;
  color: #465c7d;
  font-size: 13px;
  line-height: 1.55;
}

.ck-consult-page-link {
  display: inline-block;
  margin-top: 14px;
  color: #164fb7;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ck-advisor-card {
  padding: 26px 18px;
  border: 1px solid #dce7fa;
  border-radius: 18px;
  background: #f4f8ff;
  text-align: center;
}

@keyframes ck-consult-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .ck-consult-widget {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .ck-consult-panel { width: min(280px, 68vw, 48dvh); }
}

@media (max-width: 767px), (hover: none) and (pointer: coarse) {
  .ck-consult-widget, .ck-consult-dialog, .ck-advisor-desktop { display: none; }
  .ck-advisor-mobile { display: block; }

  .ck-mobile-consult {
    position: fixed;
    z-index: 95;
    inset-inline: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    padding: 8px max(16px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border-top: 1px solid #dbe6f5;
    background: #fff;
    box-shadow: 0 -6px 28px #12275516;
  }

  .ck-mobile-consult-link {
    justify-content: center;
    gap: 10px;
    width: min(100%, 420px);
    min-height: 48px;
  }

  body { padding-bottom: calc(65px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .ck-consult-panel { animation: none; }
}
