*{ box-sizing:border-box; }

html, body{
  margin:0;
  background:#08090b;
  color:#edeef0;
  font-family:Inter, sans-serif;
  -webkit-font-smoothing:antialiased;
}

.hidden{ display:none !important; }

.boot-spin{
  width:26px; height:26px;
  border:2px solid rgba(255,255,255,0.1);
  border-top-color:#7c5cff;
  border-radius:50%;
  animation:cx-spin .7s linear infinite;
}
@keyframes cx-spin{ to{ transform:rotate(360deg); } }

.contact-wrap{
  max-width:760px;
  margin:0 auto;
  padding:calc(80px + var(--cx-announce-h, 38px) + 28px) 16px 28px;
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.contact-card{
  display:flex;
  flex-direction:column;
  flex:1 1 auto;
  min-height:0;
  height:calc(100vh - 80px - var(--cx-announce-h, 38px) - 56px);
  background:#0d0e11;
  border:1px solid rgba(255,255,255,0.07);
  border-radius:6px;
  overflow:hidden;
}

.chat-head{
  display:flex;
  align-items:center;
  gap:12px;
  padding:16px 20px;
  border-bottom:1px solid rgba(255,255,255,0.07);
  background:rgba(255,255,255,0.02);
}
.chat-head-avatar{
  width:38px; height:38px;
  display:flex; align-items:center; justify-content:center;
  border-radius:8px;
  background:rgba(124,92,255,0.12);
  border:1px solid rgba(124,92,255,0.24);
  color:#9c85ff; flex:0 0 38px;
}
.chat-head-text{ flex:1 1 auto; min-width:0; }
.chat-head-text h1{ margin:0; font-size:1rem; font-weight:700; letter-spacing:-.01em; }
.chat-head-text p{ margin:2px 0 0; font-size:.8rem; color:rgba(237,238,240,0.5); }

.chat-head-actions{ display:flex; gap:7px; flex:0 0 auto; }
.chat-act{
  padding:6px 12px; font-size:.78rem; font-weight:600; cursor:pointer;
  color:rgba(237,238,240,0.75); background:rgba(255,255,255,0.03);
  border:1px solid rgba(255,255,255,0.08); border-radius:4px;
  transition:background .14s, border-color .14s, color .14s;
}
.chat-act:hover{ background:rgba(255,255,255,0.06); color:#edeef0; border-color:rgba(255,255,255,0.14); }
.chat-act:disabled{ opacity:.45; cursor:default; }
.chat-act-danger{ color:#f2938f; background:rgba(240,98,95,0.08); border-color:rgba(240,98,95,0.22); }
.chat-act-danger:hover{ background:rgba(240,98,95,0.16); color:#fff; }
@media (max-width:560px){
  .chat-head{ flex-wrap:wrap; }
  .chat-head-actions{ width:100%; justify-content:flex-end; }
}

.chat-loading{
  flex:1 1 auto;
  display:flex; align-items:center; justify-content:center;
  color:rgba(237,238,240,0.4); font-size:.88rem;
}

.contact-create{
  flex:1 1 auto;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  text-align:center;
  padding:30px 26px;
  gap:5px;
}
.create-illus{
  width:64px; height:64px;
  display:flex; align-items:center; justify-content:center;
  border-radius:10px;
  margin-bottom:6px;
  color:#9c85ff;
  background:rgba(124,92,255,0.1);
  border:1px solid rgba(124,92,255,0.2);
}
.contact-create h2{ margin:0; font-size:1.15rem; font-weight:700; }
.contact-create p{
  margin:0 0 14px;
  max-width:420px;
  color:rgba(237,238,240,0.55);
  font-size:.88rem; line-height:1.5;
}
.create-form{
  display:flex; gap:8px;
  width:100%; max-width:480px;
  flex-wrap:wrap;
  justify-content:center;
}
.create-form input{
  flex:1 1 240px;
  min-width:0;
  padding:11px 14px;
  border-radius:4px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.03);
  color:#edeef0; font-family:inherit; font-size:.9rem;
  outline:none;
  transition:border-color .14s, background .14s;
}
.create-form input:focus{ border-color:rgba(124,92,255,0.5); background:rgba(124,92,255,0.05); }
.create-form button{
  flex:0 0 auto;
  padding:11px 20px;
  border:none; border-radius:4px;
  background:#7c5cff; color:#fff;
  font-weight:600; font-size:.88rem; cursor:pointer;
  transition:background .15s ease;
}
.create-form button:hover{ background:#6b48f2; }
.create-form button:disabled{ opacity:.5; cursor:default; }

.chat-pane{ display:flex; flex-direction:column; flex:1 1 auto; min-height:0; }

.chat-body{
  flex:1 1 auto; min-height:0; overflow-y:auto;
  padding:18px;
  display:flex; flex-direction:column; gap:10px;
  scrollbar-width:thin;
}

.msg{ display:flex; max-width:78%; }
.msg-user{ align-self:flex-end; }
.msg-staff{ align-self:flex-start; }
.msg-system{ align-self:center; max-width:92%; }

.bubble{
  padding:9px 12px; border-radius:6px;
  font-size:.88rem; line-height:1.45;
  word-break:break-word;
  display:flex; flex-direction:column; gap:3px;
}
.msg-user .bubble{ background:#7c5cff; color:#fff; border-bottom-right-radius:2px; }
.msg-staff .bubble{ background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.07); border-bottom-left-radius:2px; }

.msg-alert{ max-width:92%; }
.msg-alert .bubble{
  background:rgba(240,98,95,0.1);
  border:1px solid rgba(240,98,95,0.4);
  color:#edeef0;
}
.msg-alert .sender{ color:#f2938f; }
.msg-alert .text{ font-weight:600; }
.msg-system .bubble{
  background:rgba(61,214,140,0.08);
  border:1px solid rgba(61,214,140,0.2);
  color:rgba(237,238,240,0.8);
  border-radius:6px; font-size:.85rem; text-align:center;
}
.bubble .sender{ font-size:.7rem; font-weight:700; color:#3dd68c; }
.bubble .time{ font-size:.66rem; opacity:.55; align-self:flex-end; }

.chat-input{
  display:flex; align-items:flex-end; gap:8px;
  padding:12px 14px;
  border-top:1px solid rgba(255,255,255,0.07);
  background:rgba(0,0,0,0.14);
}
.chat-input textarea{
  flex:1 1 auto; resize:none; max-height:140px;
  padding:10px 12px; border-radius:4px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.03);
  color:#edeef0; font-family:inherit; font-size:.88rem; line-height:1.4;
  outline:none;
  transition:border-color .14s, background .14s;
}
.chat-input textarea:focus{ border-color:rgba(124,92,255,0.5); background:rgba(124,92,255,0.05); }
.chat-input button{
  flex:0 0 40px; width:40px; height:40px;
  border:none; border-radius:4px;
  background:#7c5cff; color:#fff; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:background .15s ease;
}
.chat-input button:hover{ background:#6b48f2; }
.chat-input button:disabled{ opacity:.5; cursor:default; }

.contact-gate{
  flex:1 1 auto;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  text-align:center; padding:40px 20px;
}
.contact-gate p{ color:rgba(237,238,240,0.6); margin-bottom:16px; }
.contact-gate-btn{
  display:inline-block; padding:10px 20px;
  border-radius:4px; background:#7c5cff; color:#fff;
  font-weight:600; font-size:.88rem; text-decoration:none;
  transition:background .15s ease;
}
.contact-gate-btn:hover{ background:#6b48f2; }

.cx-channel-tabs{
  display:flex; gap:2px;
  padding:8px 12px 0;
  background:rgba(255,255,255,0.015);
  border-bottom:1px solid rgba(255,255,255,0.07);
  flex:0 0 auto;
}
.cx-channel-tab{
  position:relative;
  padding:10px 16px;
  background:transparent; border:none;
  border-bottom:2px solid transparent;
  border-radius:4px 4px 0 0;
  color:rgba(237,238,240,0.5);
  font-family:inherit; font-size:.85rem; font-weight:600; cursor:pointer;
  transition:color .14s ease, border-color .14s ease, background .14s ease;
}
.cx-channel-tab:hover{ color:#edeef0; background:rgba(255,255,255,0.03); }
.cx-channel-tab.active{ color:#edeef0; border-bottom-color:#7c5cff; }
.cx-abo-dot{
  position:absolute; top:6px; right:8px;
  width:7px; height:7px; border-radius:50%;
  background:#3dd68c; box-shadow:0 0 0 2px #08090b;
}

#channel-support, #channel-abonnement{
  display:flex; flex-direction:column;
  flex:1 1 auto; min-height:0;
}

.msg{ flex-wrap:wrap; }
.msg-read-receipt{
  flex-basis:100%;
  text-align:right;
  margin-top:3px;
  padding-right:2px;
  font-size:.66rem;
  color:rgba(237,238,240,0.45);
}

@media (max-width:600px){
  .contact-wrap{ padding-left:10px; padding-right:10px; }
  .msg{ max-width:88%; }
  .contact-card{ border-radius:4px; }
  .cx-channel-tab{ padding:9px 13px; font-size:.82rem; }
}

.cx-view{ display:flex; flex-direction:column; flex:1 1 auto; min-height:0; }

.chat-act-primary{
  background:#7c5cff; color:#fff; border-color:transparent;
}
.chat-act-primary:hover{ background:#6b48f2; color:#fff; }

.ticket-list{
  flex:1 1 auto; min-height:0; overflow-y:auto;
  display:flex; flex-direction:column;
  scrollbar-width:thin;
}
.ticket-row{
  display:flex; align-items:center; gap:12px;
  padding:14px 20px;
  border-bottom:1px solid rgba(255,255,255,0.05);
  cursor:pointer;
  transition:background .12s ease;
}
.ticket-row:hover{ background:rgba(255,255,255,0.03); }
.ticket-kind-badge{
  flex:0 0 auto;
  font-size:.68rem; font-weight:700; letter-spacing:.02em;
  padding:4px 8px; border-radius:4px;
  background:rgba(124,92,255,0.12); color:#9c85ff;
  border:1px solid rgba(124,92,255,0.24);
  white-space:nowrap;
}
.ticket-kind-badge.kind-premium{
  background:rgba(240,190,60,0.12); color:#f0be3c; border-color:rgba(240,190,60,0.3);
}
.ticket-row-main{ flex:1 1 auto; min-width:0; }
.ticket-row-subject{
  font-size:.9rem; font-weight:600; color:#edeef0;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.ticket-row-preview{
  font-size:.78rem; color:rgba(237,238,240,0.5);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  margin-top:2px;
}
.ticket-row-meta{
  flex:0 0 auto; display:flex; flex-direction:column; align-items:flex-end; gap:4px;
}
.ticket-row-time{ font-size:.72rem; color:rgba(237,238,240,0.4); }
.ticket-row-status{
  font-size:.66rem; font-weight:600; padding:2px 7px; border-radius:3px;
  background:rgba(255,255,255,0.05); color:rgba(237,238,240,0.5);
}
.ticket-row-status.status-closed{ color:rgba(237,238,240,0.35); }
.ticket-unread-dot{
  width:8px; height:8px; border-radius:50%;
  background:#3dd68c; flex:0 0 8px;
}

.ticket-empty{
  flex:1 1 auto;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  text-align:center; padding:30px 26px; gap:6px;
}
.ticket-empty h2{ margin:0; font-size:1.1rem; font-weight:700; }
.ticket-empty p{ margin:0 0 10px; max-width:380px; color:rgba(237,238,240,0.55); font-size:.88rem; line-height:1.5; }

.motif-list{
  flex:1 1 auto; overflow-y:auto;
  padding:16px 20px; display:flex; flex-direction:column; gap:8px;
}
.motif-btn{
  display:flex; align-items:center; gap:12px;
  padding:14px 16px; text-align:left;
  border:1px solid rgba(255,255,255,0.08); border-radius:6px;
  background:rgba(255,255,255,0.02); color:#edeef0;
  cursor:pointer; font-family:inherit; font-size:.92rem; font-weight:600;
  transition:background .14s ease, border-color .14s ease;
}
.motif-btn:hover{ background:rgba(124,92,255,0.08); border-color:rgba(124,92,255,0.3); }
.motif-icon{ flex:0 0 auto; display:flex; align-items:center; justify-content:center; color:#9c85ff; }

.motif-subject-form{
  display:none; gap:8px; padding:14px 20px;
  border-top:1px solid rgba(255,255,255,0.07);
}
.motif-subject-form.active{ display:flex; }
.motif-subject-form input{
  flex:1 1 auto; min-width:0;
  padding:11px 14px; border-radius:4px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.03);
  color:#edeef0; font-family:inherit; font-size:.9rem; outline:none;
}
.motif-subject-form input:focus{ border-color:rgba(124,92,255,0.5); background:rgba(124,92,255,0.05); }
.motif-subject-form button{
  flex:0 0 auto; padding:11px 20px; border:none; border-radius:4px;
  background:#7c5cff; color:#fff; font-weight:600; font-size:.88rem; cursor:pointer;
}
.motif-subject-form button:hover{ background:#6b48f2; }

.chat-head .chat-head-avatar + .chat-head-text{ margin-left:0; }
