/* Bio Chat 管理端样式（独立文件，纳入 ?v= 版本串；改这里要 bump index.html 的 admin.css?v=）。
   原为 index.html 内联 <style>，2026-09-17 抽出以便独立版本化。 */
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f2f4f8; color: #222; }
.view { max-width: 1080px; margin: 0 auto; padding: 20px; }
.card { background: #fff; border-radius: 12px; padding: 28px; max-width: 360px; margin: 120px auto; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.card h2 { margin: 0 0 16px; font-size: 20px; }
.card form { margin: 0; }
input, select, button { font-size: 14px; }
input, select { width: 100%; padding: 9px 10px; margin: 6px 0; border: 1px solid #ccc; border-radius: 6px; }
button { cursor: pointer; }
.btn { padding: 8px 14px; border: 1px solid #ccc; border-radius: 6px; background: #fff; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.err { color: #dc2626; margin-top: 8px; font-size: 13px; }
header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
header h1 { font-size: 20px; margin: 0; }
header .header-actions button { margin-left: 8px; }
/* 当前所在 Tab：视觉 + 语义（aria-current 由 HTML 标注） */
header .header-actions button[aria-current="page"] { background: #eef2ff; border-color: #c7d2fe; color: #1d4ed8; font-weight: 600; }
.tab-title { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 12px; }
.tab-title h3 { margin: 0; }
.tab-title .tab-tools { display: flex; align-items: center; gap: 8px; }
.tab-title .tab-tools select { width: auto; margin: 0; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
th, td { padding: 9px 10px; border-bottom: 1px solid #eee; text-align: left; font-size: 13px; }
th { background: #f8fafc; font-weight: 600; }
th.sortable { cursor: pointer; -webkit-user-select: none; user-select: none; white-space: nowrap; }
th.sortable:hover { background: #eef2ff; }
th.sortable.active { color: #2563eb; }
th.sortable .sort-mark { font-size: 10px; color: #2563eb; }
tr:hover td { background: #fafbfc; }
/* 窄屏：表格外层横向滚动（原先 7 列在 <720px 会撑破页面） */
.table-wrap { background: #fff; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,.06); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > table { min-width: 680px; border-radius: 0; box-shadow: none; }
.credits-cell input { width: 70px; display: inline-block; margin: 0; }
.credits-cell b { font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: #888; font-size: 12px; }
.panel { background: #fff; border-radius: 10px; padding: 16px; margin-top: 12px; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.msg-content { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; background: #f8fafc; border-radius: 6px; padding: 8px; font-size: 12px; max-height: 160px; overflow: auto; }
/* 管理端只读 Markdown 展示（消息 / 公告正文），与用户端同一套 marked + DOMPurify */
.msg-md { background: #f8fafc; border-radius: 6px; padding: 8px 10px; font-size: 12.5px; max-height: 240px; overflow: auto; }
.msg-md > :first-child { margin-top: 0; }
.msg-md > :last-child { margin-bottom: 0; }
.msg-md img { max-width: 100%; }
.msg-md pre { background: #f6f8fa; padding: 8px; border-radius: 6px; overflow: auto; }
.msg-md code { font-size: 12px; }
.msg-md table { box-shadow: none; min-width: 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef2ff; color: #3730a3; }
.badge.on { background: #ecfdf5; color: #047857; }
.badge.off { background: #fef2f2; color: #b91c1c; }
.badge.missing { background: #fef3c7; color: #b45309; }
.badge.rating-badge { margin-left: 6px; font-weight: 600; }
.badge.rating-like { background: #eff6ff; color: #1d4ed8; }
.badge.rating-dislike { background: #fef2f2; color: #b91c1c; }
.pricing-form { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 8px; align-items: end; background: #fff; border-radius: 10px; padding: 12px; box-shadow: 0 1px 6px rgba(0,0,0,.06); margin-bottom: 12px; }
.pricing-form label { font-size: 12px; color: #666; display: block; margin-bottom: 2px; }
.pricing-form .form-hint { font-size: 12px; color: #999; }
.ann-form textarea { width: 100%; min-height: 90px; padding: 9px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; font-family: inherit; resize: vertical; box-sizing: border-box; }
.char-count { font-size: 12px; color: #999; margin-top: 2px; }
.char-count.over { color: #dc2626; font-weight: 600; }
/* 未配置价格的工具：一行一个，带「去配置」 */
.missing-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed #e5e7eb; font-size: 13px; }
.missing-item:last-child { border-bottom: 0; }
.badge.open { background: #fffbeb; color: #b45309; }
.badge.replied { background: #eff6ff; color: #1d4ed8; }
.badge.closed { background: #f1f5f9; color: #64748b; }
.badge-alert { display: inline-block; margin-left: 6px; min-width: 20px; padding: 1px 7px; border-radius: 10px; background: #dc2626; color: #fff; font-size: 12px; font-weight: 700; vertical-align: middle; }
.alert-banner { background: #fffbeb; border: 1px solid #f59e0b; color: #b45309; padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; box-shadow: 0 2px 8px rgba(245,158,11,.15); }
.board-detail-box { background: #f8fafc; border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
/* 对话记录：署名在正文外（谁 · 时间），管理员那一组带左侧细线（与用户端留言 Tab 同一套语言） */
.board-thread { display: flex; flex-direction: column; }
.board-msg { padding: 0; }
.board-msg + .board-msg:not(.same) { margin-top: 10px; }
.board-msg.same + .board-msg.same { margin-top: 4px; }
.board-msg.admin { padding-left: 9px; border-left: 2px solid #16a34a; }
.board-msg .board-who { font-size: 11px; color: #6b7280; margin-bottom: 2px; }
.board-msg.user .board-who { color: #1d4ed8; }
.board-msg.admin .board-who { color: #15803d; }
.board-title-cell { font-weight: 600; color: #1f2937; }
.back { margin-bottom: 8px; }
/* 用户会话面板：打开后需要能把视线拉回面板 */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.panel-head h4 { margin: 0; font-size: 15px; }
/* 表头排序按钮：视觉与纯文字表头一致，但键盘可达（Enter/Space） */
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.th-sort:hover { color: #2563eb; }
/* 管理端消息查看：每条消息一个卡片 */
.msg-item { margin-bottom: 10px; }
.msg-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.panel-target { background: #fffbeb; transition: background .4s ease; }
.page-bar { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; color: #555; }
.page-bar .page-info { font-variant-numeric: tabular-nums; }
.empty-row td { color: #999; padding: 18px 10px; }
.toast-box { position: fixed; top: 16px; right: 16px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #333; color: #fff; padding: 14px 22px; border-radius: 12px; font-size: 15px; font-weight: 600; opacity: 0; transform: translateX(32px) scale(.95); transition: all .22s ease; box-shadow: 0 8px 28px rgba(0,0,0,.25); max-width: 360px; border-left: 5px solid rgba(255,255,255,.35); }
.toast.show { opacity: 1; transform: none; }
.toast.success { background: linear-gradient(135deg, #16a34a, #15803d); }
.toast.error { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.toast.info { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
button:disabled { opacity: .6; cursor: not-allowed; }
.dialog-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: none; align-items: center; justify-content: center; z-index: 998; }
.dialog { background: #fff; border-radius: 12px; padding: 20px; width: 340px; max-width: calc(100vw - 32px); box-shadow: 0 4px 20px rgba(0,0,0,.2); }
.dialog-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.dialog-msg { font-size: 13px; color: #555; margin-bottom: 12px; }
.dialog-body input { margin: 0 0 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
/* 键盘可达：可点击元素有指针 + 焦点环（与用户端口径一致：鼠标点击不显示） */
[role="button"] { cursor: pointer; }
:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
/* 屏幕阅读器专用文本（表格 caption 等） */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
