/* —— 工单中心 · 精致客服台 —— */
.ticket-page {
  --tk-sage: #556357;
  --tk-sage-soft: rgba(85, 99, 87, 0.12);
  --tk-line: rgba(42, 48, 58, 0.1);
  --tk-paper: rgba(255, 255, 255, 0.72);
  --tk-paper-solid: #fbfaf7;
  --tk-ink: #20242b;
  --tk-muted: #757b84;
  --tk-warm: #b9a895;
  padding-top: 112px;
  padding-bottom: 72px;
  max-width: 1180px;
  margin: 0 auto;
}

.tk-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  margin-bottom: 22px;
  padding: 8px 4px 4px;
}

.tk-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tk-warm);
}

.tk-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 3.4vw, 38px);
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.tk-hero-copy p:last-child {
  margin: 0;
  max-width: 42ch;
  color: var(--tk-muted);
  font-size: 15px;
  line-height: 1.55;
}

.tk-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tk-workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: min(78vh, 820px);
  min-height: 560px;
  border-radius: 28px;
  border: 1px solid var(--tk-line);
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(246, 243, 238, 0.92));
  box-shadow:
    0 24px 60px rgba(54, 62, 75, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

/* —— 左侧列表 —— */
.tk-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(248, 245, 240, 0.95), rgba(242, 238, 232, 0.88));
  border-right: 1px solid var(--tk-line);
}

.tk-rail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 18px 14px;
}

.tk-rail-top h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.tk-count {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--tk-sage-soft);
  color: var(--tk-sage);
  font-size: 12px;
  font-weight: 800;
}

.tk-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px 12px 16px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.tk-list-empty {
  margin: 24px 8px;
  padding: 28px 16px;
  text-align: center;
  border-radius: 18px;
  border: 1px dashed rgba(42, 48, 58, 0.14);
  color: var(--tk-muted);
  font-size: 13px;
  line-height: 1.5;
}

.tk-list-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.tk-list-item:hover {
  background: rgba(255, 255, 255, 0.7);
}

.tk-list-item.is-active {
  background: #fff;
  border-color: rgba(85, 99, 87, 0.22);
  box-shadow: 0 8px 20px rgba(54, 62, 75, 0.06);
}

.tk-list-item strong {
  font-size: 13.5px;
  letter-spacing: -0.02em;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tk-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tk-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(185, 168, 149, 0.2);
  color: #6a5a48;
}

.tk-pill.is-open,
.tk-pill.is-pending_admin {
  background: var(--tk-sage-soft);
  color: var(--tk-sage);
}

.tk-pill.is-closed {
  background: rgba(42, 48, 58, 0.08);
  color: var(--tk-muted);
}

.tk-list-item time {
  font-size: 11px;
  color: var(--tk-muted);
}

/* —— 右侧舞台 —— */
.tk-stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 50% at 100% 0%, rgba(185, 168, 149, 0.14), transparent 55%),
    var(--tk-paper-solid);
}

.tk-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.tk-panel[hidden],
.tk-emoji[hidden] {
  display: none !important;
}

.tk-panel-head {
  flex-shrink: 0;
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--tk-line);
}

.tk-panel-head h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.04em;
}

/* —— 创建：左右双栏 —— */
.tk-create-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 0.92fr) minmax(0, 1.2fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.tk-cat-pane,
.tk-form-pane {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px 22px 24px;
}

.tk-cat-pane {
  border-right: 1px solid var(--tk-line);
  background: rgba(255, 255, 255, 0.35);
}

.tk-section-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--tk-ink);
}

.tk-section-desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--tk-muted);
  line-height: 1.45;
  min-height: 1.45em;
}

.tk-cats {
  display: grid;
  gap: 6px;
  padding-bottom: 12px;
}

.tk-cat {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.tk-cat:hover {
  background: rgba(255, 255, 255, 0.75);
}

.tk-cat.is-active {
  background: #fff;
  border-color: rgba(85, 99, 87, 0.28);
  box-shadow: 0 6px 16px rgba(54, 62, 75, 0.05);
}

.tk-cat strong {
  font-size: 13.5px;
  letter-spacing: -0.02em;
}

.tk-cat span {
  font-size: 12px;
  color: var(--tk-muted);
  line-height: 1.4;
}

.tk-field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--tk-muted);
}

.tk-field input,
.tk-field textarea,
.tk-composer-row textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 16px;
  border: 1px solid var(--tk-line);
  background: rgba(255, 255, 255, 0.92);
  padding: 13px 15px;
  font: inherit;
  font-weight: 400;
  letter-spacing: normal;
  color: var(--tk-ink);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tk-field input:focus,
.tk-field textarea:focus,
.tk-composer-row textarea:focus {
  outline: none;
  border-color: rgba(85, 99, 87, 0.42);
  box-shadow: 0 0 0 4px rgba(85, 99, 87, 0.1);
}

.tk-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tk-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--tk-line);
  background: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--tk-ink);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tk-tool-btn:hover {
  background: #fff;
  border-color: rgba(85, 99, 87, 0.25);
}

.tk-attach {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tk-attach img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--tk-line);
  cursor: pointer;
}

.tk-emoji {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 10px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--tk-line);
  background: rgba(255, 255, 255, 0.9);
  max-height: 132px;
  overflow: auto;
}

.tk-emoji button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
}

.tk-emoji button:hover {
  background: var(--tk-sage-soft);
}

.tk-form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--tk-line);
}

.tk-hint {
  margin: 0;
  flex: 1;
  min-width: 140px;
  font-size: 13px;
  color: #8a4b4b;
  min-height: 1.2em;
}

/* —— 聊天 —— */
.tk-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--tk-line);
  flex-shrink: 0;
}

.tk-chat-titles em {
  display: block;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: var(--tk-muted);
  margin-bottom: 4px;
}

.tk-chat-titles h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.tk-status {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: var(--tk-sage-soft);
  color: var(--tk-sage);
}

.tk-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 24px;
  background:
    linear-gradient(180deg, transparent, rgba(246, 243, 238, 0.5));
}

.tk-bubble {
  max-width: min(72%, 520px);
  padding: 12px 16px;
  border-radius: 18px 18px 18px 6px;
  background: #fff;
  border: 1px solid var(--tk-line);
  align-self: flex-start;
  animation: tk-pop 0.28s ease;
}

.tk-bubble.is-me {
  align-self: flex-end;
  border-radius: 18px 18px 6px 18px;
  background: rgba(85, 99, 87, 0.14);
  border-color: rgba(85, 99, 87, 0.16);
}

.tk-bubble.is-admin {
  background: rgba(185, 168, 149, 0.18);
  border-color: rgba(185, 168, 149, 0.28);
}

@keyframes tk-pop {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.tk-bubble .who {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--tk-muted);
  margin-bottom: 4px;
}

.tk-bubble .text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.55;
}

.tk-bubble .time {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--tk-muted);
}

.tk-bubble-imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tk-bubble-imgs img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 12px;
}

.tk-composer {
  flex-shrink: 0;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--tk-line);
  background: rgba(255, 255, 255, 0.7);
}

.tk-composer-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.tk-composer-row textarea {
  min-height: 44px;
  max-height: 120px;
  resize: none;
  border-radius: 14px;
  padding: 11px 14px;
}

.tk-icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid var(--tk-line);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  color: var(--tk-ink);
}

.tk-icon-btn:hover {
  border-color: rgba(85, 99, 87, 0.3);
}

/* —— 登录 —— */
.tk-login {
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.tk-login-card {
  text-align: center;
  max-width: 360px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.tk-login-card h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.04em;
}

.tk-login-card p {
  margin: 0 0 8px;
  color: var(--tk-muted);
  line-height: 1.5;
}

@media (max-width: 960px) {
  .tk-workspace {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .tk-rail {
    border-right: 0;
    border-bottom: 1px solid var(--tk-line);
    max-height: 220px;
  }

  .tk-create-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    overflow: visible;
  }

  .tk-cat-pane {
    border-right: 0;
    border-bottom: 1px solid var(--tk-line);
    max-height: 280px;
    height: auto;
  }

  .tk-form-pane {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .tk-composer-row {
    grid-template-columns: auto auto 1fr;
  }

  .tk-composer-row .primary-btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .tk-hero {
    padding-left: 2px;
  }

  .tk-panel-head,
  .tk-chat-head,
  .tk-cat-pane,
  .tk-form-pane {
    padding-left: 16px;
    padding-right: 16px;
  }

  .tk-messages {
    padding: 16px;
  }
}
