/* TeleAgent 对话同步中转——查看页样式（卡片式、轻量、无外部依赖） */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
    background: #f2f4f7; color: #1c2333; font-size: 14px;
}
a { color: #0064c8; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    position: sticky; top: 0; z-index: 10;
    background: #1c2333; color: #fff; padding: 12px 20px;
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar .brand { font-size: 17px; font-weight: 600; letter-spacing: 1px; }
.topbar .brand span { color: #ff9f43; }
.topbar form { display: flex; gap: 8px; align-items: center; }
.topbar select, .topbar input[type=text] {
    padding: 6px 10px; border: none; border-radius: 6px; font-size: 13px;
}
.topbar button {
    padding: 6px 14px; border: none; border-radius: 6px; cursor: pointer;
    background: #ff9f43; color: #1c2333; font-weight: 600;
}
.wrap { max-width: 1000px; margin: 0 auto; padding: 20px; }

/* 会话列表 */
.sess-card {
    background: #fff; border-radius: 10px; padding: 14px 18px; margin-bottom: 10px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: 0 1px 4px rgba(28,35,51,.08);
    transition: box-shadow .15s;
}
.sess-card:hover { box-shadow: 0 3px 12px rgba(28,35,51,.16); }
.sess-link {
    display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0;
    color: inherit;
}
.sess-link:hover { text-decoration: none; }
.export-btn {
    flex: none; font-size: 12px; padding: 6px 11px; border-radius: 6px;
    border: 1px solid #d3dae8; background: #fff; color: #3345c4;
    white-space: nowrap; cursor: pointer;
}
.export-btn:hover { background: #eef2ff; text-decoration: none; }
.head-actions { margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.export-sub {
    font-size: 12px; color: #3345c4; padding: 6px 11px;
    border: 1px solid #d3dae8; border-radius: 6px; background: #fff;
    white-space: nowrap;
}
.export-sub:hover { background: #eef2ff; text-decoration: none; }
.badge {
    color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 20px;
    white-space: nowrap; font-weight: 600;
}
.sess-main { flex: 1; min-width: 0; }
.sess-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-meta { font-size: 12px; color: #8792a8; margin-top: 4px; }
.sess-msgn { color: #474f63; font-size: 12px; background: #eef1f5; padding: 3px 10px; border-radius: 6px; white-space: nowrap; width: 88px; flex: none; text-align: center; }
.pager { display: flex; gap: 8px; justify-content: center; margin: 18px 0 40px; }
.pager a, .pager span {
    padding: 6px 12px; background: #fff; border-radius: 6px; font-size: 13px;
    box-shadow: 0 1px 4px rgba(28,35,51,.08);
}
.pager .cur { background: #1c2333; color: #fff; }

/* 对话详情 */
.chat-head {
    background: #fff; border-radius: 10px; padding: 16px 20px; margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(28,35,51,.08);
}
.chat-head h1 { font-size: 18px; margin-bottom: 8px; }
.chat-head .meta { font-size: 12px; color: #8792a8; line-height: 1.8; }
.sub-sess { margin-top: 10px; font-size: 13px; }

.msg { margin-bottom: 14px; display: flex; }
.msg.user { justify-content: flex-end; }
.msg .bubble {
    max-width: 86%; border-radius: 12px; padding: 12px 16px; line-height: 1.75;
    box-shadow: 0 1px 4px rgba(28,35,51,.08);
}
.msg.user .bubble { background: #dcebff; border-top-right-radius: 3px; }
.msg.bot  .bubble { background: #fff; border-top-left-radius: 3px; }
.role-tag { font-size: 12px; color: #8792a8; margin-bottom: 5px; }
.bubble pre {
    background: #f5f7fa; border: 1px solid #e3e8ef; border-radius: 6px;
    padding: 10px; overflow-x: auto; font-size: 12.5px; margin: 8px 0;
    white-space: pre-wrap; word-break: break-word;
}
.bubble .muted { color: #8792a8; font-size: 12.5px; }

details.block {
    background: #f5f7fa; border: 1px solid #e3e8ef; border-radius: 8px;
    padding: 8px 12px; margin: 8px 0;
}
details.block summary { cursor: pointer; font-size: 12.5px; color: #474f63; user-select: none; }
details.block .inner {
    margin-top: 8px; font-size: 12.5px; color: #333c4e;
    white-space: pre-wrap; word-break: break-word;
}
.tool-name { font-family: Consolas, monospace; background: #e8eefc; color: #3345c4; padding: 1px 6px; border-radius: 4px; }
.st-done { color: #0aa37c; }
.st-other { color: #d6001f; }

.todo-card { background: #fff; border-radius: 10px; padding: 14px 18px; margin-top: 16px; box-shadow: 0 1px 4px rgba(28,35,51,.08); }
.todo-card h2 { font-size: 14px; margin-bottom: 8px; }
.todo-item { padding: 4px 0; font-size: 13px; display: flex; gap: 8px; }
.todo-item .st { width: 60px; flex: none; }
.t-completed { color: #0aa37c; }
.t-in_progress { color: #b06a00; font-weight: 600; }
.t-pending { color: #8792a8; }

.footer { text-align: center; color: #aab3c5; font-size: 12px; margin: 30px 0; }

/* ---- Markdown 正文 ---- */
.md { line-height: 1.8; }
.md p, .md li, .md td, .md th { overflow-wrap: anywhere; }
.md p { margin: 0 0 8px; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 {
    margin: 14px 0 8px; line-height: 1.45; color: #141a26;
}
.md h1 { font-size: 19px; }
.md h2 { font-size: 17px; }
.md h3 { font-size: 15.5px; }
.md h4, .md h5, .md h6 { font-size: 14.5px; }
.md ul, .md ol { margin: 6px 0 10px; padding-left: 24px; }
.md li { margin: 3px 0; }
.md code {
    font-family: Consolas, "Courier New", monospace; font-size: 12.5px;
    background: #eef1f6; color: #8a2b4a; padding: 1px 5px; border-radius: 4px;
}
.md pre.code {
    background: #1f2633; color: #e6e9f0; border: none; border-radius: 8px;
    padding: 12px 14px; overflow-x: auto; margin: 10px 0;
}
.md pre.code code { background: none; color: inherit; padding: 0; font-size: 12.5px; }
.md blockquote {
    margin: 8px 0; padding: 6px 12px; border-left: 3px solid #ff9f43;
    background: #fff8ee; color: #4a4336; border-radius: 0 6px 6px 0;
}
.md table { border-collapse: collapse; margin: 10px 0; width: 100%; font-size: 13px; }
.md th, .md td { border: 1px solid #dfe4ec; padding: 6px 9px; text-align: left; vertical-align: top; }
.md th { background: #f0f3f8; font-weight: 600; }
.md tr:nth-child(even) td { background: #fafbfd; }
.md hr { border: none; border-top: 1px solid #dfe4ec; margin: 14px 0; }
.md a { color: #0064c8; }

/* ---- 检索与锚点 ---- */
.search-sum { color: #474f63; font-size: 13px; margin: 0 2px 12px; }
.snippet {
    margin-top: 6px; color: #3d465a; font-size: 12.5px; line-height: 1.7;
    background: #f7f9fc; border-left: 2px solid #c9d3e3; padding: 4px 8px;
    border-radius: 0 4px 4px 0;
    word-break: break-word; overflow-wrap: anywhere;
}
mark { background: #ffe08a; color: #6b4b00; padding: 0 2px; border-radius: 2px; }
.role-tag .anchor { color: #b6c0d2; font-weight: 400; margin-left: 4px; opacity: 0; }
.msg:hover .role-tag .anchor { opacity: 1; }
.msg:target .bubble { outline: 3px solid #ffb457; outline-offset: 2px; }

/* ---- 登录页 ---- */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 20% 10%, #26314a 0, #1c2333 42%, #141a26 100%);
}
.auth-shell { width: 100%; max-width: 420px; padding: 24px; }
.auth-card {
    background: #fff; border-radius: 14px; padding: 28px 28px 24px;
    box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.auth-brand { color: #ff9f43; font-size: 13px; font-weight: 600; letter-spacing: 1px; margin-bottom: 8px; }
.auth-title { color: #1c2333; font-size: 24px; font-weight: 700; }
.auth-subtitle { color: #667085; font-size: 13px; line-height: 1.7; margin: 8px 0 18px; }
.auth-label { display: block; color: #474f63; font-size: 13px; margin-bottom: 6px; }
.auth-input {
    width: 100%; padding: 10px 12px; border: 1px solid #dfe4ec; border-radius: 8px;
    font-size: 14px; margin-bottom: 14px; background: #fff; color: #1c2333;
}
.auth-input:focus { outline: none; border-color: #ff9f43; box-shadow: 0 0 0 3px rgba(255,159,67,.15); }
.auth-pass-wrap { position: relative; margin-bottom: 14px; }
.auth-pass-wrap .auth-input { margin-bottom: 0; padding-right: 58px; }
.auth-eye {
    position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
    border: none; background: transparent; color: #0064c8; font-size: 12px;
    padding: 4px 6px; cursor: pointer;
}
.auth-submit {
    width: 100%; padding: 11px; border: none; border-radius: 8px; cursor: pointer;
    background: #1c2333; color: #fff; font-size: 15px; font-weight: 600;
}
.auth-submit:hover { background: #2b3448; }
.auth-error {
    background: #fff1f0; border: 1px solid #ffccc7; color: #b42318;
    padding: 8px 10px; border-radius: 6px; font-size: 13px; margin-bottom: 12px;
}
.auth-tip { color: #7a8699; font-size: 12px; line-height: 1.6; margin-top: 14px; text-align: center; }

/* ---- 窄屏适配 ---- */
@media (max-width: 640px) {
    .topbar { padding: 10px 12px; gap: 10px; }
    .topbar .brand { font-size: 16px; }
    .topbar form { width: 100%; flex-wrap: wrap; }
    .topbar select { flex: 1 1 calc(50% - 4px); min-width: 0; }
    .topbar input[type=text] { flex: 1 1 100%; min-width: 0; }
    .topbar button { flex: 0 0 auto; }
    .wrap { padding: 12px; }
    .sess-card { padding: 12px; gap: 10px; }
    .sess-card .badge { font-size: 11px; padding: 2px 8px; }
    .sess-link { flex-wrap: wrap; }
    .sess-msgn { margin-left: auto; }
    .export-btn { margin-left: auto; }
    .msg .bubble { max-width: 94%; padding: 10px 12px; }
    .md table { display: block; overflow-x: auto; }
}
