/* Floating actions — chat FAB */
.be-scroll-top {
  display: none !important;
}

.floating-actions {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
}

.page-home-mobile .floating-actions {
  bottom: calc(var(--mob-bottomnav-h, 64px) + 16px + env(safe-area-inset-bottom, 0px));
}

.floating-actions .chat-fab {
  position: relative;
  cursor: pointer;
}

.fab-wrap {
  position: relative;
  width: 44px;
  height: 44px;
}

.fab-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(#1a56ff, #7c3aed, #0a9e84, #1a56ff);
  animation: fab-ring-spin 6s linear infinite;
  transition: opacity .25s;
}

.chat-fab.open .fab-ring {
  opacity: .6;
}

@keyframes fab-ring-spin {
  to { transform: rotate(360deg); }
}

.fab-btn {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2563eb, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37, 99, 235, .4);
  transition: transform .2s, box-shadow .2s;
}

.chat-fab:hover .fab-btn {
  transform: scale(1.06);
  box-shadow: 0 6px 22px rgba(37, 99, 235, .5);
}

.fab-chat-icon {
  font-size: 18px;
  line-height: 1;
  transition: transform .25s, opacity .2s;
}

.fab-x-icon {
  position: absolute;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  opacity: 0;
  transition: transform .25s, opacity .2s;
  transform: rotate(-90deg);
}

.chat-fab.open .fab-chat-icon {
  opacity: 0;
  transform: rotate(90deg);
}

.chat-fab.open .fab-x-icon {
  opacity: 1;
  transform: rotate(0);
}

.fab-pulse {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(37, 99, 235, .3);
  animation: fab-pulse-out 2.5s ease infinite;
}

.chat-fab.open .fab-pulse {
  display: none;
}

@keyframes fab-pulse-out {
  0% { transform: scale(1); opacity: .5; }
  70% { transform: scale(1.55); opacity: 0; }
  100% { transform: scale(1.55); opacity: 0; }
}

.fab-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fff;
  font-family: 'Lexend Deca', sans-serif;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, .4);
  transition: transform .2s, opacity .2s;
}

.chat-fab.open .fab-badge {
  transform: scale(0);
  opacity: 0;
}

.fab-tip {
  position: absolute;
  right: 52px;
  top: 50%;
  transform: translateY(-50%) translateX(4px);
  background: #1a2340;
  color: #fff;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  box-shadow: 0 4px 12px rgba(26, 35, 64, .22);
}

.fab-tip::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: #1a2340;
}

.chat-fab:not(.open):hover .fab-tip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ══ PANEL ══ */
.chat-panel {
  position: fixed;
  right: 24px;
  bottom: calc(24px + 44px + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 999;
  width: 300px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 16px 50px rgba(26, 35, 64, .16), 0 3px 12px rgba(26, 35, 64, .07);
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(.88) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform .26s cubic-bezier(.34, 1.35, .64, 1), opacity .2s ease;
}

.page-home-mobile .chat-panel {
  bottom: calc(var(--mob-bottomnav-h, 64px) + 16px + 44px + 12px + env(safe-area-inset-bottom, 0px));
}

.chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.cp-head {
  background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
  padding: 13px 14px 11px;
  position: relative;
  overflow: hidden;
}

.cp-head::after {
  content: '';
  position: absolute;
  width: 140px;
  height: 140px;
  background: radial-gradient(rgba(255, 255, 255, .1), transparent 70%);
  top: -50px;
  right: -20px;
  border-radius: 50%;
  pointer-events: none;
}

.cp-head-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cp-brand {
  display: flex;
  align-items: center;
  gap: 7px;
}

.cp-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 5px #4ade80;
  flex-shrink: 0;
}

.cp-brand-text {
  font-family: 'Lexend Deca', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.cp-brand-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, .65);
  margin-top: 1px;
}

.cp-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  color: #fff;
  transition: background .12s;
  flex-shrink: 0;
}

.cp-close:hover {
  background: rgba(255, 255, 255, .28);
}

.cp-sp-card {
  display: flex;
  align-items: center;
  gap: 11px;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 12px;
  padding: 9px 11px;
  position: relative;
  z-index: 1;
}

.cp-sp-photo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2.5px solid rgba(255, 255, 255, .5);
  background: #dbeafe;
}

.cp-sp-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cp-sp-info {
  flex: 1;
  min-width: 0;
}

.cp-sp-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 1px;
}

.cp-sp-label {
  font-size: 9.5px;
  color: rgba(255, 255, 255, .6);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.cp-sp-online {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

.cp-sp-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 5px #4ade80;
}

.cp-sp-dot.offline {
  background: #94a3b8;
  box-shadow: none;
}

.cp-sp-status {
  font-size: 10px;
  color: #86efac;
  font-weight: 600;
}

.cp-body {
  padding: 12px 12px 8px;
}

.cp-empty {
  padding: 16px 12px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
  border-radius: 10px;
}

.cp-contacts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.cp-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8faff;
  border: 1.5px solid #edf0f8;
  border-radius: 10px;
  padding: 9px 11px;
  cursor: pointer;
  text-decoration: none;
  transition: all .14s;
}

.cp-cta:hover {
  background: #eff3ff;
  border-color: #c5d3f8;
  transform: translateX(2px);
}

.cp-cta-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cp-cta-ico {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.ico-call { background: #fff0f5; border: 1px solid #fecdd3; }
.ico-zalo { background: #e0f2fe; border: 1px solid #bae6fd; }
.ico-mail { background: #f0fdf4; border: 1px solid #bbf7d0; }

.cp-cta-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #1a2340;
}

.cp-cta-val {
  font-size: 11.5px;
  color: #7a88aa;
  font-weight: 500;
}

.cp-cta.zalo-main {
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  border-color: #7dd3fc;
}

.cp-cta.zalo-main:hover {
  background: linear-gradient(135deg, #bae6fd, #e0f2fe);
  border-color: #38bdf8;
}

.cp-cta.zalo-main .cp-cta-label {
  color: #0369a1;
  font-size: 13px;
}

.cp-change-wrap {
  margin-bottom: 2px;
}

.cp-change-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  padding: 5px 10px;
  background: none;
  border: 1px dashed #dde4f0;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  color: #9aa3be;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  transition: all .15s;
}

.cp-change-trigger:hover {
  border-color: #c5d3f8;
  color: #1a56ff;
  background: #f8faff;
}

.cp-change-trigger-icon {
  font-size: 11px;
  transition: transform .25s;
}

.cp-change-trigger.open .cp-change-trigger-icon {
  transform: rotate(180deg);
}

.cp-picker {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .28s ease, opacity .22s ease;
}

.cp-picker.open {
  max-height: 180px;
  opacity: 1;
}

.cp-picker-wrap {
  background: #f8faff;
  border: 1px solid #e8efff;
  border-radius: 10px;
  padding: 6px;
  margin-top: 5px;
}

.cp-pi {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .1s;
}

.cp-pi:hover {
  background: #eff3ff;
}

.cp-pi.active {
  background: #e8efff;
}

.cp-pi-ava {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.cp-pi-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  border: 1.5px solid #f8faff;
}

.cp-pi-dot.busy {
  background: #fbbf24;
}

.cp-pi-info {
  flex: 1;
  min-width: 0;
}

.cp-pi-name {
  font-size: 11.5px;
  font-weight: 700;
  color: #1a2340;
}

.cp-pi-role {
  font-size: 10px;
  color: #9aa3be;
}

.cp-pi-radio {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #dde4f0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .12s;
}

.cp-pi.active .cp-pi-radio {
  border-color: #1a56ff;
}

.cp-pi-dot-inner {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1a56ff;
  display: none;
}

.cp-pi.active .cp-pi-dot-inner {
  display: block;
}

.cp-pick-confirm {
  display: none;
  margin-top: 6px;
  width: 100%;
  background: linear-gradient(135deg, #1a56ff, #1340d4);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(26, 86, 255, .3);
}

.cp-pick-confirm.show {
  display: block;
}

.cp-pick-confirm:hover {
  opacity: .9;
}

.cp-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 12px 10px;
  font-size: 10px;
  color: #c0c8d8;
  font-weight: 500;
}

@media (max-width: 360px) {
  .chat-panel {
    width: calc(100vw - 16px);
    right: 8px;
  }

  .floating-actions {
    right: 12px;
  }
}
