/* =============================================================
   📈 股票学习知识库 - 全局样式表
   ============================================================= */

/* --- CSS 变量 (护眼淡蓝主题 - 文字柔和) --- */
:root {
    --bg: #eef3f8;            /* 页面背景：淡雾蓝（更柔和） */
    --bg-alt: #f4f8fb;        /* 略亮的淡蓝 */
    --card: #fbfdfe;          /* 卡片：近乎纯白（清爽） */
    --card-hover: #eef3f8;
    --border: #d4dde6;        /* 边框：更柔的淡蓝灰 */
    --border-light: #e3eaf1;
    --text: #475569;          /* 主文本：板岩灰（极舒适阅读色） */
    --text-dim: #94a3b8;      /* 次文本：浅板岩灰 */
    --accent: #5b8cdb;        /* 主色调：清爽的中蓝（略柔） */
    --accent-soft: rgba(91, 140, 219, 0.08);
    --green: #6a9c7d;
    --orange: #c08a4d;
    --red: #b85c5c;
    --purple: #8a7cb8;
    --shadow: rgba(71, 85, 105, 0.08);
    --shadow-strong: rgba(71, 85, 105, 0.12);
    --radius: 8px;
    --radius-sm: 6px;
    --transition: 0.2s ease;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --max-width: 1200px;
    --nav-height: 52px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Container --- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px 20px 40px;
}

/* =============================================================
   📌 知识库详情页 - 左侧固定侧边栏布局
   ============================================================= */
.kb-layout-with-sidebar {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.kb-sidebar {
    position: sticky;
    top: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 14px;
    box-shadow: 0 1px 4px var(--shadow);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}
.kb-sidebar-brand {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}
.kb-sidebar-logo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}
.kb-sidebar-logo:hover {
    color: #4a7cc4;
}
.kb-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 14px;
}
.kb-sidebar-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.18s ease;
}
.kb-sidebar-item:hover {
    background: var(--card-hover);
    color: var(--accent);
}
.kb-sidebar-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.kb-sidebar-item .svg-icon {
    flex-shrink: 0;
}
.kb-sidebar-divider {
    height: 1px;
    background: var(--border-light);
    margin: 12px 0;
}
.kb-sidebar-current {
    margin-bottom: 14px;
}
.kb-sidebar-current-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding: 0 4px;
}
.kb-sidebar-current-title {
    font-size: 12px;
    color: var(--text);
    line-height: 1.5;
    padding: 0 4px;
    word-break: break-word;
}
.kb-sidebar-stats {
    display: flex;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}
.kb-sidebar-stat {
    flex: 1;
    text-align: center;
}
.kb-sidebar-stat-num {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}
.kb-sidebar-stat-label {
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 2px;
}
.kb-main-content {
    min-width: 0;
}
.kb-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}
.kb-topbar .kb-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}
.kb-topbar .kb-back-link:hover {
    text-decoration: underline;
}

/* 移动端：折叠侧边栏为顶部 */
@media (max-width: 768px) {
    .kb-layout-with-sidebar {
        grid-template-columns: 1fr;
    }
    .kb-sidebar {
        position: relative;
        top: 0;
        max-height: none;
        margin-bottom: 16px;
    }
    .kb-sidebar-stats {
        justify-content: space-around;
    }
}

/* =============================================================
   导航栏
   ============================================================= */
/* (保留原导航样式供 Flask 版本使用) */

/* ---- 知识库专属样式 ----
   用于静态部署的 index.html / summaries.html
   ============================================================= */

/* 页头 */
.kb-header {
    text-align: center;
    padding: 32px 0 8px;
}
.kb-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.kb-subtitle {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 4px;
}

/* 统计栏 */
.kb-meta {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 16px 0 20px;
}
.kb-meta .stat {
    text-align: center;
    min-width: 80px;
}
.kb-meta .stat-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}
.kb-meta .stat-label {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
}

/* 筛选栏 */
.kb-filter {
    margin-bottom: 16px;
}
.filter-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-search-wrap {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 10px;
}
.filter-search-wrap .svg-icon {
    flex-shrink: 0;
    color: var(--text-dim);
}
.filter-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 9px 8px;
    font-size: 13px;
    color: var(--text);
    outline: none;
    font-family: inherit;
}
.filter-input::placeholder { color: var(--text-dim); }
.filter-input:focus { color: var(--text); }
.filter-select {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    min-width: 120px;
}
.filter-select:focus {
    border-color: var(--accent);
}
.filter-count {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    text-align: right;
    margin-top: 6px;
}

/* 知识卡片网格 */
.kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

/* 单张卡片 */
.kb-card {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.kb-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}
.kb-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px var(--shadow-strong);
    transform: translateY(-2px);
}
.kb-card:hover::before {
    opacity: 1;
}
/* 无转录的卡片的顶部装饰色 */
.kb-card.no-transcript::before {
    background: var(--text-dim);
    opacity: 0.3;
}

.kb-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.kb-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    flex: 1;
}
.kb-card-size {
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
}

.kb-card-preview {
    font-size: 12.5px;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kb-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
}
.author-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(91, 140, 219, 0.10);
    color: var(--accent);
}
.author-tag.unknown {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-dim);
}
.kb-badge-transcript {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--green);
    margin-left: auto;
}
.kb-badge-transcript .svg-icon {
    position: relative;
    top: 0;
}

/* 详情页导航栏 */
.kb-detail-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}
.kb-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}
.kb-back-link:hover {
    text-decoration: underline;
}

/* 详情卡片 */
.kb-detail-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    box-shadow: 0 1px 4px var(--shadow);
    margin-bottom: 16px;
}
.kb-detail-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 10px;
}
.kb-detail-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-bottom: 14px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-light);
}
.kb-detail-footer .author-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.kb-detail-source {
    font-size: 12px;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.kb-detail-source .svg-icon {
    position: relative;
    top: 0;
}

/* 详情正文 */
.kb-detail-body {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
}
.kb-detail-body h1 { font-size: 22px; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }
.kb-detail-body h2 { font-size: 18px; margin: 24px 0 10px; color: var(--text); font-weight: 700; }
.kb-detail-body h3 { font-size: 15px; margin: 18px 0 8px; color: var(--text); font-weight: 600; }
.kb-detail-body p  { margin: 10px 0; }
.kb-detail-body strong { color: var(--text); font-weight: 700; }
.kb-detail-body ul, .kb-detail-body ol { padding-left: 22px; margin: 10px 0; }
.kb-detail-body ul { list-style: disc; }
.kb-detail-body ol { list-style: decimal; }
.kb-detail-body li { margin: 5px 0; }
.kb-detail-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 6px 14px;
    margin: 12px 0;
    color: var(--text-dim);
    background: var(--accent-soft);
    border-radius: 0 4px 4px 0;
}
.kb-detail-body blockquote p { margin: 3px 0; }
.kb-detail-body code {
    background: rgba(91, 140, 219, 0.12);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--accent);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    word-break: break-word;
}
.kb-detail-body pre {
    background: var(--bg-alt);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    margin: 10px 0;
    border: 1px solid var(--border-light);
}
.kb-detail-body hr {
    margin: 20px 0;
    border: none;
    border-top: 1px solid var(--border);
}

/* 全文折叠（详情卡片内） */
.kb-detail-card .fold-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 0;
    margin-top: 12px;
    border-top: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--accent);
    user-select: none;
    transition: color 0.15s;
}
.kb-detail-card .fold-header:hover {
    color: var(--text);
}
.kb-detail-card .fold-header .fold-icon {
    display: inline-flex;
}
.kb-detail-card .fold-chevron {
    margin-left: auto;
    transition: transform 0.2s;
}
.kb-detail-card .fold-chevron.rotated {
    transform: rotate(180deg);
}
.kb-detail-card .fold-body {
    display: none;
    margin-top: 8px;
}
.kb-detail-card .fold-body.open {
    display: block;
}
.kb-detail-pre {
    background: var(--bg-alt);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    font-size: 12.5px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 底部返回链接 */
.kb-detail-footlink {
    text-align: center;
    padding: 8px 0 20px;
}
.kb-detail-footlink a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.15s;
}
.kb-detail-footlink a:hover {
    color: var(--accent);
}

/* 移动端响应 */
@media (max-width: 640px) {
    .kb-grid {
        grid-template-columns: 1fr;
    }
    .kb-meta {
        gap: 12px;
    }
    .filter-search-wrap {
        min-width: 140px;
    }
    .filter-select {
        min-width: 100px;
    }
}

/* =============================================================
   Nav
   ============================================================= */
.nav {
    display: flex;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.nav a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
    white-space: nowrap;
}

.nav a:hover {
    background: var(--card);
    color: var(--text);
}

.nav a.active {
    background: var(--card);
    color: var(--accent);
}

.nav a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

/* 移动端汉堡菜单按钮（JS 控制显隐） */
.nav-toggle {
    display: none;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    transition: background var(--transition);
}

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

/* =============================================================
   统计卡片
   ============================================================= */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat {
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 18px 16px;
    text-align: center;
    transition: all var(--transition);
    box-shadow: 0 1px 0 rgba(71, 85, 105, 0.04);
}

.stat:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-strong);
}

.stat-num {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
}

/* =============================================================
   表格
   ============================================================= */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 0 rgba(71, 85, 105, 0.04);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    min-width: 600px;
}

th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

th {
    color: var(--text-dim);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-alt);
    position: sticky;
    top: 0;
    z-index: 1;
}

td {
    color: var(--text);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--accent-soft);
}

/* 行进入动画 */
.table-row-enter {
    animation: rowFadeIn 0.3s ease both;
}

@keyframes rowFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================
   徽章 (Badge)
   ============================================================= */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(148, 163, 184, 0.18);
    color: var(--text-dim);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

/* 作者标签：与其他状态徽章一致的灰色样式 */
.author-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(148, 163, 184, 0.18);
    color: var(--text-dim);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

/* 所有状态徽章统一使用同一灰色样式（柔和不刺眼） */
.badge-green,
.badge-orange,
.badge-red,
.badge-dim,
.badge-purple {
    background: rgba(148, 163, 184, 0.18);
    color: var(--text-dim);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

/* =============================================================
   链接
   ============================================================= */
a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    text-decoration: underline;
}

/* 表格内链接统一用正文灰色，仅 hover 显示下划线 */
table a {
    color: var(--text);
}
table a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* =============================================================
   截断文本
   ============================================================= */
.truncate {
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* =============================================================
   标题
   ============================================================= */
h1 {
    font-size: 22px;
    margin-bottom: 16px;
    font-weight: 700;
}

h2 {
    font-size: 18px;
    margin-bottom: 12px;
    margin-top: 28px;
    font-weight: 600;
}

/* =============================================================
   详情页内容排版
   ============================================================= */
.content {
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 32px;
    line-height: 1.8;
    font-size: 15px;
    box-shadow: 0 1px 3px rgba(71, 85, 105, 0.06);
}

.content h1 { font-size: 26px; margin: 8px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }
.content h2 { font-size: 20px; margin: 28px 0 12px; color: var(--accent); padding-top: 12px; border-top: 1px solid var(--border-light); }
.content h3 { font-size: 16px; margin: 20px 0 8px; color: var(--text); font-weight: 600; }
.content h4 { font-size: 14px; margin: 16px 0 6px; color: var(--accent); font-weight: 600; }
.content p  { margin: 10px 0; }
.content strong { color: var(--text); font-weight: 700; }
.content em { color: var(--orange); font-style: normal; }
.content ul, .content ol { padding-left: 24px; margin: 10px 0; }
.content ul { list-style: disc; }
.content ol { list-style: decimal; }
.content li { margin: 6px 0; }
.content li > ul, .content li > ol { margin: 4px 0; }
.content hr { margin: 24px 0; border: none; border-top: 1px solid var(--border); }
.content blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 16px;
    margin: 14px 0;
    color: var(--text-dim);
    background: var(--accent-soft);
    border-radius: 0 4px 4px 0;
}
.content blockquote p { margin: 4px 0; }

/* 行内代码 */
.content code {
    background: rgba(91, 140, 219, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--accent);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    word-break: break-word;
}
.content pre {
    background: var(--bg-alt);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    margin: 12px 0;
    border: 1px solid var(--border-light);
}
.content pre code {
    background: none;
    padding: 0;
    color: var(--text);
    font-size: 13px;
}

/* Markdown 表格 */
.content table {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 14px 0;
    min-width: auto;
    font-size: 13px;
}
.content table th {
    background: var(--bg-alt);
    color: var(--accent);
    font-size: 11px;
    padding: 8px 12px;
}
.content table td {
    padding: 8px 12px;
    border-bottom-color: var(--border-light);
}
.content table tr:last-child td { border-bottom: none; }
.content table tr:hover { background: var(--accent-soft); }

/* 锚链接 (TOC 扩展生成) */
.content h1 a, .content h2 a, .content h3 a, .content h4 a {
    color: inherit;
    text-decoration: none;
}
.content h1 a:hover, .content h2 a:hover, .content h3 a:hover, .content h4 a:hover {
    color: var(--accent);
}

/* =============================================================
   详情页元信息栏
   ============================================================= */
.meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(71, 85, 105, 0.06);
}
.meta-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.meta-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-alt);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-dim);
    white-space: nowrap;
}
.meta-icon {
    font-size: 14px;
}

/* 折叠区域 */
.fold-header {
    cursor: pointer;
    user-select: none;
    padding: 10px 0;
    font-size: 14px;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: opacity var(--transition);
}
.fold-header:hover { opacity: 0.8; }
.fold-body { display: none; margin-top: 8px; }
.fold-body.open { display: block; animation: foldOpen 0.25s ease both; }

/* =============================================================
   首页折叠区域（平滑展开/收起）
   ============================================================= */
.fold-section {
    margin-bottom: 20px;
}
.fold-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    transition: color var(--transition);
}
.fold-section-header:hover {
    color: var(--accent);
}
.fold-section-icon {
    font-size: 12px;
    transition: transform 0.25s ease;
    color: var(--text-dim);
}
.fold-section-header.collapsed .fold-section-icon {
    transform: rotate(-90deg);
}
.fold-section-body {
    overflow: hidden;
    max-height: 5000px;
    opacity: 1;
    transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.3s ease;
    margin-top: 12px;
}
.fold-section-body.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
}
@keyframes foldOpen {
    from { opacity: 0; max-height: 0; }
    to   { opacity: 1; max-height: 2000px; }
}

/* =============================================================
   空状态
   ============================================================= */
.empty {
    color: var(--text-dim);
    padding: 32px 24px;
    text-align: center;
    font-size: 14px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-alt);
}

/* =============================================================
   搜索/过滤栏
   ============================================================= */
.filter-bar {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar input {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    padding: 8px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.filter-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 140, 219, 0.18);
}

.filter-bar input::placeholder {
    color: var(--text-dim);
}

.filter-count {
    font-size: 12px;
    color: var(--text-dim);
    padding: 4px 8px;
    background: var(--bg-alt);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

/* =============================================================
   返回顶部按钮
   ============================================================= */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--border-light);
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    z-index: 100;
    box-shadow: 0 2px 12px var(--shadow-strong);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--card-hover);
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* =============================================================
   页面加载骨架
   ============================================================= */
.skeleton {
    background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonPulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =============================================================
   页脚
   ============================================================= */
.footer {
    text-align: center;
    padding: 32px 0 16px;
    color: var(--text-dim);
    font-size: 12px;
    border-top: 1px solid var(--border-light);
    margin-top: 40px;
}

.footer code {
    background: var(--bg-alt);
    border: 1px solid var(--border-light);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* =============================================================
   工具类
   ============================================================= */
.flex { display: flex; }
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.fade-in {
    animation: fadeIn 0.3s ease both;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.mt-12 { margin-top: 12px; }
.mb-12 { margin-bottom: 12px; }

/* =============================================================
   选择框 & 批量处理栏
   ============================================================= */
.checkbox-cell {
    width: 36px;
    text-align: center;
    padding: 8px 4px !important;
}
.checkbox-cell input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    vertical-align: middle;
}

.batch-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--bg-alt);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    min-height: 44px;
}
.batch-bar .selected-count {
    font-size: 12px;
    color: var(--text-dim);
    padding: 4px 8px;
}

/* =============================================================
   处理按钮
   ============================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: var(--card);
    color: var(--text);
    transition: all var(--transition);
    white-space: nowrap;
    font-family: inherit;
}
.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: #4a7cc4;
    border-color: #4a7cc4;
    color: #fff;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-sm {
    padding: 3px 8px;
    font-size: 11px;
}

/* 警告色按钮（取消用） */
.btn-warn {
    background: var(--bg-alt);
    color: var(--red);
    border-color: var(--red);
}
.btn-warn:hover {
    background: rgba(184, 92, 92, 0.08);
}

/* 顶部统计（已处理 X / Y） */
.media-stat {
    font-size: 14px;
    color: var(--text-dim);
    font-weight: normal;
    margin-left: 8px;
}
.media-processed-count,
.docs-processed-count {
    color: var(--accent);
    font-weight: 700;
    font-size: 16px;
}

/* =============================================================
   页面双栏布局
   ============================================================= */
.page-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    box-shadow: 0 1px 3px rgba(71, 85, 105, 0.06);
}

.sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}

.sidebar-item:hover {
    background: var(--accent-soft);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}
.sidebar-link:hover {
    color: var(--accent);
    text-decoration: none;
}

.sidebar-item .item-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-item .item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.sidebar-empty {
    padding: 16px 10px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

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

/* 转录跳转链接 */
.transcript-link {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(91, 140, 219, 0.08);
    color: var(--accent);
    white-space: nowrap;
    transition: background var(--transition);
}
.transcript-link:hover {
    background: rgba(91, 140, 219, 0.18);
    color: var(--accent);
    text-decoration: none;
}

/* =============================================================
   批量处理进度面板
   ============================================================= */
.progress-panel {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(71, 85, 105, 0.06);
}

.progress-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.progress-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.progress-item {
    padding: 8px 10px;
    background: var(--bg-alt);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 6px;
    gap: 8px;
}

.progress-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.progress-status {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}
.progress-status.waiting   { background: rgba(148,163,184,0.18); color: var(--text-dim); }
.progress-status.running   { background: rgba(91,140,219,0.18);  color: var(--accent); }
.progress-status.done      { background: rgba(106,156,125,0.18); color: var(--green); }
.progress-status.failed    { background: rgba(184,92,92,0.18);   color: var(--red); }

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fg {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}
.progress-bar-fg.done {
    background: var(--green);
}
.progress-bar-fg.failed {
    background: var(--red);
}

.progress-msg {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 取消按钮 */
.cancel-btn {
    background: none;
    border: 1px solid rgba(184, 92, 92, 0.35);
    color: var(--red);
    font-size: 13px;
    line-height: 1;
    padding: 1px 6px 2px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.cancel-btn:hover {
    background: rgba(184, 92, 92, 0.12);
    border-color: var(--red);
}

/* 已取消状态 */
.progress-status.cancelled {
    background: rgba(148, 163, 184, 0.25);
    color: var(--text-dim);
}

/* =============================================================
   内联 SVG 图标
   ============================================================= */
.svg-icon {
    display: inline-block;
    vertical-align: middle;
    position: relative;
    top: -1px;
    color: inherit;
}

/* 导航按钮中的 SVG 图标 */
.nav-toggle .svg-icon {
    pointer-events: none;
}

/* 折叠图标旋转 */
.fold-chevron.rotated {
    display: inline-block;
}
.fold-chevron.rotated .svg-icon {
    transform: rotate(180deg);
}

/* meta 信息栏的图标 */
.meta-icon .svg-icon,
.meta-tag .svg-icon {
    margin-right: 3px;
}

/* 转录链接中的 SVG */
.transcript-link .svg-icon {
    vertical-align: middle;
}

/* 操作按钮中的图标 */
.btn .svg-icon {
    margin-right: 3px;
}
.process-btn .svg-icon,
#batchProcessBtn .svg-icon {
    pointer-events: none;
}

/* 详情页折叠头部图标对齐 */
.fold-header .fold-icon .svg-icon {
    vertical-align: middle;
    margin-right: 4px;
}
.fold-header .fold-chevron .svg-icon {
    vertical-align: middle;
    margin-left: 6px;
    transition: transform 0.25s ease;
}

/* 详情页按钮间距 */
.transcript-btn .svg-icon,
.back-btn .svg-icon {
    margin-right: 4px;
    vertical-align: middle;
}

/* =============================================================
   转录页样式
   ============================================================= */
.transcript-body {
    background: var(--bg-alt);
    border-radius: 8px;
    padding: 4px 0;
    max-height: 80vh;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
}
.transcript-body .ts-line {
    padding: 3px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}
.transcript-body .ts-line:last-child {
    border-bottom: none;
}
.transcript-body .ts-timestamp {
    color: var(--accent);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.5px;
    padding-top: 10px;
    padding-bottom: 2px;
    background: rgba(0,0,0,0.02);
    border-bottom: 1px solid var(--border);
}

/* 删除按钮 */
.delete-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-dim);
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0;
    line-height: 1;
    transition: all 0.15s;
    opacity: 0.5;
}
.delete-btn:hover {
    color: var(--red, #b85c5c);
    background: rgba(184, 92, 92, 0.1);
    border-color: rgba(184, 92, 92, 0.25);
    opacity: 1;
}
tr:hover .delete-btn {
    opacity: 0.8;
}

/* =============================================================
   可排序表头
   ============================================================= */
th.sortable-status {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th.sortable-status:hover {
    color: var(--accent);
}
th.sortable-status .svg-icon {
    margin-left: 3px;
    transition: transform 0.2s;
}
th.sortable-status[data-sort-dir="asc"] .svg-icon {
    transform: rotate(180deg);
}

/* 响应式：小屏侧边栏折叠 */
@media (max-width: 992px) {
    .page-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        min-width: unset;
        position: static;
        max-height: none;
    }
}

/* =============================================================
   响应式设计
   ============================================================= */

/* 平板 (<992px) */
@media (max-width: 992px) {
    .container { padding: 12px 16px 32px; }
    .stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .truncate { max-width: 250px; }
}

/* 手机 (<768px) */
@media (max-width: 768px) {
    .container { padding: 10px 12px 24px; }

    /* 导航折叠 */
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 2px;
        padding: 8px 0;
    }
    .nav-links.open { display: flex; }
    .nav-links a {
        padding: 10px 12px;
        border-radius: var(--radius-sm);
    }

    /* 改为可滑动的行式卡片代替表格 */
    .table-wrapper {
        border: none;
        margin: 0 -12px;
        border-radius: 0;
    }
    table { min-width: 100%; }
    th, td { padding: 8px 10px; font-size: 12px; }
    .truncate { max-width: 160px; }
    h1 { font-size: 18px; }
    h2 { font-size: 16px; }

    /* 统计卡片 2列 */
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .stat { padding: 14px 12px; }
    .stat-num { font-size: 22px; }

    /* 详情页 */
    .content { padding: 20px 16px; font-size: 14px; }
    .content h1 { font-size: 20px; }

    /* 过滤栏 */
    .filter-bar input { min-width: 100%; max-width: 100%; }

    .back-to-top { bottom: 16px; right: 16px; width: 36px; height: 36px; font-size: 16px; }

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

/* 小手机 (<480px) */
@media (max-width: 480px) {
    .stats { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .stat { padding: 10px 8px; }
    .stat-num { font-size: 20px; }
    th, td { padding: 6px 8px; font-size: 11px; }
    .truncate { max-width: 120px; }
}
