.web366-zalo-widget{
  --web366-zalo-bg:#001222;
  --web366-zalo-bg-2:#061b2e;
  --web366-zalo-text:#eaf6ff;
  --web366-zalo-muted:#a7c4d6;
  --web366-zalo-line:rgba(116,241,205,.22);
  --web366-zalo-green:#7cf0b1;
  --web366-zalo-cyan:#53e9f5;
  --web366-zalo-blue:#1f8fff;
  --web366-zalo-danger:#ff6b4a;
  --web366-zalo-shadow:0 26px 80px rgba(0,0,0,.42), 0 0 42px rgba(83,233,245,.12);
  --web366-zalo-radius-xl:28px;
  --web366-zalo-radius-lg:20px;
  --web366-zalo-font:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
  position:fixed;
  z-index:999999;
  font-family:var(--web366-zalo-font);
  line-height:1.4;
}

.web366-zalo-widget,
.web366-zalo-widget *{
  box-sizing:border-box;
}

.web366-zalo-widget--right{right:28px;bottom:230px;}
.web366-zalo-widget--left{left:28px;bottom:230px;}
.web366-zalo-widget--top{right:28px;top:26px;bottom:auto;}
.web366-zalo-widget--bottom{left:50%;right:auto;bottom:26px;transform:translateX(-50%);}

.web366-zalo-fab{
  appearance:none;
  border:0;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:12px;
  min-width:196px;
  height:62px;
  padding:9px 18px 9px 9px;
  border-radius:999px;
  color:#001222;
  background:linear-gradient(135deg,#75f0b6 0%,#8de99a 55%,#53e9f5 135%);
  box-shadow:0 18px 46px rgba(0,0,0,.35),0 0 0 1px rgba(255,255,255,.2) inset,0 0 35px rgba(124,240,177,.22);
  transition:transform .22s ease,box-shadow .22s ease;
  font:inherit;
  text-align:left;
}

.web366-zalo-fab:hover,
.web366-zalo-fab:focus-visible{
  transform:translateY(-3px);
  box-shadow:0 24px 62px rgba(0,0,0,.42),0 0 40px rgba(83,233,245,.25);
  outline:none;
}

.web366-zalo-fab__icon{
  width:44px;
  height:44px;
  border-radius:50%;
  background:#fff;
  display:grid;
  place-items:center;
  box-shadow:0 10px 26px rgba(0,0,0,.14);
  overflow:hidden;
  flex:0 0 44px;
}

.web366-zalo-fab__text{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  line-height:1.15;
}

.web366-zalo-fab__text strong{
  font-size:14px;
  letter-spacing:.2px;
  font-weight:800;
}

.web366-zalo-fab__text span{
  font-size:12px;
  opacity:.72;
  font-weight:700;
  margin-top:3px;
}

.web366-zalo-panel{
  position:absolute;
  right:0;
  bottom:78px;
  width:392px;
  max-width:calc(100vw - 32px);
  border-radius:var(--web366-zalo-radius-xl);
  color:var(--web366-zalo-text);
  background:linear-gradient(180deg,rgba(8,31,52,.94),rgba(2,18,33,.97)),radial-gradient(circle at 88% 18%,rgba(83,233,245,.2),transparent 26%);
  border:1px solid var(--web366-zalo-line);
  box-shadow:var(--web366-zalo-shadow);
  padding:18px;
  opacity:0;
  visibility:hidden;
  transform:translateY(14px) scale(.985);
  transform-origin:bottom right;
  transition:opacity .22s ease,transform .22s ease,visibility .22s ease;
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
}

.web366-zalo-widget.is-open .web366-zalo-panel{
  opacity:1;
  visibility:visible;
  transform:translateY(0) scale(1);
}

.web366-zalo-widget--left .web366-zalo-panel{
  left:0;
  right:auto;
  transform-origin:bottom left;
}

.web366-zalo-widget--top .web366-zalo-panel{
  top:78px;
  bottom:auto;
  transform:translateY(-14px) scale(.985);
  transform-origin:top right;
}

.web366-zalo-widget--top.is-open .web366-zalo-panel{
  transform:translateY(0) scale(1);
}

.web366-zalo-widget--bottom .web366-zalo-panel{
  left:50%;
  right:auto;
  transform:translateX(-50%) translateY(14px) scale(.985);
  transform-origin:bottom center;
}

.web366-zalo-widget--bottom.is-open .web366-zalo-panel{
  transform:translateX(-50%) translateY(0) scale(1);
}

.web366-zalo-panel::before{
  content:"";
  position:absolute;
  inset:-1px;
  border-radius:inherit;
  pointer-events:none;
  background:linear-gradient(135deg,rgba(124,240,177,.44),transparent 28%,rgba(83,233,245,.28) 74%,transparent);
  mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);
  mask-composite:exclude;
  -webkit-mask-composite:xor;
  padding:1px;
}

.web366-zalo-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:6px 4px 16px;
  border-bottom:1px solid rgba(255,255,255,.08);
}

.web366-zalo-head__content{
  min-width:0;
}

.web366-zalo-kicker{
  display:inline-flex;
  align-items:center;
  gap:7px;
  color:var(--web366-zalo-cyan);
  font-size:12px;
  font-weight:900;
  letter-spacing:1.1px;
  text-transform:uppercase;
  margin:0 0 8px;
}

.web366-zalo-kicker::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--web366-zalo-green);
  box-shadow:0 0 14px var(--web366-zalo-green);
  flex:0 0 8px;
}

.web366-zalo-title{
  margin:0;
  font-size:21px;
  line-height:1.18;
  letter-spacing:-.35px;
  font-weight:850;
}

.web366-zalo-sub{
  margin:8px 0 0;
  color:var(--web366-zalo-muted);
  font-size:13.5px;
  line-height:1.45;
}

.web366-zalo-close{
 display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  line-height: 1 !important;
  
  appearance:none;
  border:0;
  cursor:pointer;
  flex:0 0 34px;
  width:34px;
  height:34px;
  border-radius:50%;
  background:rgba(255,255,255,.08);
  color:#fff;
  font-size:20px;
  line-height:1;
  transition:background .18s ease,transform .18s ease;
  font-family:Arial,sans-serif;
}

.web366-zalo-close:hover,
.web366-zalo-close:focus-visible{
  background:rgba(255,107,74,.95);
  transform:rotate(90deg);
  outline:none;
}

.web366-zalo-list{
  display:grid;
  gap:11px;
  padding:14px 0 8px;
}

.web366-zalo-person{
  display:grid;
  grid-template-columns:54px minmax(0,1fr) auto;
  align-items:center;
  gap:12px;
  text-decoration:none !important;
  color:inherit !important;
  padding:12px;
  border-radius:var(--web366-zalo-radius-lg);
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.045);
  box-shadow:0 10px 28px rgba(0,0,0,.12);
  transition:transform .18s ease,background .18s ease,border-color .18s ease;
}

.web366-zalo-person:hover,
.web366-zalo-person:focus-visible{
  transform:translateX(-4px);
  background:rgba(124,240,177,.09);
  border-color:rgba(124,240,177,.34);
  outline:none;
}

.web366-zalo-widget--left .web366-zalo-person:hover,
.web366-zalo-widget--left .web366-zalo-person:focus-visible{
  transform:translateX(4px);
}

.web366-zalo-avatar{
  width:54px;
  height:54px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg,#ffffff,#dff6ff);
  box-shadow:0 12px 30px rgba(83,233,245,.14);
  overflow:hidden;
  flex:0 0 54px;
}

.web366-zalo-avatar img,
.web366-zalo-logo{
  width:100%;
  height:100%;
  display:block;
}

.web366-zalo-avatar img{
  object-fit:cover;
}

.web366-zalo-info{
  min-width:0;
  display:block;
}

.web366-zalo-name{
  display:block;
  font-size:15px;
  font-weight:900;
  margin-bottom:4px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  color:var(--web366-zalo-text);
}

.web366-zalo-role{
  display:block;
  color:var(--web366-zalo-muted);
  font-size:12.5px;
  line-height:1.2;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.web366-zalo-phone{
  display:block;
  margin-top:5px;
  color:#dffdf1;
  font-size:13px;
  font-weight:750;
}

.web366-zalo-cta{
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:74px;
  height:38px;
  border-radius:999px;
  background:rgba(31,143,255,.18);
  border:1px solid rgba(83,233,245,.22);
  color:#bceeff;
  font-size:12.5px;
  font-weight:900;
}

.web366-zalo-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  color:rgba(234,246,255,.65);
  font-size:12px;
  padding:9px 4px 2px;
}

@media (max-width:1024px){
  .web366-zalo-widget--right{right:22px;bottom:250px;}
  .web366-zalo-widget--left{left:22px;bottom:250px;}
  .web366-zalo-widget--top{right:22px;top:250px;}
  .web366-zalo-widget--bottom{bottom:250px;}
  .web366-zalo-panel{width:368px;}
}

@media (max-width:640px){
  .web366-zalo-widget--mobile-disabled{
    display:none !important;
  }

  .web366-zalo-widget{
    right:12px !important;
    bottom:14px !important;
    left:12px !important;
    top:auto !important;
    transform:none !important;
  }

  .web366-zalo-fab{
    width:100%;
    min-width:0;
    justify-content:center;
    height:58px;
  }

  .web366-zalo-panel,
  .web366-zalo-widget--top .web366-zalo-panel,
  .web366-zalo-widget--bottom .web366-zalo-panel{
    position:fixed;
    left:12px;
    right:12px;
    bottom:84px;
    top:auto;
    width:auto;
    max-width:none;
    border-radius:24px;
    padding:14px;
    transform:translateY(14px) scale(.985);
    transform-origin:bottom center;
  }

  .web366-zalo-widget.is-open .web366-zalo-panel,
  .web366-zalo-widget--top.is-open .web366-zalo-panel,
  .web366-zalo-widget--bottom.is-open .web366-zalo-panel{
    transform:translateY(0) scale(1);
  }

  .web366-zalo-title{font-size:19px;}
  .web366-zalo-sub{font-size:13px;}

  .web366-zalo-person{
    grid-template-columns:48px minmax(0,1fr) 64px;
    gap:10px;
    padding:10px;
    border-radius:18px;
  }

  .web366-zalo-avatar{
    width:48px;
    height:48px;
    border-radius:50%;
  }

  .web366-zalo-cta{
    min-width:64px;
    height:36px;
    font-size:12px;
  }

  .web366-zalo-foot{
    display:block;
    line-height:1.5;
  }
}

/* =========================================================
   WEB366 ZALO WIDGET - FIX DESKTOP/LAPTOP CHIỀU CAO THẤP
   Mục tiêu:
   - Panel không bị tràn/mất phần đầu trên màn hình desktop nhỏ.
   - Header/footer của panel luôn thấy.
   - Danh sách nhân sự tự cuộn bên trong.
   - Nút "Chọn tư vấn Zalo" luôn nhìn thấy.
   ========================================================= */

.web366-zalo-widget{
  --web366-zalo-fab-bottom:230px;
  --web366-zalo-panel-gap:78px;
  --web366-zalo-panel-safe-top:48px;
  --web366-zalo-panel-safe-bottom:calc(var(--web366-zalo-fab-bottom) + var(--web366-zalo-panel-gap));
  --web366-zalo-panel-max-height:clamp(
    260px,
    calc(100vh - var(--web366-zalo-panel-safe-top) - var(--web366-zalo-panel-safe-bottom)),
    620px
  );
}

/* Đồng bộ vị trí nút chính để panel tính đúng chiều cao còn lại */
.web366-zalo-widget--right{
  right:28px;
  bottom:var(--web366-zalo-fab-bottom);
}

.web366-zalo-widget--left{
  left:28px;
  bottom:var(--web366-zalo-fab-bottom);
}

/* Trường hợp widget mở từ phía trên */
.web366-zalo-widget--top{
  --web366-zalo-panel-safe-top:104px;
  --web366-zalo-panel-safe-bottom:24px;
}

/* Trường hợp widget nằm giữa đáy màn hình */
.web366-zalo-widget--bottom{
  --web366-zalo-fab-bottom:26px;
}

/* Khi đăng nhập WordPress có admin bar, chừa thêm khoảng trên */
body.admin-bar .web366-zalo-widget{
  --web366-zalo-panel-safe-top:66px;
}

/* Panel không dùng height cố định; tự co theo viewport */
.web366-zalo-panel{
  display:flex;
  flex-direction:column;
  max-height:var(--web366-zalo-panel-max-height);
  overflow:hidden;
}

/* Header và footer giữ nguyên, phần danh sách cuộn bên trong */
.web366-zalo-head,
.web366-zalo-foot{
  flex:0 0 auto;
}

.web366-zalo-list{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  overscroll-behavior:contain;
  padding-right:4px;
  scrollbar-width:thin;
  scrollbar-color:rgba(124,240,177,.55) rgba(255,255,255,.08);
}

.web366-zalo-list::-webkit-scrollbar{
  width:6px;
}

.web366-zalo-list::-webkit-scrollbar-track{
  background:rgba(255,255,255,.06);
  border-radius:999px;
}

.web366-zalo-list::-webkit-scrollbar-thumb{
  background:rgba(124,240,177,.48);
  border-radius:999px;
}

.web366-zalo-list::-webkit-scrollbar-thumb:hover{
  background:rgba(124,240,177,.72);
}

/* Laptop hoặc desktop có chiều cao thấp: nén nhẹ layout */
@media (max-height:850px) and (min-width:641px){
  .web366-zalo-widget{
    --web366-zalo-panel-safe-top:42px;
  }

  body.admin-bar .web366-zalo-widget{
    --web366-zalo-panel-safe-top:58px;
  }

  .web366-zalo-panel{
    padding:16px;
  }

  .web366-zalo-head{
    padding:4px 4px 12px;
  }

  .web366-zalo-kicker{
    margin-bottom:6px;
    font-size:11.5px;
  }

  .web366-zalo-title{
    font-size:19px;
  }

  .web366-zalo-sub{
    margin-top:6px;
    font-size:12.5px;
    line-height:1.4;
  }

  .web366-zalo-list{
    gap:9px;
    padding-top:12px;
    padding-bottom:6px;
  }

  .web366-zalo-person{
    grid-template-columns:50px minmax(0,1fr) auto;
    gap:10px;
    padding:10px;
  }

  .web366-zalo-avatar{
    width:50px;
    height:50px;
    flex-basis:50px;
  }

  .web366-zalo-cta{
    min-width:68px;
    height:36px;
  }

  .web366-zalo-foot{
    padding-top:7px;
  }
}

/* Màn hình rất thấp: ẩn mô tả phụ để giữ phần quan trọng */
@media (max-height:720px) and (min-width:641px){
  .web366-zalo-widget{
    --web366-zalo-panel-safe-top:36px;
  }

  body.admin-bar .web366-zalo-widget{
    --web366-zalo-panel-safe-top:52px;
  }

  .web366-zalo-panel{
    padding:14px;
    border-radius:24px;
  }

  .web366-zalo-head{
    padding-bottom:10px;
  }

  .web366-zalo-sub{
    display:none;
  }

  .web366-zalo-kicker{
    margin-bottom:4px;
    font-size:11px;
    letter-spacing:.8px;
  }

  .web366-zalo-title{
    font-size:18px;
  }

  .web366-zalo-list{
    gap:8px;
    padding-top:10px;
  }

  .web366-zalo-person{
    grid-template-columns:46px minmax(0,1fr) 64px;
    gap:9px;
    padding:9px;
    border-radius:18px;
  }

  .web366-zalo-avatar{
    width:46px;
    height:46px;
    flex-basis:46px;
  }

  .web366-zalo-name{
    font-size:14px;
    margin-bottom:3px;
  }

  .web366-zalo-role{
    font-size:12px;
  }

  .web366-zalo-phone{
    margin-top:3px;
    font-size:12.5px;
  }

  .web366-zalo-cta{
    min-width:64px;
    height:34px;
    font-size:12px;
  }
}

/* Giữ tương thích với rule cũ ở tablet/desktop nhỏ */
@media (max-width:1024px) and (min-width:641px){
  .web366-zalo-widget{
    --web366-zalo-fab-bottom:250px;
  }

  .web366-zalo-widget--right{
    right:22px;
    bottom:var(--web366-zalo-fab-bottom);
  }

  .web366-zalo-widget--left{
    left:22px;
    bottom:var(--web366-zalo-fab-bottom);
  }

  .web366-zalo-widget--bottom{
    --web366-zalo-fab-bottom:250px;
  }
}

/* Mobile: vẫn là bottom sheet, nhưng có giới hạn chiều cao và cuộn trong danh sách */
@media (max-width:640px){
  .web366-zalo-widget{
    --web366-zalo-fab-bottom:14px;
    --web366-zalo-panel-safe-top:14px;
    --web366-zalo-panel-safe-bottom:84px;
    --web366-zalo-panel-max-height:calc(100vh - 104px);
  }

  .web366-zalo-panel,
  .web366-zalo-widget--top .web366-zalo-panel,
  .web366-zalo-widget--bottom .web366-zalo-panel{
    display:flex;
    flex-direction:column;
    max-height:var(--web366-zalo-panel-max-height);
    overflow:hidden;
  }

  .web366-zalo-list{
    overflow-y:auto;
    min-height:0;
  }
}

/* Dùng dvh nếu trình duyệt hỗ trợ, ổn hơn trên mobile browser */
@supports (height:100dvh){
  .web366-zalo-widget{
    --web366-zalo-panel-max-height:clamp(
      260px,
      calc(100dvh - var(--web366-zalo-panel-safe-top) - var(--web366-zalo-panel-safe-bottom)),
      620px
    );
  }

  @media (max-width:640px){
    .web366-zalo-widget{
      --web366-zalo-panel-max-height:calc(100dvh - 104px);
    }
  }
}
