/* ==========================================================================
   智能工单反馈系统 · 前端设计系统
   轻量专业 · OKLCH 色彩体系 · 公共面向
   ========================================================================== */

/* ==========================================================================
   1. 设计令牌
   ========================================================================== */
:root {
  /* ---- 色彩 ---- */
  --bg:          oklch(0.975 0.004 255);   /* 极浅蓝灰基底 */
  --surface:     oklch(1 0 0);             /* 纯白卡片 */
  --surface-2:   oklch(0.965 0.006 255);   /* 次级面板 / 输入框底 */
  --ink:         oklch(0.25 0.02 256);     /* 深石板主文本 */
  --ink-2:       oklch(0.43 0.018 256);    /* 次级文本 */
  --muted:       oklch(0.6 0.014 255);     /* 辅助 / 占位文本 */
  --muted-2:     oklch(0.72 0.01 255);     /* 更浅辅助文本 */

  --brand:       oklch(0.52 0.16 260);     /* 品牌蓝 */
  --brand-hover: oklch(0.46 0.18 260);     /* hover 加深 */
  --brand-active:oklch(0.40 0.19 260);     /* active / pressed */
  --brand-soft:  oklch(0.52 0.16 260 / 0.08);  /* 轻柔背景 */
  --brand-line:  oklch(0.52 0.16 260 / 0.22);  /* 边框 / 分割线 */

  --success:     oklch(0.58 0.14 152);
  --success-bg:  oklch(0.58 0.14 152 / 0.10);
  --warn:        oklch(0.70 0.15 68);
  --warn-bg:     oklch(0.70 0.15 68 / 0.10);
  --danger:      oklch(0.56 0.20 27);
  --danger-bg:   oklch(0.56 0.20 27 / 0.10);

  --border:      oklch(0.90 0.008 255);    /* 默认边框 */
  --border-2:    oklch(0.86 0.012 255);    /* 强调边框 / hover */

  /* ---- 阴影（OKLCH alpha 多层级） ---- */
  --shadow-xs:   0 1px 2px oklch(0.25 0.02 256 / 0.04);
  --shadow-sm:   0 1px 3px oklch(0.25 0.02 256 / 0.06),
                 0 1px 2px oklch(0.25 0.02 256 / 0.03);
  --shadow-md:   0 4px 14px oklch(0.25 0.02 256 / 0.07),
                 0 1px 3px oklch(0.25 0.02 256 / 0.04);
  --shadow-lg:   0 10px 36px oklch(0.25 0.02 256 / 0.09),
                 0 3px 8px  oklch(0.25 0.02 256 / 0.05);
  --shadow-xl:   0 20px 60px oklch(0.25 0.02 256 / 0.12),
                 0 6px 16px oklch(0.25 0.02 256 / 0.06);
  --shadow-focus:0 0 0 4px oklch(0.52 0.16 260 / 0.18);

  /* ---- 圆角 ---- */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-pill: 999px;

  /* ---- 间距比例 ---- */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-2xl: 48px;

  /* ---- 版式 ---- */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
}


/* ==========================================================================
   2. 重置 / 基础
   ========================================================================== */
*,
*::before,
*::after { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.18s ease;
}
a:hover { color: var(--brand-hover); }

button { font-family: inherit; cursor: pointer; }

input,
textarea,
select {
  font-family: inherit;
  font-size: 15px;
}

img { max-width: 100%; display: block; }

ul, ol { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  color: var(--ink);
}

/* 选中态 */
::selection {
  background: oklch(0.52 0.16 260 / 0.22);
  color: var(--ink);
}


/* ==========================================================================
   3. 容器
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

.container-sm {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

.container-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}


/* ==========================================================================
   4. 页面分区
   ========================================================================== */
.page-section {
  padding: var(--sp-2xl) 0;
}

.page-section-sm {
  padding: var(--sp-lg) 0;
}


/* ==========================================================================
   5. 导航栏
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: oklch(1 0 0 / 0.80);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

/* ---- 品牌 ---- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--brand), oklch(0.58 0.14 230));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  box-shadow: var(--shadow-sm);
}

/* ---- 导航链接 ---- */
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a,
.nav-link {
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  transition: all 0.18s ease;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-link:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

.nav-links a.active,
.nav-link.active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}

/* ---- 导航右侧操作区 ---- */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

/* ---- 移动端菜单切换 ---- */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--r-sm);
  transition: background 0.18s ease;
}

.nav-toggle:hover {
  background: var(--surface-2);
}


/* ==========================================================================
   6. 按钮
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border: none;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  transition: all 0.18s ease;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-2);
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* ---- 变体 ---- */
.btn-primary {
  background: var(--brand);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary:active {
  background: var(--brand-active);
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--border-2);
}

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-2);
}
.btn-ghost:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand-line);
}

.btn-soft {
  background: var(--brand-soft);
  color: var(--brand);
  border: none;
}
.btn-soft:hover {
  background: oklch(0.52 0.16 260 / 0.14);
  color: var(--brand-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
}
.btn-danger:hover {
  background: oklch(0.48 0.22 27);
}

/* ---- 尺寸 ---- */
.btn-lg {
  height: 50px;
  font-size: 16px;
  padding: 0 28px;
}
.btn-sm {
  height: 36px;
  font-size: 13px;
  padding: 0 14px;
  border-radius: var(--r-sm);
}
.btn-xs {
  height: 28px;
  font-size: 12px;
  padding: 0 10px;
  border-radius: var(--r-sm);
}

/* ---- 状态 ---- */
.btn:disabled,
.btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-block {
  width: 100%;
}

/* ---- 图标按钮 ---- */
.btn-icon {
  width: 44px;
  padding: 0;
}
.btn-icon.btn-sm {
  width: 36px;
}
.btn-icon.btn-xs {
  width: 28px;
}


/* ==========================================================================
   7. 卡片
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad {
  padding: var(--sp-xl);
}

.card-header {
  padding: var(--sp-lg) var(--sp-xl) 0;
}

.card-header h2 {
  font-size: 19px;
  font-weight: 700;
}

.card-header p {
  color: var(--muted);
  font-size: 14px;
  margin-top: var(--sp-xs);
}

.card-footer {
  padding: var(--sp-md) var(--sp-xl);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-sm);
}

/* ---- 卡片变体 ---- */
.card-hover:hover {
  border-color: var(--brand-line);
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.card-bordered {
  box-shadow: none;
}

.card-flat {
  box-shadow: none;
  border: none;
}


/* ==========================================================================
   8. 表单
   ========================================================================== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 7px;
}

.form-group .hint {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

.form-group .error {
  display: block;
  font-size: 12px;
  color: var(--danger);
  margin-top: 5px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
}

/* ---- 输入框 ---- */
.input,
.textarea,
.select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--ink);
  transition: all 0.18s ease;
  outline: none;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--border-2);
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: var(--shadow-focus);
}

.input.error,
.textarea.error,
.select.error {
  border-color: var(--danger);
}

.input.error:focus,
.textarea.error:focus,
.select.error:focus {
  box-shadow: 0 0 0 4px var(--danger-bg);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--surface-2);
}

/* ---- 文本域 ---- */
.textarea {
  height: auto;
  min-height: 130px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.65;
}

/* ---- 下拉框 ---- */
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ---- 输入框带图标 ---- */
.input-wrap {
  position: relative;
}

.input-wrap .input {
  padding-left: 44px;
}

.input-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  pointer-events: none;
}

/* ---- 验证码输入组 ---- */
.code-input-group {
  display: flex;
  gap: 10px;
}

.code-input-group .input {
  flex: 1;
}

.btn-code {
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 120px;
}

/* ---- 复选框 / 单选 ---- */
.checkbox-label,
.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
}


/* ==========================================================================
   9. Hero 区域（首页）
   ========================================================================== */
.hero {
  padding: 80px 0 60px;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  margin-bottom: 22px;
}

.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 18ch;
  margin: 0 auto;
  text-wrap: balance;
}

.hero p {
  font-size: 17px;
  color: var(--ink-2);
  max-width: 56ch;
  margin: 20px auto 0;
  line-height: 1.7;
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 36px;
  flex-wrap: wrap;
}


/* ==========================================================================
   10. 特性卡片（首页）
   ========================================================================== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-lg);
  padding: var(--sp-lg) 0 80px;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-xs);
  transition: all 0.22s ease;
}

.feature:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--brand-line);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  display: grid;
  place-items: center;
  color: var(--brand);
  margin-bottom: 16px;
  font-size: 20px;
}

.feature h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.feature p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}


/* ==========================================================================
   11. 页面标题 / 操作栏
   ========================================================================== */
.page-head {
  padding: 40px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-md);
}

.page-head h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.page-head p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}


/* ==========================================================================
   12. 工单列表
   ========================================================================== */
.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0 60px;
}

.ticket-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
  transition: all 0.18s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
}

.ticket-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-line);
  transform: translateY(-1px);
}

.ticket-item-main {
  flex: 1;
  min-width: 0;
}

.ticket-item-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-item-meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.ticket-item-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

/* ---- 工单筛选 / 搜索 ---- */
.ticket-filters {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 8px 0;
  flex-wrap: wrap;
}

.ticket-filters .input-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}


/* ==========================================================================
   13. 状态标签
   ========================================================================== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.tag-pending {
  background: oklch(0.70 0.15 68 / 0.12);
  color: oklch(0.52 0.16 68);
}

.tag-replied {
  background: oklch(0.52 0.16 260 / 0.10);
  color: var(--brand);
}

.tag-done {
  background: oklch(0.58 0.14 152 / 0.12);
  color: oklch(0.42 0.14 152);
}
.tag-unreplied {
  background: #fee2e2;
  color: #dc2626;
}

.tag-closed {
  background: oklch(0.6 0.014 255 / 0.12);
  color: var(--muted);
}

/* ---- 徽章 ---- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  border-radius: var(--r-pill);
  line-height: 1;
}

.badge-danger {
  background: var(--danger);
}


/* ==========================================================================
   14. 空状态
   ========================================================================== */
.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--muted);
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  opacity: 0.35;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: var(--sp-lg);
}


/* ==========================================================================
   15. 工单详情
   ========================================================================== */
.ticket-detail {
  padding: 8px 0 60px;
}

.ticket-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ticket-title-row h2 {
  font-size: 22px;
  font-weight: 700;
}

.ticket-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
}

.ticket-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ticket-meta-item .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ticket-meta-item .value {
  font-size: 14px;
  color: var(--ink-2);
  font-weight: 600;
}

/* ---- 对话区 ---- */
.conversation {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  margin-top: var(--sp-lg);
}

.msg {
  display: flex;
  gap: 12px;
}

.msg-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.msg-user .msg-avatar   { background: var(--brand); }
.msg-admin .msg-avatar  { background: oklch(0.38 0.02 256); }
.msg-ai .msg-avatar     { background: oklch(0.58 0.14 152); }

.msg-content {
  flex: 1;
  min-width: 0;
}

.msg-bubble {
  max-width: 76%;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}

.msg-user .msg-bubble {
  background: var(--brand-soft);
  color: var(--ink);
  border-top-left-radius: 4px;
}

.msg-admin .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-right-radius: 4px;
  box-shadow: var(--shadow-xs);
}

.msg-ai .msg-bubble {
  background: oklch(0.58 0.14 152 / 0.08);
  border: 1px solid oklch(0.58 0.14 152 / 0.18);
  border-top-right-radius: 4px;
}

.msg-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.msg-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* ---- 回复区 ---- */
.reply-area {
  margin-top: var(--sp-lg);
}

.reply-area textarea {
  min-height: 100px;
}


/* ==========================================================================
   16. 提示 / 通知
   ========================================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 1.55;
  border: 1px solid transparent;
}

.alert-info {
  background: oklch(0.52 0.16 260 / 0.07);
  border-color: oklch(0.52 0.16 260 / 0.15);
  color: var(--ink-2);
}

.alert-success {
  background: var(--success-bg);
  border-color: oklch(0.58 0.14 152 / 0.20);
  color: oklch(0.38 0.14 152);
}

.alert-warning {
  background: var(--warn-bg);
  border-color: oklch(0.70 0.15 68 / 0.20);
  color: oklch(0.48 0.16 68);
}

.alert-danger {
  background: var(--danger-bg);
  border-color: oklch(0.56 0.20 27 / 0.20);
  color: oklch(0.40 0.20 27);
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  min-width: 260px;
  max-width: 480px;
  animation: toastIn 0.25s ease;
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-danger {
  border-left: 3px solid var(--danger);
}

.toast-warning {
  border-left: 3px solid var(--warn);
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}


/* ==========================================================================
   17. 用户中心
   ========================================================================== */
.profile-header {
  display: flex;
  align-items: center;
  gap: var(--sp-lg);
  padding: var(--sp-xl) 0;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-info h2 {
  font-size: 20px;
  font-weight: 700;
}

.profile-info p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}

/* ---- 标签页 ---- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  margin-bottom: var(--sp-lg);
}

.tab {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}


/* ==========================================================================
   18. 进度 / 步骤指示器
   ========================================================================== */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  margin-bottom: var(--sp-xl);
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
}

.step:not(:last-child)::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
}

.step.completed:not(:last-child)::after {
  background: var(--brand);
}

.step-marker {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  border: 2px solid var(--border);
  flex-shrink: 0;
  line-height: 1;
}

.step.active .step-marker {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.step.completed .step-marker {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.step-label {
  font-size: 13px;
  color: var(--muted);
  margin-left: 10px;
  white-space: nowrap;
  font-weight: 500;
}

.step.active .step-label {
  color: var(--brand);
  font-weight: 600;
}

.step.completed .step-label {
  color: var(--ink-2);
}


/* ==========================================================================
   19. 分页
   ========================================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 32px 0;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.pagination a:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--brand);
}

.pagination a.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  font-weight: 600;
}

.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}


/* ==========================================================================
   20. 页脚
   ========================================================================== */
.footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 36px 0 28px;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-xl);
  margin-bottom: var(--sp-xl);
}

.footer-col h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.footer-col p,
.footer-col a {
  font-size: 13px;
  color: var(--muted);
  line-height: 2;
  display: block;
  transition: color 0.15s ease;
}

.footer-col a:hover {
  color: var(--brand);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--sp-md);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: var(--sp-sm);
}


/* ==========================================================================
   21. 分隔线
   ========================================================================== */
.divider {
  border: none;
  height: 1px;
  background: var(--border);
  margin: var(--sp-lg) 0;
}

.divider-sm {
  margin: var(--sp-md) 0;
}

.divider-lg {
  margin: var(--sp-xl) 0;
}


/* ==========================================================================
   22. 加载状态
   ========================================================================== */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.spinner-lg {
  width: 36px;
  height: 36px;
  border-width: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 14px;
}


/* ==========================================================================
   23. 登录 / 注册卡片
   ========================================================================== */
.auth-card {
  max-width: 420px;
  margin: 48px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: var(--sp-xl) var(--sp-xl) 40px;
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: var(--sp-xl);
}

.auth-card .form-group {
  margin-bottom: 18px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  margin: var(--sp-lg) 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-links {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: var(--sp-md);
}

.auth-links a {
  font-weight: 600;
}


/* ==========================================================================
   24. 查询 / 跟踪页面
   ========================================================================== */
.query-section {
  padding: 60px 0;
  text-align: center;
}

.query-section h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}

.query-section > p {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: var(--sp-xl);
}

.query-form {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
}

.query-form .input-wrap {
  flex: 1;
}

.query-result {
  max-width: 640px;
  margin: var(--sp-xl) auto 0;
  text-align: left;
}


/* ==========================================================================
   25. 搜索栏
   ========================================================================== */
.search-bar {
  position: relative;
  width: 100%;
  max-width: 420px;
}

.search-bar .input {
  padding-left: 42px;
  height: 42px;
  border-radius: var(--r-pill);
}

.search-bar-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  pointer-events: none;
}


/* ==========================================================================
   26. 响应式
   ========================================================================== */
@media (max-width: 900px) {
  .container { padding: 0 var(--sp-md); }
  .container-sm { padding: 0 var(--sp-md); }
  .container-narrow { padding: 0 var(--sp-md); }

  .hero { padding: 50px 0 40px; }
  .hero p { font-size: 16px; }

  .features { gap: var(--sp-md); }

  .ticket-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .ticket-item-right {
    align-self: flex-end;
  }

  .ticket-filters .input-wrap {
    max-width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .msg-bubble {
    max-width: 90%;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .navbar-inner { height: 56px; }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: var(--sp-sm);
    gap: 2px;
    box-shadow: var(--shadow-md);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a,
  .nav-link {
    width: 100%;
    border-radius: var(--r-sm);
    padding: 10px 14px;
  }

  .nav-toggle {
    display: flex;
  }

  .hero { padding: 36px 0 28px; }
  .hero h1 { font-size: 26px; }
  .hero-actions { flex-direction: column; align-items: center; }

  .features {
    grid-template-columns: 1fr;
    padding-bottom: 40px;
  }

  .auth-card {
    margin: 24px 16px;
    padding: var(--sp-lg) var(--sp-md) var(--sp-xl);
    border-radius: var(--r-lg);
  }

  .query-form {
    flex-direction: column;
  }

  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head-actions { width: 100%; }

  .ticket-meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .steps {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .step { width: 100%; }
  .step:not(:last-child)::after {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-lg);
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .code-input-group {
    flex-direction: column;
  }

  .code-input-group .input-code {
    height: 50px;
    font-size: 18px;
    letter-spacing: 4px;
    text-align: center;
  }

  .code-input-group .btn-code {
    height: 50px;
    font-size: 16px;
  }

  .container-sm .card-pad {
    padding: 24px 20px 32px;
  }
}


/* ==========================================================================
   27. 工具类
   ========================================================================== */
/* ---- 文本 ---- */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

.text-sm  { font-size: 13px; }
.text-xs  { font-size: 12px; }
.text-lg  { font-size: 17px; }
.text-xl  { font-size: 19px; }

.text-muted        { color: var(--muted); }
.text-muted-2      { color: var(--muted-2); }
.text-brand        { color: var(--brand); }
.text-danger       { color: var(--danger); }
.text-success      { color: oklch(0.42 0.14 152); }
.text-ink-2        { color: var(--ink-2); }

.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- 间距 ---- */
.mt-sm  { margin-top: var(--sp-sm); }
.mt-md  { margin-top: var(--sp-md); }
.mt-lg  { margin-top: var(--sp-lg); }
.mt-xl  { margin-top: var(--sp-xl); }
.mb-sm  { margin-bottom: var(--sp-sm); }
.mb-md  { margin-bottom: var(--sp-md); }
.mb-lg  { margin-bottom: var(--sp-lg); }
.mb-xl  { margin-bottom: var(--sp-xl); }

.pad-lg { padding: var(--sp-lg); }
.pad-xl { padding: var(--sp-xl); }

.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }

/* ---- 布局 ---- */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.flex-center   { display: flex; justify-content: center; align-items: center; }
.flex-between  { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }
.shrink-0      { flex-shrink: 0; }

.w-full  { width: 100%; }
.hidden  { display: none; }
.relative{ position: relative; }

/* ---- 卡片宽高约束 ---- */
.min-h-screen { min-height: 100vh; }

/* ---- 打印 ---- */
@media print {
  .navbar,
  .footer,
  .no-print { display: none !important; }
}

/* ==========================================================================
   12. IM 对话气泡
   ========================================================================== */
.conversation {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.msg {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 85%;
}
.msg-user {
  align-self: flex-start;
}
.msg-admin,
.msg-ai {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}
.msg-user .msg-avatar {
  background: var(--ink-2, #94a3b8);
}
.msg-admin .msg-avatar {
  background: var(--brand, #2563eb);
}
.msg-ai .msg-avatar {
  background: #7c3aed;
}
.msg-bubble {
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  position: relative;
}
.msg-user .msg-bubble {
  background: var(--surface-2, #f1f5f9);
  color: var(--ink, #1e293b);
  border-bottom-left-radius: 4px;
}
.msg-admin .msg-bubble,
.msg-ai .msg-bubble {
  background: var(--brand, #2563eb);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-ai .msg-bubble {
  background: #7c3aed;
}
.msg-meta {
  font-size: 11px;
  color: var(--muted, #94a3b8);
  margin-top: 4px;
}
.msg-admin .msg-meta,
.msg-ai .msg-meta {
  text-align: right;
}
.msg-user .msg-meta {
  text-align: left;
}

/* ---- IM 聊天布局 ---- */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  overflow: hidden;
}
.chat-header {
  flex-shrink: 0;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--border, oklch(0.9 0.008 255));
}
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  scroll-behavior: smooth;
  background: var(--bg, oklch(0.975 0.004 255));
}
.chat-body::-webkit-scrollbar {
  width: 5px;
}
.chat-body::-webkit-scrollbar-thumb {
  background: var(--muted-2, oklch(0.72 0.01 255));
  border-radius: 3px;
}
.chat-footer {
  flex-shrink: 0;
  padding: 12px 0 16px;
  border-top: 1px solid var(--border, oklch(0.9 0.008 255));
  background: var(--bg, oklch(0.975 0.004 255));
}
.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 14px;
  border: 1.5px solid var(--border, oklch(0.9 0.008 255));
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  background: var(--surface-2, oklch(0.965 0.006 255));
  color: var(--ink, #1e293b);
  resize: none;
  outline: none;
  transition: border-color 0.18s ease;
  font-family: inherit;
}
.chat-input:focus {
  border-color: var(--brand, #2563eb);
}
.chat-input::placeholder {
  color: var(--muted, oklch(0.6 0.014 255));
}
.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--brand, #2563eb);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.18s ease, transform 0.12s ease;
}
.chat-send-btn:hover {
  background: var(--brand-hover, oklch(0.46 0.18 260));
}
.chat-send-btn:active {
  transform: scale(0.92);
}
.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.chat-status-bar {
  font-size: 12px;
  color: var(--muted, oklch(0.6 0.014 255));
  text-align: center;
  padding: 4px 0 0;
}
.chat-divider {
  text-align: center;
  font-size: 12px;
  color: var(--muted, oklch(0.6 0.014 255));
  position: relative;
  margin: 8px 0;
}
.chat-divider::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 1px;
  background: var(--border, oklch(0.9 0.008 255));
  transform: translateY(-50%);
  z-index: 0;
}
.chat-divider span {
  background: var(--surface, #fff);
  padding: 0 12px;
  position: relative;
  z-index: 1;
}

/* ---- 已完结提示条 ---- */
.chat-closed-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface-2, oklch(0.965 0.006 255));
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted, oklch(0.6 0.014 255));
}