/* Portal Skyline Chat Widget - minimal, WhatsApp-like */
#ps-chat-btn {
  position: fixed;
  right: 18px;
  bottom: calc(var(--footer-h, 0px) + 18px);
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: var(--sky-red, #C2171F);
  color: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
  display: grid;
  place-items: center;
  z-index: 9998;
}

#ps-chat-panel {
  position: fixed;
  right: 18px;
  bottom: calc(var(--footer-h, 0px) + 82px);
  width: 380px;  /* ~10cm */
  height: 560px; /* ~15cm */
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.12);
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
  overflow: hidden;
  z-index: 9999;
  display: none;
}

#ps-chat-panel.ps-open { display: flex; flex-direction: column; }

.ps-chat__topbar{
  background: #111;
  color: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ps-chat__title{
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
}

.ps-chat__sub{
  font-size: 11px;
  opacity: .85;
}

.ps-chat__topbar button{
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
}

.ps-chat__body{
  flex: 1;
  display: flex;
  min-height: 0;
}

.ps-chat__screen{
  flex: 1;
  min-width: 0;
  display: none;
  flex-direction: column;
  min-height: 0;
}

.ps-chat__screen.ps-active{ display:flex; }

.ps-chat__list{
  flex: 1;
  overflow: auto;
  padding: 8px;
  background: #f6f7f8;
}

/* FIX: make sure New Chat user list can scroll */
#ps-users-list{
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.ps-item{
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}

.ps-item__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.ps-item__name{ font-weight: 700; font-size: 13px; }
.ps-item__meta{ font-size: 11px; opacity: .75; }

.ps-item__preview{
  margin-top: 6px;
  font-size: 12px;
  opacity: .85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ps-chat__messages{
  flex: 1;
  overflow: auto;
  padding: 10px;
  background: #f2f3f5;
  display:flex;
  flex-direction: column;
  gap: 8px;
}

.ps-msg{
  max-width: 82%;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  font-size: 12.5px;
  line-height: 1.25;
}

.ps-msg.ps-me{
  margin-left: auto;
  background: #e9f7f7;
  border-color: rgba(0,128,128,.25);
}

.ps-msg__name{
  font-size: 11px;
  opacity: .75;
  margin-bottom: 3px;
}

.ps-msg__time{
  font-size: 10px;
  opacity: .6;
  margin-top: 5px;
  text-align: right;
}

.ps-msg img{
  max-width: 100%;
  border-radius: 10px;
  display:block;
}

.ps-chat__composer{
  display:flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(0,0,0,.1);
  background: #fff;
}

.ps-chat__composer input[type="text"]{
  flex:1;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 12px;
  padding: 10px;
  font-size: 12.5px;
}

.ps-chat__composer button{
  border:none;
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
  background: var(--sky-red, #C2171F);
  color:#fff;
  font-weight: 700;
}

.ps-chat__pillbar{
  padding: 8px;
  display:flex;
  gap: 8px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  background: #fff;
}

.ps-pill{
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  background: #fff;
}

.ps-pill.ps-active{
  border-color: rgba(0,128,128,.45);
  background: #e9f7f7;
}

.ps-chat__form{
  padding: 10px;
  display:flex;
  flex-direction: column;
  gap: 10px;

  /* FIX: allow inner list to scroll */
  flex: 1;
  min-height: 0;
}

.ps-chat__form input, .ps-chat__form select{
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 12px;
  padding: 10px;
  font-size: 12.5px;
}

.ps-chat__form .ps-actions{
  display:flex;
  gap: 8px;
}

.ps-chat__form .ps-actions button{
  flex:1;
  border:none;
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
  background: #111;
  color:#fff;
  font-weight: 700;
}

.ps-chat__note{
  font-size: 12px;
  opacity: .8;
}

.ps-chat__pin{
  padding: 14px;
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.ps-unsend{
  margin-top: 6px;
  font-size: 12px;
  opacity: .7;
  cursor: pointer;
  user-select: none;
}
.ps-unsend:hover{
  opacity: 1;
  text-decoration: underline;
}
.ps-unsend{
  margin-top: 6px;
  font-size: 12px;
  opacity: .7;
  cursor: pointer;
  user-select: none;
}
.ps-unsend:hover{
  opacity: 1;
  text-decoration: underline;
}
.ps-float-badge{
  position:absolute;
  top:-4px;
  right:-4px;
  background:#e60023;
  color:#fff;
  font-size:11px;
  min-width:18px;
  height:18px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
}

.ps-unread .ps-item__name{
  font-weight:800;
}

.ps-badge{
  margin-left:6px;
  background:#e60023;
  color:#fff;
  font-size:11px;
  padding:2px 6px;
  border-radius:10px;
}