/* ============================================================================
   工单组件样式（三处共用：门户「我的反馈」/ 控制台「我的工单」/ 后台「工单管理」）
   ----------------------------------------------------------------------------
   ★ 为什么单独一个文件：
     工单详情是一个跨主题复用的 macro，但三个后台各自只加载自己的 CSS
     （portal.css / console.css / admin.css）。原来 `.tk-*` 在 portal.css 与
     admin.css 里**各写了一份**，改一处忘一处；而本轮新增的"对话气泡"只写进了
     portal.css，结果后台的工单对话完全没有样式（实测 display=block、
     max-width=none —— 左右分侧和气泡宽度全都没生效）。

     集中到这里、三个 base 模板都加载，就不会再出现"某个主题漏了样式"。

   ★ 变量回退：
     三个主题的变量名不同（portal 用 --c-line/--c-text，
     admin/console 用 --line/--muted/--card/--text）。
     所以每个地方都写成 `var(--x, 回退值)`，
     这样**不管哪个主题、加载顺序如何**都能正常显示。
   ============================================================================ */
.tk-wrap, .tk-list, .tk-card, .tk-detail, .tk-thread {
  --tk-line: var(--line, var(--c-line, rgba(255,255,255,.1)));
  --tk-line-2: var(--c-line-2, rgba(255,255,255,.06));
  --tk-text: var(--text, var(--c-text, #e8f1ff));
  --tk-text-2: var(--c-text-2, #a1a1a6);
  --tk-text-3: var(--muted, var(--c-text-3, #6e6e73));
  --tk-card: var(--card, var(--c-card, rgba(255,255,255,.04)));
}


/* ============================================================================
   反馈工单：我的反馈（进度页）
   ----------------------------------------------------------------------------
   用户要求：「让玩家看到进度……有没有人受理（领取），是否办结
            （办结后会有个处理结果的内容填写）」
   ========================================================================== */
.tk-no{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:12.5px;
  color:#22d3ee;
  letter-spacing:.02em;
}

.tk-no-big{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:17px;
  font-weight:700;
  color:#22d3ee;
}

/* 状态徽章：待受理 / 已受理 / 已办结 */
.tk-state{
  display:inline-block;
  padding:4px 12px;
  border-radius:99px;
  font-size:12.5px;
  font-weight:700;
  white-space:nowrap;
}

.tk-state.wait{background:rgba(251,191,36,.15);color:#fcd34d;border:1px solid rgba(251,191,36,.35)}

.tk-state.doing{background:rgba(56,189,248,.15);color:#7dd3fc;border:1px solid rgba(56,189,248,.38)}

.tk-state.done{background:rgba(110,231,183,.15);color:#6ee7b7;border:1px solid rgba(110,231,183,.35)}

/* 工单列表 */
.tk-list{display:flex;flex-direction:column;gap:18px}

.tk-card{
  border-radius:16px;
  background:rgba(255,255,255,.032);
  border:1px solid var(--c-line-2);
  padding:20px 22px;
}

.tk-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}

.tk-card-left{display:flex;gap:13px;min-width:0}

.tk-card-left > i{color:#22d3ee;font-size:18px;margin-top:2px}

.tk-card-title{font-size:15.5px;font-weight:600;color:var(--c-text);line-height:1.45}

.tk-card-meta{
  display:flex;gap:12px;flex-wrap:wrap;
  margin-top:5px;font-size:12.5px;color:var(--c-text-3);
}

/* 单选工单（未登录用编号查到的） */
.tk-single{
  margin-top:26px;border-radius:16px;
  background:rgba(255,255,255,.032);
  border:1px solid var(--c-line-2);
  padding:22px 24px;
}

.tk-single-head{
  display:flex;align-items:center;justify-content:space-between;
  gap:14px;flex-wrap:wrap;margin-bottom:6px;
}

/* 进度时间线 */
.tk-tl{
  display:flex;
  flex-direction:column;
  gap:0;
  margin:18px 0 4px;
  padding-left:4px;
}

.tk-step{
  display:flex;
  gap:14px;
  position:relative;
  padding-bottom:18px;
}

.tk-step:last-child{padding-bottom:0}

.tk-step .tk-dot{
  width:11px;height:11px;border-radius:50%;
  flex-shrink:0;margin-top:4px;
  background:rgba(255,255,255,.14);
  border:2px solid transparent;
  position:relative;z-index:1;
}

/* 竖线（用伪元素连起来） */
.tk-step::before{
  content:"";
  position:absolute;
  left:5px;top:15px;bottom:0;
  width:1px;
  background:rgba(255,255,255,.1);
}

.tk-step:last-child::before{display:none}

.tk-step.done .tk-dot{background:#6ee7b7;box-shadow:0 0 10px rgba(110,231,183,.5)}

.tk-step.now .tk-dot{background:#fcd34d;box-shadow:0 0 10px rgba(251,191,36,.5)}

.tk-step.done::before{background:rgba(110,231,183,.35)}

.tk-step-body{min-width:0}

.tk-step-body b{display:block;font-size:14px;color:var(--c-text);font-weight:600}

.tk-step.todo .tk-step-body b{color:var(--c-text-3);font-weight:500}

.tk-step-body span{display:block;font-size:12.5px;color:var(--c-text-3);margin-top:2px;line-height:1.6}

/* 我提交的内容 */
.tk-sec{margin-top:6px;padding-top:16px;border-top:1px solid rgba(255,255,255,.07)}

.tk-sec-title{
  display:flex;align-items:center;gap:7px;
  font-size:12.5px;color:var(--c-text-3);margin-bottom:9px;
}

.tk-sec-title i{color:#22d3ee}

.tk-content{
  font-size:14px;line-height:1.8;color:var(--c-text-2);
  white-space:pre-line;word-break:break-word;
}

.tk-contact{margin-top:8px;font-size:12.5px;color:var(--c-text-3)}

/* 处理结果 */
.tk-result{
  margin-top:16px;padding:16px 18px;border-radius:13px;
  background:rgba(110,231,183,.07);
  border:1px solid rgba(110,231,183,.28);
}

.tk-result-title{
  display:flex;align-items:center;gap:8px;
  font-size:13px;font-weight:700;color:#6ee7b7;margin-bottom:8px;
}

.tk-result-body{font-size:14px;line-height:1.8;color:var(--c-text-2);white-space:pre-line}

.tk-pending-hint{
  display:flex;align-items:center;gap:9px;
  margin-top:14px;padding:12px 15px;border-radius:12px;
  background:rgba(56,189,248,.06);
  border:1px solid rgba(56,189,248,.2);
  font-size:13px;color:#9fc6e8;
}

.tk-pending-hint i{color:#38bdf8}

/* 补充说明 */
.tk-reply{margin-top:12px;display:flex;flex-direction:column;gap:10px;align-items:flex-start}

.tk-reply textarea{width:100%;min-height:64px;resize:vertical}

/* ============================================================================
   工单对话线程（本轮新增）
   ----------------------------------------------------------------------------
   用户要求：「在这边用户不是会有补充吗，我可以对他进行回复，
            然后我们可以一直交流直至工单结束」
            「正常的工单系统的那种答复一样，专业来写就行」

   布局：玩家消息靠左、管理组消息靠右，头像 + 身份标签 + 时间。
   窄屏（<=640px）自动变成全宽上下堆叠（左右分栏在手机上太挤，
   而且气泡会很窄、长文本频繁折行很难读）。
   ========================================================================== */
.tk-thread{
  display:flex;flex-direction:column;gap:12px;
  margin-top:4px;padding-top:14px;
  border-top:1px solid rgba(255,255,255,.07);
}

/* ⚠ 这里的关键是「气泡不能撑满整行」：
   原来我写了 max-width:88% + .tk-msg-main{flex:1}

，
   但整行宽度是父容器的 100%，消息自然就占满了 88%，
   于是 .tk-msg.staff{margin-left:auto}

**看不出任何效果** ——
   左右分侧形同虚设（截图确认过：两边都贴左边）。
   现在改成"按内容宽度 + 上限 76%"，这样短消息只占一小块，
   margin-left:auto 才能把管理组的消息推到右边去。 */
.tk-msg{
  display:flex;gap:10px;align-items:flex-start;
  max-width:76%;width:fit-content;
}

.tk-msg.staff{margin-left:auto;flex-direction:row-reverse}

.tk-msg-av{
  flex:0 0 auto;width:32px;height:32px;border-radius:10px;
  display:grid;place-items:center;font-size:15px;
  background:rgba(255,255,255,.06);color:#9fc6e8;
  border:1px solid rgba(255,255,255,.1);
}

.tk-msg.staff .tk-msg-av{
  background:rgba(56,189,248,.16);color:#7dd3fc;
  border-color:rgba(56,189,248,.3);
}

.tk-msg-main{
  min-width:0;flex:0 1 auto;
  background:rgba(255,255,255,.032);
  border:1px solid rgba(255,255,255,.075);
  border-radius:13px;padding:11px 14px;
}

.tk-msg.staff .tk-msg-main{
  background:rgba(56,189,248,.075);
  border-color:rgba(56,189,248,.22);
}

.tk-msg-head{
  display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-bottom:6px;
}

.tk-msg-who{font-size:.83rem;font-weight:600;color:var(--text,#e8f1ff)}

.tk-msg-side{
  font-size:.66rem;font-weight:700;padding:2px 7px;border-radius:5px;
  letter-spacing:.02em;
}

.tk-msg-side.user{background:rgba(148,163,184,.18);color:#c3cfe0}

.tk-msg-side.staff{background:rgba(56,189,248,.22);color:#7dd3fc}

.tk-msg-kind{
  font-size:.66rem;font-weight:700;padding:2px 7px;border-radius:5px;
  background:rgba(234,179,8,.16);color:#fcd34d;
}

.tk-msg-at{margin-left:auto;font-size:.7rem;color:rgba(148,163,184,.85);white-space:nowrap}

.tk-msg-title{font-weight:600;font-size:.9rem;margin-bottom:5px;color:var(--text,#e8f1ff)}

.tk-msg-body{
  font-size:.86rem;line-height:1.72;color:#c9d6e6;
  white-space:pre-wrap;word-break:break-word;
}

.tk-msg-contact{margin-top:8px;font-size:.74rem;color:rgba(148,163,184,.9)}

.tk-msg-contact i{margin-right:4px}

/* 回复框（玩家补充 / 管理组回复共用） */
.tk-reply-form{
  margin-top:14px;padding:14px 16px;border-radius:13px;
  background:rgba(255,255,255,.022);
  border:1px solid rgba(255,255,255,.08);
}

.tk-reply-head{
  display:flex;align-items:center;gap:8px;margin-bottom:10px;
  font-size:.86rem;font-weight:600;color:var(--text,#e8f1ff);
}

.tk-reply-head i{color:#38bdf8}

.tk-reply-hint{
  margin-left:auto;font-size:.72rem;font-weight:400;color:rgba(148,163,184,.9);
}

.tk-reply-form textarea{
  width:100%;min-height:74px;resize:vertical;
  background:#0b1220;border:1px solid var(--line,rgba(255,255,255,.12));
  border-radius:10px;padding:11px 13px;color:var(--text,#e8f1ff);
  font-size:.88rem;line-height:1.7;font-family:inherit;outline:none;
}

.tk-reply-form textarea:focus{border-color:rgba(56,189,248,.5)}

.tk-reply-acts{display:flex;justify-content:flex-end;margin-top:10px}

/* 时间线挪到对话下面，加一条分隔线 */
.tk-tl-foot{
  margin-top:16px;padding-top:16px;
  border-top:1px solid rgba(255,255,255,.07);
}

/* 处理结果的补充说明 */
.tk-result-foot{
  margin-top:9px;padding-top:9px;font-size:.76rem;line-height:1.7;
  color:rgba(148,163,184,.9);
  border-top:1px dashed rgba(148,163,184,.2);
}

/* 未登录态的查询框 */
.tk-query{display:flex;gap:10px;margin-top:16px;flex-wrap:wrap}

.tk-query .ap-input{flex:1;min-width:190px}

.tk-query .ap-btn{flex-shrink:0}

.tk-miss{
  display:flex;align-items:center;gap:9px;flex-wrap:wrap;
  margin-top:14px;padding:12px 15px;border-radius:12px;
  background:rgba(248,113,113,.08);
  border:1px solid rgba(248,113,113,.28);
  font-size:13px;color:#fca5a5;
}

.tk-miss a{color:#fca5a5;text-decoration:underline}

.tk-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}

@media (max-width:640px){
  /* 手机上左右分栏太挤：全部改成全宽堆叠，气泡占满一行 */
  .tk-msg{max-width:100%}
  .tk-msg.staff{margin-left:0;flex-direction:row}
  .tk-msg-at{margin-left:0;width:100%;order:9}
  .tk-reply-hint{margin-left:0;width:100%;order:9}
  .tk-reply-head{flex-wrap:wrap}
}

/* ============================================================================
   工单 / 入职申请的「卡片 + 折叠」样式
   ----------------------------------------------------------------------------
   ★ 为什么放在这里而不是某个模板的 <style> 里：
     这套卡片样式原来内联在 templates/admin/tickets.html 中，只有那一个页面有。
     现在入职申请（后台 + 门户）也要用同样的卡片与折叠交互 ——
     留在工单模板里的话另外两个页面就没样式了（"某个主题漏了样式"的老坑）。
     工单组件样式统一集中在本文件，三个 base 模板都会加载。
   ========================================================================== */
/* ---------------- 工单卡片列表 ---------------- */
.tk-cards{display:flex;flex-direction:column;gap:12px}
.tk-item{
  background:var(--card);border:1px solid var(--line);border-radius:13px;
  overflow:hidden;transition:border-color .18s ease;
}
.tk-item:hover{border-color:rgba(56,189,248,.3)}
.tk-item.is-closed{opacity:.86}
.tk-item-head{
  display:flex;align-items:center;gap:14px;flex-wrap:wrap;
  padding:13px 16px;border-bottom:1px solid rgba(255,255,255,.05);
}
.tk-item-id{display:flex;align-items:center;gap:8px;flex-shrink:0}
.tk-item-who{
  display:flex;align-items:center;gap:6px;font-size:.86rem;
  color:var(--text);min-width:0;
}
.tk-item-who b{font-weight:600;max-width:150px;overflow:hidden;
  text-overflow:ellipsis;white-space:nowrap}
.tk-item-when{font-size:.76rem;color:var(--muted);white-space:nowrap}
.tk-item-state{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.tk-item-acts{margin-left:auto;display:flex;gap:7px;align-items:center}
.tk-item-sub{
  display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:10px 16px;
}
.tk-item-title{
  font-weight:600;font-size:.92rem;color:var(--text);flex:1;min-width:0;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.tk-toggle{
  display:inline-flex;align-items:center;gap:6px;flex-shrink:0;
  background:rgba(56,189,248,.08);border:1px solid rgba(56,189,248,.24);
  color:#9fd4f5;border-radius:9px;padding:6px 11px;font-size:.78rem;
  cursor:pointer;font-family:inherit;transition:all .16s ease;
}
.tk-toggle:hover{background:rgba(56,189,248,.16);color:#7dd3fc}
.tk-toggle i{transition:transform .2s ease}
.tk-item.open .tk-toggle i{transform:rotate(180deg)}
.tk-item-body{padding:0 16px 16px}
/* 折叠时只显示"最新一条"，展开后隐藏它（避免重复显示） */
.tk-item.open .tk-latest{display:none}
.tk-full{display:none}
.tk-item.open .tk-full{display:block}
.tk-msg-latest{background:rgba(255,255,255,.02);border-radius:11px;padding:11px 13px}
.tk-empty-box{
  text-align:center;padding:52px;color:var(--muted);
  background:var(--card);border:1px solid var(--line);border-radius:13px;
}
@media (max-width:820px){
  .tk-item-acts{margin-left:0;width:100%}
  .tk-item-head{gap:10px}
}


/* ============================================================================
   工单指派 / 流转记录
   ----------------------------------------------------------------------------
   对应 templates/admin/assigned.html 与 tickets.html 的指派弹窗。
   放在 tickets.css（三个主题都加载），避免"某个主题漏了样式"。
   ========================================================================== */
.asg-note{
  display:flex;flex-direction:column;gap:9px;
  padding:12px 14px;border-radius:12px;margin-bottom:16px;
  font-size:0.86rem;line-height:1.7;
  background:rgba(41,151,255,.08);border:1px solid rgba(41,151,255,.22);
  color:var(--text-2,#cbd5e1);
}
.asg-note i{color:#38bdf8;margin-right:5px}
.asg-note-act{display:flex;gap:8px;flex-wrap:wrap}

/* "已指派给某角色"的小标 */
.asg-chip{
  display:inline-flex;align-items:center;gap:5px;
  padding:2px 8px;border-radius:20px;font-size:0.72rem;font-weight:600;
  color:#c4b5fd;background:rgba(139,92,246,.14);
  border:1px solid rgba(139,92,246,.30);white-space:nowrap;
}
.asg-chip i{font-size:0.7rem}
.asg-done{
  display:inline-flex;align-items:center;gap:5px;
  font-size:0.74rem;color:#34d399;
}

/* 流转记录时间线 */
.asg-log{
  margin:10px 0 14px;padding:11px 13px;border-radius:12px;
  background:rgba(255,255,255,.028);border:1px solid var(--line);
}
.asg-log-h{
  display:flex;align-items:center;gap:7px;
  font-size:0.82rem;font-weight:600;color:var(--text);
  padding-bottom:9px;margin-bottom:9px;border-bottom:1px solid var(--line);
}
.asg-log-h i{color:#8b5cf6}
.asg-log-row{
  display:grid;grid-template-columns:12px 1fr auto;gap:9px;
  align-items:start;padding:6px 0;font-size:0.8rem;
  color:var(--text-2,#cbd5e1);position:relative;
}
.asg-log-dot{
  width:8px;height:8px;border-radius:50%;margin-top:5px;
  background:#8b5cf6;box-shadow:0 0 0 3px rgba(139,92,246,.16);
}
.asg-log-row.act-closed .asg-log-dot{background:#34d399;
  box-shadow:0 0 0 3px rgba(52,211,153,.16)}
.asg-log-row.act-unassign .asg-log-dot{background:#94a3b8;
  box-shadow:0 0 0 3px rgba(148,163,184,.16)}
.asg-log-tx b{color:var(--text);font-weight:600}
.asg-log-note{
  display:block;margin-top:3px;color:var(--muted);
  font-size:0.76rem;line-height:1.55;
}
.asg-log-at{color:var(--muted);font-size:0.72rem;white-space:nowrap;
  font-variant-numeric:tabular-nums}

/* 侧栏蓝色气泡（指派待办） */
.sb-badge-blue{
  background:linear-gradient(135deg,#22d3ee,#0ea5e9) !important;
  box-shadow:0 2px 8px rgba(34,211,238,.32);
}

/* 窄屏：流转记录改为堆叠，时间换行 */
@media (max-width:640px){
  .asg-log-row{grid-template-columns:12px 1fr;gap:7px}
  .asg-log-at{grid-column:2;font-size:0.7rem}
  .asg-chip{font-size:0.68rem;padding:2px 6px}
}
