:root {
  --bg: #f1f5f9;
  --card: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0f766e;
  --brand-soft: #ccfbf1;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.topbar h1 { font-size: 17px; margin: 0; flex: 1; font-weight: 650; }
.topbar .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.online-switch {
  display: inline-flex; align-items: center; gap: 6px;
  flex: 0 0 auto; user-select: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 10px 5px 6px; background: #fff;
  font-size: 13px; font-weight: 650; color: var(--muted);
}
.online-switch input { position: absolute; opacity: 0; pointer-events: none; }
.online-switch-track {
  width: 34px; height: 20px; border-radius: 999px;
  background: #cbd5e1; position: relative; transition: background .15s;
}
.online-switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(15,23,42,.2); transition: transform .15s;
}
.online-switch.is-on { color: var(--ok); border-color: #86efac; background: #f0fdf4; }
.online-switch.is-on .online-switch-track { background: var(--ok); }
.online-switch.is-on .online-switch-track::after { transform: translateX(14px); }
.online-switch.is-off { color: var(--muted); }
.online-tip {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 12px;
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8;
  font-size: 13px; line-height: 1.45;
}
.icon-btn, .btn {
  border: 0; border-radius: 10px; padding: 10px 14px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.icon-btn {
  background: transparent; color: var(--brand); padding: 8px 10px;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid #fecaca; }
.btn-block { width: 100%; }

.page { flex: 1; padding: 14px; padding-bottom: 32px; }
.page-login {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 100vh; padding: 28px 20px 40px;
  background:
    radial-gradient(900px 420px at 10% -10%, #99f6e4 0%, transparent 55%),
    radial-gradient(700px 380px at 100% 0%, #bae6fd 0%, transparent 50%),
    var(--bg);
}
.login-card {
  background: var(--card); border-radius: 18px; padding: 28px 22px 24px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08); border: 1px solid rgba(255,255,255,.7);
}
.brand {
  font-size: 28px; font-weight: 780; letter-spacing: -0.03em; color: var(--brand);
  margin: 0 0 6px;
}
.brand-desc { color: var(--muted); font-size: 14px; margin: 0 0 24px; line-height: 1.5; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 16px; background: #fff; color: var(--text);
  outline: none;
}
.field input:focus, .field textarea:focus { border-color: #5eead4; box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.field textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.err { color: var(--danger); font-size: 13px; margin: 8px 0 0; min-height: 18px; }
.remember {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); margin: 4px 0 8px; user-select: none;
}
.remember input { width: 16px; height: 16px; }

.filters {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 7px 12px; font-size: 13px; color: var(--muted); cursor: pointer;
}
.chip.active { background: var(--brand-soft); border-color: #5eead4; color: var(--brand); font-weight: 650; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; text-align: center; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--muted); }

.search {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.search input { flex: 1; }

.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 14px; box-shadow: var(--shadow); cursor: pointer;
}
.card:active { background: #f8fafc; }
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card-title { font-weight: 650; font-size: 15px; line-height: 1.35; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 3px; word-break: break-all; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap;
}
.tag-pending { background: #fef2f2; color: var(--danger); }
.tag-processing { background: #fffbeb; color: var(--warn); }
.tag-done { background: #ecfdf5; color: var(--ok); }
.badge-reply { color: var(--danger); font-size: 12px; margin-top: 6px; font-weight: 600; }
.meta-rows { display: grid; gap: 5px; margin-top: 8px; font-size: 13px; }
.meta-row { display: grid; grid-template-columns: 64px 1fr; gap: 8px; line-height: 1.45; }
.meta-row .k { color: var(--muted); }
.meta-row .v { word-break: break-all; }
.snippet {
  margin-top: 8px; background: #f8fafc; border-radius: 8px; padding: 8px 10px;
  font-size: 13px; line-height: 1.5; color: #334155;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.empty, .loading-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 40px 20px; text-align: center; color: var(--muted);
}
.load-more { text-align: center; margin-top: 12px; }

.section {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.section h2 { margin: 0 0 10px; font-size: 15px; }
.kv { display: grid; gap: 8px; font-size: 13px; }
.kv-row { display: grid; grid-template-columns: 84px 1fr; gap: 8px; }
.kv-row .k { color: var(--muted); }
.kv-row .v { word-break: break-all; line-height: 1.45; }
.block-text {
  white-space: pre-wrap; background: #f8fafc; border-radius: 10px;
  padding: 10px 12px; font-size: 14px; line-height: 1.55; margin-top: 4px;
}

.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { position: relative; padding: 0 0 16px 18px; border-left: 2px solid #e2e8f0; margin-left: 6px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 1px #99f6e4;
}
.tl-time { font-size: 12px; color: var(--muted); }
.tl-title { font-size: 14px; font-weight: 650; margin-top: 2px; }
.tl-body { font-size: 13px; color: #475569; margin-top: 4px; line-height: 1.5; white-space: pre-wrap; }

.actions {
  position: sticky; bottom: 0; z-index: 15;
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 8px;
}
.actions .btn { flex: 1; }

.sheet-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40;
  display: flex; align-items: flex-end;
}
.sheet {
  width: 100%; background: #fff; border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 85vh; overflow: auto;
}
.sheet h3 { margin: 0 0 12px; font-size: 17px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 12px; }
.sheet-actions .btn { flex: 1; }

.kf-avatar {
  border-radius: 50%; object-fit: cover; background: #e2e8f0; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
}
.kf-avatar-fallback {
  color: #fff; background: linear-gradient(135deg, #14b8a6, #0f766e);
  font-weight: 700; line-height: 1;
}
.kf-user-row {
  display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1;
}
.kf-user-hit {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer;
  color: inherit;
}
.kf-user-hit h1 { font-size: 17px; margin: 0; font-weight: 650; }
.kf-user-hit .sub {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kf-sheet-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.kf-sheet-head h3 { margin: 0; }
.kf-customer-sheet { max-height: 88vh; }
.kf-info-hero {
  display: flex; align-items: center; gap: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line); margin-bottom: 10px;
}
.kf-info-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.kf-info-row {
  display: flex; align-items: flex-start; gap: 8px; font-size: 13px;
}
.kf-info-row .k { width: 92px; flex: 0 0 92px; color: var(--muted); }
.kf-info-row .v { flex: 1; min-width: 0; word-break: break-all; }
.kf-info-row .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.kf-info-section-title {
  font-size: 13px; font-weight: 700; margin: 4px 0 8px; color: var(--text);
}
.kf-order-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px;
  background: #f8fafc;
}
.kf-order-head {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px;
}
.min-w-0 { min-width: 0; }

.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: rgba(15,23,42,.92); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 13px; z-index: 50; max-width: 86%; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

.hint { font-size: 12px; color: var(--muted); margin: -4px 0 12px; }
.muted { color: var(--muted); font-size: 13px; }
.order-block { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.order-block:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.history-section { border: 1px solid #99f6e4; background: linear-gradient(180deg, #f0fdfa 0%, #fff 48px); }
.tl-media {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
  max-width: 100%;
}
.media-thumb {
  display: block; width: 100%; aspect-ratio: 1;
  border-radius: 8px; overflow: hidden;
  border: 1px solid #99f6e4; background: #f8fafc; padding: 0; cursor: zoom-in;
}
.media-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block; background: #fff;
}
.img-preview-layer {
  position: fixed; inset: 0; z-index: 1200; display: none; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.88); padding: 16px;
}
.img-preview-layer.show { display: flex; }
.img-preview-img {
  max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.img-preview-close {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.18); color: #fff; font-size: 22px; line-height: 36px; cursor: pointer;
}
.img-row { display: flex; flex-wrap: wrap; gap: 8px; }
.img-item, .img-add {
  width: 72px; height: 72px; border-radius: 10px; position: relative;
  border: 1px dashed #99f6e4; background: #f0fdfa; overflow: hidden;
}
.img-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-del {
  position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border: 0;
  border-radius: 50%; background: rgba(15,23,42,.72); color: #fff; font-size: 14px; line-height: 22px;
  padding: 0; cursor: pointer;
}
.img-add {
  display: flex; align-items: center; justify-content: center;
  color: var(--brand); font-size: 12px; font-weight: 650; cursor: pointer;
}
.img-add input { display: none; }

.ai-section {
  border-color: #99f6e4;
  background: linear-gradient(180deg, #f0fdfa 0%, #fff 56px);
}
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ai-head h2 { margin: 0; }
.btn-sm { padding: 7px 10px; font-size: 12px; border-radius: 8px; }
.ai-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ai-risk, .ai-grade, .ai-cached {
  display: inline-block; font-size: 12px; font-weight: 650;
  padding: 2px 8px; border-radius: 999px;
}
.risk-low { background: #ecfdf5; color: var(--ok); }
.risk-mid { background: #fffbeb; color: var(--warn); }
.risk-high { background: #fef2f2; color: var(--danger); }
.grade-p0 { background: #fecaca; color: #991b1b; }
.grade-p1 { background: #fde68a; color: #92400e; }
.grade-p2 { background: #bbf7d0; color: #166534; }
.ai-cached { background: #e2e8f0; color: #475569; }
.ai-warn {
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px;
  padding: 10px 12px; margin-bottom: 10px; font-size: 13px;
}
.ai-warn b { color: var(--danger); display: block; margin-bottom: 4px; }
.ai-warn ul { margin: 0; padding-left: 18px; color: #7f1d1d; line-height: 1.45; }
.ai-actions { margin: 4px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: #334155; }
.ai-block { margin-bottom: 10px; }
.ai-block b { display: block; font-size: 13px; margin-bottom: 4px; }
.ai-block p { margin: 0; font-size: 13px; line-height: 1.55; color: #334155; }
.ai-points { margin: 0 0 10px; padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.ai-drafts { display: flex; flex-direction: column; gap: 8px; }
.ai-draft {
  text-align: left; border: 1px solid #99f6e4; background: #fff;
  border-radius: 12px; padding: 10px 12px; cursor: pointer;
}
.ai-draft:active { background: #f0fdfa; }
.ai-draft-label { font-size: 13px; font-weight: 700; color: var(--brand); }
.ai-draft-body {
  margin-top: 4px; font-size: 13px; line-height: 1.5; color: #334155;
  white-space: pre-wrap; word-break: break-word;
}
.ai-error { color: var(--danger); font-size: 13px; margin-bottom: 8px; }

/* 底部主导航：支付投诉 / 客服消息 / 公众号 / 我的 */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}
.tab {
  border: 0; background: transparent; padding: 10px 8px 12px;
  font-size: 13px; color: var(--muted); font-weight: 600; cursor: pointer;
  border-top: 2px solid transparent;
}
.tab.active { color: var(--brand); border-top-color: var(--brand); }
.tab-label { display: inline-block; }
.page-with-tabs {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0));
}

.kf-chat-page {
  display: flex; flex-direction: column;
  padding: 12px 12px 0;
  padding-bottom: calc(168px + env(safe-area-inset-bottom, 0));
  min-height: calc(100vh - 56px);
}
.chat-box {
  display: flex; flex-direction: column; gap: 10px;
  flex: 1;
}
.bubble {
  max-width: 82%; padding: 9px 12px; border-radius: 16px;
  font-size: 15px; line-height: 1.55; word-break: break-word;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.bubble-meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.bubble.from-user {
  align-self: flex-start; background: #fff; border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}
.bubble.from-me {
  align-self: flex-end; background: linear-gradient(180deg, #ccfbf1 0%, #99f6e4 100%);
  border: 1px solid #5eead4; border-bottom-right-radius: 6px;
}
.bubble.from-sys {
  align-self: center; max-width: 94%; background: transparent; color: var(--muted);
  font-size: 12px; text-align: center; box-shadow: none; padding: 4px 8px;
}

.kf-actions {
  display: block;
  padding: 0;
  background: transparent;
  border-top: 0;
}
.kf-actions > .btn { width: calc(100% - 24px); margin: 10px 12px; flex: none; }
.kf-peer-hint {
  margin: 8px 12px 0; text-align: center; font-size: 12px; color: var(--muted);
  background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}

.kf-dock {
  background: rgba(255,255,255,.98);
  border-top: 1px solid var(--line);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(12px);
}
.kf-tool-row {
  display: flex; gap: 4px; overflow-x: auto; padding: 2px 0 8px;
  -webkit-overflow-scrolling: touch;
}
.kf-tool {
  flex: 1 0 auto; min-width: 48px; border: 0; background: #f1f5f9;
  color: #475569; border-radius: 12px; padding: 8px 10px;
  font-size: 13px; font-weight: 650; cursor: pointer;
}
.kf-tool.on {
  background: var(--brand-soft); color: var(--brand);
  box-shadow: inset 0 0 0 1px #5eead4;
}
.kf-tool.danger {
  background: #fff1f2; color: var(--danger);
}
.kf-tool:disabled { opacity: .55; }
.kf-input-row {
  display: flex; gap: 6px; align-items: flex-end;
}
.kf-input-row textarea {
  flex: 1 1 auto; width: 100%; min-width: 0;
  min-height: 42px; max-height: 160px; resize: none;
  border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px; font-size: 16px; line-height: 1.45;
  outline: none; background: #f8fafc;
}
.kf-input-row textarea:focus {
  border-color: #5eead4; background: #fff;
  box-shadow: 0 0 0 3px rgba(15,118,110,.12);
}
.kf-input-placeholder {
  flex: 1 1 auto; min-width: 0; min-height: 42px; border-radius: 14px; padding: 10px 12px;
  background: #f8fafc; border: 1px dashed #cbd5e1; color: var(--muted);
  font-size: 13px; display: flex; align-items: center;
}
.kf-send-btn {
  flex: 0 0 auto; width: 44px; min-width: 44px; max-width: 44px; height: 40px; border-radius: 10px;
  padding: 0; font-size: 12px; font-weight: 700; letter-spacing: 0;
}
.kf-type-hint {
  font-size: 12px; color: var(--brand); font-weight: 650;
  margin: 0 2px 6px;
}
.kf-expand {
  margin: 0 0 8px; padding: 10px 12px; border-radius: 14px;
  background: #f8fafc; border: 1px solid var(--line);
}
.kf-expand-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.kf-expand-title { font-size: 13px; font-weight: 700; color: var(--text); }
.kf-link-btn {
  border: 0; background: transparent; color: var(--brand);
  font-size: 13px; font-weight: 650; padding: 4px 6px; cursor: pointer;
}
.kf-media-box {
  display: flex; gap: 8px; align-items: center; width: 100%;
}
.kf-media-preview {
  width: 56px; height: 56px; border-radius: 10px; object-fit: cover;
  border: 1px solid var(--line); background: #fff; flex: 0 0 auto;
}
.kf-form {
  display: flex; flex-direction: column; gap: 8px; width: 100%;
}
.kf-form input, .kf-form textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 15px; background: #fff;
}
.kf-form textarea { min-height: 64px; }
.btn-sm { padding: 8px 12px; font-size: 13px; }

.kf-assist-sheet { max-height: 72vh; display: flex; flex-direction: column; padding-top: 12px; }
.kf-assist-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.kf-assist-head h3 { margin: 0; font-size: 17px; }
.kf-kb-search {
  display: flex; gap: 8px; margin-bottom: 10px;
}
.kf-kb-search input {
  flex: 1; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 15px;
}
.kf-assist-list {
  overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 4px;
}
.kf-assist-item {
  display: flex; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; background: #fff; text-align: left;
}
.kf-assist-item.as-btn {
  width: 100%; cursor: pointer; font: inherit; color: inherit;
}
.kf-assist-item.as-btn:active { background: #f0fdfa; border-color: #99f6e4; }
.kf-assist-main { flex: 1; min-width: 0; }
.kf-assist-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.kf-assist-sub {
  margin-top: 4px; font-size: 12px; color: var(--muted);
  line-height: 1.45; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.kf-assist-ops { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.kf-tag {
  display: inline-block; font-size: 11px; font-weight: 650;
  color: var(--brand); background: var(--brand-soft);
  border-radius: 999px; padding: 1px 7px;
}
.kf-assist-empty { padding: 28px 12px; }
.kf-more-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px;
}

.bubble-rich .rich-title { font-weight: 650; }
.bubble-rich .rich-sub { margin-top: 4px; font-size: 12px; color: var(--muted); opacity: .9; }
.bubble-img-link { display: block; }
.bubble-img {
  display: block; max-width: 100%; max-height: 240px; border-radius: 10px;
  object-fit: contain; background: rgba(15, 23, 42, 0.04);
}
.bubble-audio { width: 100%; max-width: 240px; height: 36px; }
.bubble-video { display: block; max-width: 100%; max-height: 240px; border-radius: 10px; }
.bubble-file { color: var(--brand); font-weight: 650; text-decoration: underline; }
.bubble.recalled .bubble-body,
.bubble-recalled { opacity: 0.65; font-style: italic; }
.kf-quota-bar {
  font-size: 12px; color: var(--muted); padding: 4px 2px 8px;
}
.kf-quota-bar.warn { color: var(--warn); font-weight: 650; }
.kf-quota-bar.danger { color: var(--danger); font-weight: 700; }
.kf-compose-quote {
  display: flex; align-items: flex-start; gap: 8px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; margin-bottom: 8px;
}
.kf-compose-quote__text {
  flex: 1; font-size: 12px; color: var(--muted); line-height: 1.4;
  border-left: 3px solid var(--brand); padding-left: 8px;
}
.kf-msg-menu-sheet { max-height: 50vh; }
.btn.danger, .kf-tool.danger { color: var(--danger); }

.kf-ai-banner {
  padding: 8px 12px; font-size: 12px; color: #0f766e;
  background: #ecfdf5; border-bottom: 1px solid #99f6e4;
}
.kf-ai-mode-btn.on {
  background: #ccfbf1; color: #0f766e; border-color: #5eead4; font-weight: 700;
}
.kf-ai-toolbar {
  display: flex; gap: 8px; align-items: center; padding: 0 4px 8px; flex-wrap: wrap;
}

/* 我的 */
.me-profile { margin-bottom: 14px; padding: 14px; }
.me-profile-row { display: flex; gap: 12px; align-items: center; }
.me-avatar {
  width: 56px; height: 56px; border-radius: 14px; object-fit: cover;
  background: var(--brand-soft); flex: 0 0 auto;
}
.me-name { font-size: 18px; font-weight: 700; }
.me-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.me-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.me-badge {
  font-size: 11px; font-weight: 650; padding: 3px 8px; border-radius: 999px;
  background: #f1f5f9; color: var(--muted);
}
.me-badge.ok { background: #ecfdf5; color: var(--ok); }
.me-badge.warn { background: #fff7ed; color: var(--warn); }
.me-group { margin-bottom: 14px; }
.me-group-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 8px 4px; }
.me-list { display: flex; flex-direction: column; gap: 8px; }
.me-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; border: 1px solid var(--line); background: var(--card);
  border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer;
}
.me-item-main { flex: 1; min-width: 0; }
.me-item-name { font-size: 15px; font-weight: 650; }
.me-item-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-item-arrow { color: var(--muted); font-size: 20px; line-height: 1; }
.me-empty { font-size: 13px; color: var(--muted); padding: 10px 4px; }
.me-actions { margin-top: 18px; }
.me-duty-card { padding: 14px; margin-bottom: 12px; }
.duty-switch {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line);
  font-size: 14px; font-weight: 600;
}
.duty-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 0 8px; }
.duty-field {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; font-weight: 650; margin-top: 12px; color: var(--text);
}
.duty-field textarea, .duty-field input[type="number"] {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; background: #fff;
}
.duty-range {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.duty-range input[type="time"] {
  flex: 1; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 14px; background: #fff;
}

.tab-label { position: relative; }
.tab-badge {
  display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; vertical-align: top;
}
.me-todo-badge {
  display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 8px;
  border-radius: 999px; background: #fee2e2; color: var(--danger);
  font-size: 11px; font-weight: 700; line-height: 18px; vertical-align: middle;
}
.oa-rule-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.oa-rule-row {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.oa-rule-row.off { opacity: 0.55; }
.oa-rule-main { flex: 1; min-width: 0; text-align: left; cursor: pointer; }
.oa-rule-name { font-size: 14px; font-weight: 650; }
.oa-rule-tag {
  display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600;
  color: var(--brand); background: var(--brand-soft); padding: 1px 6px; border-radius: 6px;
}
.oa-rule-sub {
  font-size: 12px; color: var(--muted); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.oa-rule-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.oa-default-box {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--fill, #f5f7fa);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.oa-default-box.off { opacity: 0.55; }
.oa-default-text {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.oa-default-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.duty-field input[type="text"] {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; background: #fff;
}

.me-item-wrap { display: flex; flex-direction: column; gap: 6px; }
.me-todo-go { align-self: flex-start; margin-left: 4px; }
.audit-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.audit-row:last-child { border-bottom: 0; }
.audit-sum { font-size: 13px; font-weight: 600; }
.audit-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
