/* =====================================================
   SteamXY — 右下角工单浮标组件
   ===================================================== */

.tk-dock {
  position: fixed;
  right: 22px;
  bottom: 26px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* 浮标按钮 */
.tk-fab {
  position: relative;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a6dff, #4d94ff);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(26, 109, 255, .4);
  transition: transform .18s, box-shadow .18s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tk-fab:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(26, 109, 255, .5); }
.tk-fab .tk-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #f04438;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #fff;
}
.tk-fab .tk-badge.show { display: flex; }
.tk-fab .tk-fab-label {
  position: absolute;
  right: 66px;
  top: 50%;
  transform: translateY(-50%);
  background: #1f2329;
  color: #fff;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.tk-fab:hover .tk-fab-label { opacity: 1; }

/* 面板 */
.tk-panel {
  width: 380px;
  height: 500px;
  max-height: calc(100vh - 130px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(31, 35, 41, .22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
}
.tk-panel.open { display: flex; animation: tkPop .18s ease; }
@keyframes tkPop {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tk-head {
  background: linear-gradient(120deg, #1a6dff, #4d94ff);
  color: #fff;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.tk-head .tk-h-ico { font-size: 20px; }
.tk-head b { font-size: 15.5px; }
.tk-head .tk-h-sub { font-size: 11.5px; opacity: .85; margin-top: 1px; }
.tk-head .tk-close {
  margin-left: auto;
  border: none;
  background: rgba(255,255,255,.18);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.tk-head .tk-close:hover { background: rgba(255,255,255,.3); }

/* 页签 */
.tk-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tk-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 6px 10px;
  font-size: 14px;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  position: relative;
}
.tk-tabs button.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tk-tabs .tk-t-badge {
  display: inline-flex;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: #f04438;
  color: #fff;
  font-size: 11px;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  margin-left: 5px;
  vertical-align: 1px;
}

.tk-body { flex: 1; overflow-y: auto; padding: 16px; }
.tk-body::-webkit-scrollbar { width: 5px; }
.tk-body::-webkit-scrollbar-thumb { background: #d4d9e0; border-radius: 3px; }

/* 未登录提示 */
.tk-need-login { text-align: center; padding: 48px 20px; }
.tk-need-login .tk-nl-ico { font-size: 44px; margin-bottom: 12px; }
.tk-need-login b { display: block; font-size: 15px; margin-bottom: 6px; }
.tk-need-login p { color: var(--text-3); font-size: 13px; margin-bottom: 18px; }

/* 表单 */
.tk-field { margin-bottom: 13px; }
.tk-field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.tk-field .tk-input,
.tk-field .tk-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
  background: #fff;
}
.tk-field .tk-input:focus,
.tk-field .tk-textarea:focus { border-color: var(--primary); }
.tk-field .tk-textarea { resize: none; height: 96px; }
.tk-cats { display: flex; flex-wrap: wrap; gap: 7px; }
.tk-cats button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-2);
  border-radius: 999px;
  padding: 4px 13px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s;
}
.tk-cats button:hover { border-color: var(--primary); color: var(--primary); }
.tk-cats button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tk-note {
  font-size: 12px;
  color: var(--text-3);
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 11px;
  margin-bottom: 14px;
  line-height: 1.6;
}

/* 工单列表 */
.tk-ticket-item {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 13px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all .15s;
  background: #fff;
}
.tk-ticket-item:hover { border-color: var(--primary); }
.tk-ticket-item.active { border-color: var(--primary); background: var(--primary-light); }
.tk-ticket-item .tk-t-row1 { display: flex; align-items: center; gap: 8px; }
.tk-ticket-item .tk-t-title {
  font-size: 13.5px;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tk-ticket-item .tk-t-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--text-3);
}
.tk-ticket-item .tk-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f04438;
  flex-shrink: 0;
}
.tk-ticket-item .tk-cat-tag {
  font-size: 11px;
  background: var(--bg);
  border-radius: 5px;
  padding: 1px 7px;
  color: var(--text-2);
}

/* 工单详情（对话流） */
.tk-detail-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.tk-detail-head .tk-back {
  border: none;
  background: var(--bg);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
}
.tk-detail-head .tk-back:hover { color: var(--primary); }
.tk-detail-head b { font-size: 14px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tk-msg { display: flex; margin-bottom: 12px; }
.tk-msg .tk-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.tk-msg .tk-b-time { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.tk-msg.from-user { justify-content: flex-end; }
.tk-msg.from-user .tk-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.tk-msg.from-user .tk-b-time { text-align: right; }
.tk-msg.from-admin .tk-bubble { background: var(--bg); color: var(--text); border-bottom-left-radius: 4px; }
.tk-msg .tk-sender { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }

.tk-reply-bar {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  gap: 9px;
  flex-shrink: 0;
  background: #fff;
}
.tk-reply-bar input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 13.5px;
  outline: none;
  min-width: 0;
}
.tk-reply-bar input:focus { border-color: var(--primary); }
.tk-reply-bar button {
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.tk-reply-bar button:hover { background: var(--primary-dark); }
.tk-reply-bar button[disabled] { opacity: .5; cursor: not-allowed; }

.tk-empty { text-align: center; padding: 44px 16px; color: var(--text-3); }
.tk-empty .tk-e-ico { font-size: 38px; margin-bottom: 8px; }

/* 移动端 */
@media (max-width: 480px) {
  .tk-dock { right: 14px; bottom: 16px; }
  .tk-panel {
    width: calc(100vw - 28px);
    height: calc(100vh - 120px);
  }
  .tk-fab .tk-fab-label { display: none; }
}
