/* ── Layout ──────────────────────────────────────────────────── */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: ui-monospace, "Cascadia Code", "Fira Code", Consolas, monospace, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 覆盖 Syncfusion 控件的默认字体，使其英文和数字使用等宽字体，同时排除图标字体 */
.e-control:not(.e-icons), .e-css:not(.e-icons), .e-lib:not(.e-icons) {
    font-family: ui-monospace, "Cascadia Code", "Fira Code", Consolas, monospace, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

:root {
    --app-bg: #f5f7fb;
    --app-surface: #ffffff;
    --app-text: #111827;
    --app-border: #e5e7eb;
    --app-hover: rgba(15, 23, 42, 0.08);
    --app-primary: var(--color-sf-primary, var(--sf-primary, #2563eb));
    --app-primary-text: #ffffff;
}

body[data-sf-theme$="-dark"],
body[data-sf-theme="highcontrast"] {
    --app-bg: #0f172a;
    --app-surface: #111827;
    --app-text: #e5e7eb;
    --app-border: #374151;
    --app-hover: rgba(148, 163, 184, 0.2);
}

/* Material 3 主题把 --color-sf-primary 存储为 RGB 分量（如 "103, 80, 164"）
   而非完整颜色值，直接 var() 引用会得到无效颜色，必须手动包裹成 rgb() */
body[data-sf-theme="material3"] {
    --app-primary: rgb(103, 80, 164);
    --app-primary-text: #ffffff;
}
body[data-sf-theme="material3-dark"] {
    --app-primary: rgb(208, 188, 255);
    --app-primary-text: #381e72;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    font-variant-numeric: tabular-nums;
}

.main-body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    transition: margin-left 0.2s ease, width 0.2s ease;
    background: var(--app-bg);
    color: var(--app-text);
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 48px;
    min-height: 48px;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-surface);
    flex-shrink: 0;
}

.top-bar .app-title {
    font-weight: 600;
    font-size: 0.9375rem;
    white-space: nowrap;
}

.top-bar .spacer { flex: 1; }

/* 顶栏用户下拉：展示名过长时省略 */
.top-bar .user-menu-ddb {
    max-width: 220px;
}
.top-bar .user-menu-ddb .e-btn {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwd-dialog-form .form-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.pwd-dialog-form .form-row label {
    font-size: 0.8125rem;
    font-weight: 500;
}

.page-content {
    flex: 1;
    overflow: auto;
    padding: 16px 20px;
    background: var(--app-bg);
    color: var(--app-text);
}

/* ── Sidebar (SfSidebar) ────────────────────────────────────── */
.e-sidebar {
    background: var(--app-surface) !important;
    border-right: 1px solid var(--app-border) !important;
    color: var(--app-text) !important;
    overflow: hidden;
}

/* Dock mode: collapsed keep icons visible */
.app-sidebar.e-dock.e-close .sidebar-header .sidebar-title,
.app-sidebar.e-dock.e-close .nav-item span:not(.e-icons) {
    display: none;
}

.app-sidebar.e-dock.e-close .sidebar-header {
    justify-content: center;
    padding: 10px 0;
}

.app-sidebar.e-dock.e-close .nav-item {
    justify-content: center;
    padding: 10px 0;
    margin: 6px 8px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px 10px 16px;
    border-bottom: 1px solid var(--app-border);
    min-height: 48px;
    box-sizing: border-box;
}

.sidebar-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-toggle.e-btn {
    min-width: 28px;
    width: 28px;
    height: 28px;
    padding: 0 !important;
    border-radius: 4px;
    opacity: 0.75;
    flex-shrink: 0;
    color: var(--app-text) !important;
}

.sidebar-toggle.e-btn .e-btn-icon {
    font-size: 14px;
    color: inherit !important;
}

.sidebar-toggle.e-btn:hover {
    opacity: 1;
    background: var(--app-hover);
}

/* Bootstrap 5.3: prevent sticky dark active/focus background on sidebar toggle */
.sidebar-toggle.e-btn:focus,
.sidebar-toggle.e-btn:focus-visible,
.sidebar-toggle.e-btn:active,
.sidebar-toggle.e-btn.e-active,
.sidebar-toggle.e-btn.e-btn-focus {
    background: transparent !important;
    box-shadow: none !important;
}

/* Ensure top-bar outline button remains visible across themes */
.top-bar .e-btn.e-outline {
    color: var(--app-text) !important;
    border-color: var(--app-border) !important;
    background: transparent !important;
}

.nav-list {
    list-style: none;
    margin: 8px 0;
    padding: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    cursor: pointer;
    font-size: 0.8125rem;
    border-radius: 4px;
    margin: 1px 6px;
    text-decoration: none;
    color: var(--app-text);
    transition: background 0.15s;
}

.nav-item .menu-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-item:hover {
    background: var(--app-hover);
}

/* 当前路由菜单项：提高优先级，避免被侧栏 / 主题样式盖掉 */
.e-sidebar .nav-list .nav-item.active,
.app-sidebar .nav-list .nav-item.active {
    background: var(--app-primary) !important;
    color: var(--app-primary-text) !important;
}

.e-sidebar .nav-list .nav-item.active .e-icons,
.app-sidebar .nav-list .nav-item.active .e-icons {
    color: inherit !important;
}

body[data-sf-theme$="-dark"] .e-sidebar .nav-list .nav-item.active,
body[data-sf-theme$="-dark"] .app-sidebar .nav-list .nav-item.active,
body[data-sf-theme="highcontrast"] .e-sidebar .nav-list .nav-item.active,
body[data-sf-theme="highcontrast"] .app-sidebar .nav-list .nav-item.active {
    background: var(--app-primary) !important;
    color: var(--app-primary-text) !important;
}

/* ── Syncfusion compact overrides ────────────────────────────── */
.e-control,
[class^="e-"] *:not([class*="e-icon"]) {
    font-size: 0.8125rem !important;
}

.e-grid .e-rowcell,
.e-grid .e-headercell {
    padding: 5px 8px !important;
    font-size: 0.8125rem !important;
}

.e-input-group,
.e-control.e-textbox {
    min-height: 30px;
}

.e-toolbar {
    min-height: 48px;
}

/* Syncfusion 下拉弹层内容区：原本被错误地设为 hidden，导致 SfDropDownList /
   SfMultiSelect 的选项列表在超出 PopupHeight 时无法滚动。改回 auto 让弹层按
   PopupHeight 正常滚动。 */
.e-ddl.e-popup .e-content {
    overflow-y: auto !important;
}

/* 主题选择器下拉面：极细渐变色滚动条（CssClass 见 ThemeSwitcher.razor，Syncfusion 会加到 popup） */
.theme-switcher-ddl.e-ddl.e-popup .e-content {
    scrollbar-width: thin;
    scrollbar-color: var(--app-primary) transparent;
}

.theme-switcher-ddl.e-ddl.e-popup .e-content::-webkit-scrollbar {
    width: 2px;
}

.theme-switcher-ddl.e-ddl.e-popup .e-content::-webkit-scrollbar-track {
    background: transparent;
}

.theme-switcher-ddl.e-ddl.e-popup .e-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--app-primary), #22d3ee);
    border-radius: 1px;
}

.theme-switcher-ddl.e-ddl.e-popup .e-content::-webkit-scrollbar-thumb:hover {
    background: var(--app-primary);
}

.e-dialog .e-dlg-header {
    font-size: 0.9375rem;
}

/* ── SfTab: 全局淡入动画 — 禁止指示条 slide，配合 TabAnimationSettings FadeIn 使用 ── */
.e-tab .e-tab-header:not(.e-vertical) .e-indicator,
.e-tab .e-tab-header.e-vertical .e-indicator {
    transition: none;
}

/* ── SfTab: 标签标题可读（主题仅换 CSS 文件，body 无主题 class，用 data-sf-theme） ─ */
.e-tab .e-tab-header.e-toolbar {
    background-color: var(--color-sf-content-bg-color-alt1, #f9fafb) !important;
}

.e-tab .e-tab-header .e-toolbar-item .e-tab-wrap,
.e-tab .e-tab-header .e-toolbar-item .e-text-wrap,
.e-tab .e-tab-header .e-toolbar-item .e-tab-text {
    color: var(--color-sf-black, #111827) !important;
    opacity: 1 !important;
}

.e-tab .e-tab-header .e-toolbar-item.e-active .e-tab-wrap,
.e-tab .e-tab-header .e-toolbar-item.e-active .e-text-wrap,
.e-tab .e-tab-header .e-toolbar-item.e-active .e-tab-text {
    color: var(--color-sf-primary, #0f6cbd) !important;
}

body[data-sf-theme$="-dark"] .e-tab .e-tab-header .e-toolbar-item:not(.e-active) .e-tab-wrap,
body[data-sf-theme$="-dark"] .e-tab .e-tab-header .e-toolbar-item:not(.e-active) .e-text-wrap,
body[data-sf-theme$="-dark"] .e-tab .e-tab-header .e-toolbar-item:not(.e-active) .e-tab-text,
body[data-sf-theme="highcontrast"] .e-tab .e-tab-header .e-toolbar-item:not(.e-active) .e-tab-wrap,
body[data-sf-theme="highcontrast"] .e-tab .e-tab-header .e-toolbar-item:not(.e-active) .e-text-wrap,
body[data-sf-theme="highcontrast"] .e-tab .e-tab-header .e-toolbar-item:not(.e-active) .e-tab-text {
    color: #e5e7eb !important;
}

body[data-sf-theme$="-dark"] .e-tab .e-tab-header.e-toolbar,
body[data-sf-theme="highcontrast"] .e-tab .e-tab-header.e-toolbar {
    background-color: var(--color-sf-content-bg-color-alt1, #1d2432) !important;
}

/* ── Auth loading ────────────────────────────────────────────── */
.auth-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

/* ── Page titles ─────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.page-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

/* 帮助文章编辑页：返回按钮在左，标题紧跟其后，不换行 */
.page-header-lead {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
    min-width: 0;
    gap: 12px;
}

.page-header-title-slug {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    min-width: 0;
}

.page-header-title-slug .page-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-header-title-slug .slug-tag {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--app-text-muted, #6b7280);
}

.not-found-page {
    text-align: center;
    padding: 40px;
}

/* ── Grid 列表页公共样式（GridPageLayout 使用）────────────────── */

/* 页面头部右侧区域（搜索框 + 工具栏按钮，水平排列） */
.page-header-right { display: flex; gap: 10px; align-items: center; }

/* 页面头部工具栏按钮区 */
.page-header-actions { display: flex; gap: 8px; align-items: center; }

/* 导出区：统一所有按钮高度，解决纯图标按钮（e-icon-btn）比带文字按钮矮的问题 */
.page-header-export { display: flex; gap: 6px; align-items: center; }
.page-header-export .e-btn { height: 29px !important; min-height: 29px !important; }

/* ── 内置搜索框（GridPageLayout ShowSearch） ────────── */
/* 背景/边框/文字全部使用主题 CSS 变量，随 data-sf-theme 切换自动适配，
   不使用 @media (prefers-color-scheme) 媒体查询，避免系统暗色模式与
   Syncfusion 主题选择不一致时出现黑色背景的问题。 */
.grid-search-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--app-border);
    border-radius: 4px;
    background: var(--app-surface);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.grid-search-wrap:focus-within {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-primary) 15%, transparent);
}

.grid-search-icon {
    font-size: 13px;
    color: var(--app-text);
    opacity: 0.45;
    flex-shrink: 0;
    pointer-events: none;
}

.grid-search-input {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 13px;
    width: 200px;
    padding: 0;
    color: var(--app-text);
}

.grid-search-clear {
    font-size: 12px;
    color: var(--app-text);
    opacity: 0.4;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.grid-search-clear:hover { opacity: 0.8; }

/* 筛选栏 */
.filter-bar {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 130px;
}
.filter-item--wide { min-width: 200px; }
.filter-item label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--app-text);
    opacity: 0.65;
}
.filter-actions {
    display: flex;
    gap: 6px;
    align-items: flex-end;
    margin-left: auto;
}

/* 分页导航 */
.pager-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px;
    font-size: 0.8125rem;
}
.pager-actions { display: flex; gap: 6px; }
.pager-info { color: var(--app-text); opacity: 0.75; }

/* GenericGrid ServerSide 模式分页附加栏
   通过负 margin-top 让附加栏整体上浮到 .e-gridpager 同一水平行的右侧，
   视觉上作为 gridpager 的一部分显示；pointer-events:none 让 gridpager 自身
   按钮（翻页、PageSize 下拉）继续可点击，仅 addon 内部交互元素恢复事件。 */
.grid-pager-addon {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    padding: 0 12px;
    font-size: 0.8125rem;
    color: var(--app-text-muted);
    background: transparent;
    border: none;
    height: 34px;
    margin-top: -34px;
    position: relative;
    z-index: 2;
    pointer-events: none;
}
.grid-pager-addon > * {
    pointer-events: auto;
}
.pager-addon-stat b { color: var(--app-text); font-weight: 600; }
.pager-addon-jump {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pager-jump-input {
    width: 60px;
    padding: 2px 6px;
    border: 1px solid var(--app-border);
    border-radius: 4px;
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 0.8125rem;
    text-align: center;
    -moz-appearance: textfield;
}
.pager-jump-input::-webkit-inner-spin-button,
.pager-jump-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.pager-jump-input:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-primary) 20%, transparent);
}

/* 隐藏 SfGrid 内置分页栏信息文字，由 .grid-pager-addon 替代显示 */
.e-grid .e-gridpager .e-parentmsgbar {
    display: none !important;
}

/* 隐藏分页栏右侧 "每页项目" 冗余文字（下拉框含义已自明） */
.e-grid .e-gridpager .e-pagerconstant {
    display: none !important;
}

/* 分页栏 Page Size 下拉框默认宽度过窄（约 64px），加宽以容纳 "10000" 等较长选项 */
.e-grid .e-gridpager .e-pagerdropdown {
    width: 92px;
}
.e-grid .e-gridpager .e-pagerdropdown .e-ddl {
    width: 100% !important;
}

/* 加载错误横幅 */
.load-error-banner {
    display: flex;
    align-items: center;
    background: #fff1f0;
    border: 1px solid #ffccc7;
    border-radius: 6px;
    color: #cf1322;
    padding: 10px 16px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}
body[data-sf-theme$="-dark"] .load-error-banner {
    background: #3b0d0c;
    border-color: #7f1d1d;
    color: #fca5a5;
}

/* Badge 状态徽章 */
.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.72rem;
    white-space: nowrap;
}
.badge-success   { background: #dcfce7; color: #166534; }
.badge-muted     { background: #f3f4f6; color: #6b7280; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-admin     { background: #dbeafe; color: #1e40af; }
.badge-tenant    { background: #f3e8ff; color: #6b21a8; }
.badge-hosted    { background: #e0f2fe; color: #0369a1; }
.badge-own       { background: #fef9c3; color: #854d0e; }
.badge-draft     { background: #f1f5f9; color: #475569; }
.badge-active    { background: #dcfce7; color: #166534; }
.badge-completed { background: #e0f2fe; color: #0369a1; }
.badge-terminated{ background: #fee2e2; color: #991b1b; }
.badge-disabled  { background: #fef9c3; color: #854d0e; }
.badge-clickable { cursor: pointer; }

body[data-sf-theme$="-dark"] .badge-success   { background: #14532d; color: #86efac; }
body[data-sf-theme$="-dark"] .badge-muted     { background: #374151; color: #9ca3af; }
body[data-sf-theme$="-dark"] .badge-danger    { background: #7f1d1d; color: #fca5a5; }
body[data-sf-theme$="-dark"] .badge-admin     { background: #1e3a5f; color: #93c5fd; }
body[data-sf-theme$="-dark"] .badge-tenant    { background: #3b0764; color: #d8b4fe; }
body[data-sf-theme$="-dark"] .badge-hosted    { background: #0c4a6e; color: #7dd3fc; }
body[data-sf-theme$="-dark"] .badge-own       { background: #713f12; color: #fde68a; }
body[data-sf-theme$="-dark"] .badge-draft     { background: #334155; color: #94a3b8; }
body[data-sf-theme$="-dark"] .badge-active    { background: #14532d; color: #86efac; }
body[data-sf-theme$="-dark"] .badge-completed { background: #0c4a6e; color: #7dd3fc; }
body[data-sf-theme$="-dark"] .badge-terminated{ background: #7f1d1d; color: #fca5a5; }
body[data-sf-theme$="-dark"] .badge-disabled  { background: #713f12; color: #fde68a; }

/* 等宽字体工具类：
   - .mono-id / .mono-code 保留等宽（UUID / 代码场景）
   - .mono-time 不使用等宽，保持与同行正常文本字体一致，仅保留 tabular-nums 让数字对齐 */
.mono-id, .mono-code {
    font-family: ui-monospace, "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}
.mono-time {
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}
.mono-id {
    display: inline-block;
    margin-right: 3px;
    color: var(--app-text);
    opacity: 0.65;
}

/* 通用工具类 */
.muted { color: var(--app-text); opacity: 0.35; }
.error-msg {
    font-size: 0.78rem;
    color: #dc2626;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
    min-width: 0;
}
.field-hint { font-size: 0.75rem; color: #6b7280; margin-top: 3px; }
.req { color: #ef4444; }
.delete-confirm-text { margin: 8px 0; font-size: 0.9rem; }

/* 日志页特有样式 */
.token-pair { font-size: 0.78rem; }
.token-sep  { margin: 0 2px; opacity: 0.4; }
.sub-text {
    display: block;
    font-size: 0.7rem;
    color: var(--app-text);
    opacity: 0.5;
    margin-top: 1px;
}
.role-tag {
    display: inline-block;
    margin-left: 5px;
    font-size: 0.7rem;
    color: var(--app-text);
    opacity: 0.5;
}

/* 弹窗表单通用结构 */
.form-section { padding: 8px 4px; }
.form-row {
    display: grid;
    grid-template-columns: 130px 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.form-row label { font-size: 0.8125rem; font-weight: 500; }
.form-row.region-selector-row { align-items: start; }
.form-row.region-selector-row > label { padding-top: 6px; }
.switch-row   { display: flex; align-items: center; gap: 8px; }
.switch-label { font-size: 0.8125rem; }

/* Syncfusion 开关：整块可点 + 与文案垂直居中（ClickableSwitchRow） */
.clickable-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    line-height: 1;
    font-size: 0.8125rem;
}
.clickable-switch-track {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}
.clickable-switch-track .e-control-wrapper,
.clickable-switch-track .e-switch-wrapper {
    margin: 0;
}
.clickable-switch-track,
.clickable-switch-track * {
    pointer-events: none;
}
.clickable-switch-text {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
}
.switches-group {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

/* KV 键值对编辑器 */
.kv-toolbar   { margin-bottom: 8px; }
.kv-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}
.kv-key-wrap  { flex: 0 0 140px; }
.kv-key       { flex: 0 0 140px; }
.kv-value     { flex: 1; }
.kv-error-hint { font-size: 0.72rem; color: #dc2626; margin-top: 2px; }

/* 省市区三级联动组件（RegionSelector） */
.region-selector--horizontal {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.region-selector--horizontal .region-selector__item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.region-selector--vertical .region-selector__item {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.region-selector__label {
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
}
.region-selector .region-combobox { width: 100%; }

/* 强制显示下拉框的清除按钮（当有值时） */
.e-static-clear .e-clear-icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 1 !important;
    visibility: visible !important;
}

/* ─── EpochAI Toast 自定义样式 ─────────────────────────────────────────── */
.epoch-toast-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.epoch-toast-msg {
    font-size: 0.875rem;
    line-height: 1.4;
    word-break: break-word;
}

.epoch-toast-detail {
    margin-top: 4px;
}

.epoch-toast-detail summary {
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.8;
    user-select: none;
}

.epoch-toast-detail pre {
    margin: 4px 0 0;
    padding: 6px 8px;
    font-size: 0.7rem;
    white-space: pre-wrap;
    word-break: break-all;
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.3;
}

.epoch-toast-copy-btn {
    align-self: flex-start;
    margin-top: 4px;
    padding: 2px 10px;
    font-size: 0.75rem;
    border: 1px solid currentColor;
    border-radius: 3px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.epoch-toast-copy-btn:hover { opacity: 1; }

/* ── 兼容性检测覆盖层（device-check.js 使用）────────────────────── */
#epoch-compat-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#epoch-compat-card {
    background: #f8fafc;
    border-radius: 14px;
    padding: 36px 32px 28px;
    width: 520px;
    max-width: calc(100vw - 64px);
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.14), 0 1px 4px rgba(15, 23, 42, 0.08);
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    animation: epoch-compat-in 0.22s ease-out both;
}

@keyframes epoch-compat-in {
    from { opacity: 0; transform: translateY(-16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

#epoch-compat-icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 14px;
}

#epoch-compat-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 22px;
}

.epoch-compat-issue {
    text-align: left;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

.epoch-compat-issue--warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.epoch-compat-issue--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.epoch-compat-issue strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.epoch-compat-issue--warn strong { color: #92400e; }
.epoch-compat-issue--error strong { color: #991b1b; }

.epoch-compat-issue p {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.epoch-compat-issue--warn p { color: #78350f; }
.epoch-compat-issue--error p { color: #7f1d1d; }

#epoch-compat-actions {
    margin: 24px 0 10px;
    display: flex;
    justify-content: center;
}

#epoch-compat-continue {
    padding: 10px 36px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 7px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    letter-spacing: 0.01em;
}

#epoch-compat-continue:hover {
    background: #1d4ed8;
}

#epoch-compat-continue:active {
    transform: scale(0.97);
}

#epoch-compat-note {
    font-size: 0.75rem;
    color: #9ca3af;
    margin: 0;
    line-height: 1.5;
}

/* ── AI 帮助问答抽屉 ──────────────────────────────────────────── */

/* 顶栏 AI 图标按钮 */
.ai-chat-top-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 4px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--e-content-font-color, #374151);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.ai-chat-top-btn:hover {
    background: rgba(99,102,241,.12);
    color: #6366f1;
}
.ai-chat-top-btn .e-icons {
    font-size: 17px;
}

/* 遮罩 */
.hc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 1099;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.hc-overlay--visible {
    opacity: 1;
    pointer-events: all;
}

/* 抽屉主体 */
.hc-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 1100;
    display: flex;
    flex-direction: row;
    background: var(--e-grid-even-bg, #fff);
    box-shadow: -4px 0 24px rgba(0,0,0,.15);
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1),
                width .35s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}
.hc-drawer--open { transform: translateX(0); }

/* 拖拽手柄 */
.hc-resize-handle {
    width: 5px;
    flex-shrink: 0;
    cursor: col-resize;
    background: transparent;
    transition: background .15s;
}
.hc-resize-handle:hover { background: #6366f1; }

/* 历史面板 */
.hc-history-panel {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--e-border-color, #e5e7eb);
    overflow: hidden;
}
.hc-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    font-weight: 600;
    font-size: .85rem;
    border-bottom: 1px solid var(--e-border-color, #e5e7eb);
}
.hc-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}
.hc-history-empty {
    padding: 16px 12px;
    font-size: .82rem;
    color: #9ca3af;
    text-align: center;
}
.hc-history-item {
    display: flex;
    align-items: center;
    padding: 7px 10px;
    cursor: pointer;
    gap: 4px;
    border-radius: 4px;
    margin: 2px 4px;
    font-size: .82rem;
    transition: background .12s;
}
.hc-history-item:hover { background: rgba(99,102,241,.08); }
.hc-history-item--active { background: rgba(99,102,241,.14); font-weight: 600; }
.hc-history-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hc-history-date {
    font-size: .68rem;
    color: #9ca3af;
    white-space: nowrap;
}
.hc-history-del {
    opacity: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #ef4444;
    padding: 0 2px;
    font-size: 13px;
    transition: opacity .12s;
}
.hc-history-item:hover .hc-history-del { opacity: 1; }

/* 主区域 */
.hc-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* 标题栏 */
.hc-titlebar {
    display: flex;
    align-items: center;
    padding: 0 12px;
    height: 48px;
    border-bottom: 1px solid var(--e-border-color, #e5e7eb);
    gap: 6px;
    flex-shrink: 0;
}
.hc-title {
    flex: 1;
    font-weight: 600;
    font-size: .9rem;
}
.hc-titlebar-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}
.hc-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    color: var(--e-content-font-color, #374151);
    transition: background .12s, color .12s;
}
.hc-icon-btn:hover { background: rgba(99,102,241,.12); color: #6366f1; }
.hc-icon-btn--active { color: #6366f1; background: rgba(99,102,241,.1); }
.hc-icon-btn--close:hover { background: rgba(239,68,68,.1); color: #ef4444; }

/* SfAIAssistView 容器 */
.hc-assist-wrap {
    flex: 1;
    min-height: 0;          /* 关键：防止 flex 子元素撑破父容器 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.hc-assist-wrap .e-aiassistview {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}
/* 确保内容区滚动、输入栏始终可见 */
.hc-assist-wrap .e-view-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.hc-assist-wrap .e-footer {
    flex-shrink: 0 !important;
    position: relative !important;
}

/* Banner */
.hc-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px 16px;
    gap: 8px;
}
.hc-banner-icon .e-icons { font-size: 36px; color: #6366f1; }
.hc-banner-title { font-size: 1.1rem; font-weight: 700; }
.hc-banner-desc  { font-size: .85rem; color: #6b7280; text-align: center; }

/* 附件上传 */
.hc-footer-extras {
    display: flex;
    align-items: center;
    padding: 0 8px 6px;
}
.hc-attach-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: .82rem;
    color: #6b7280;
    padding: 3px 6px;
    border-radius: 4px;
    transition: background .12s;
}
.hc-attach-label:hover { background: rgba(99,102,241,.08); color: #6366f1; }
.hc-attach-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hc-attach-clear {
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9ca3af;
    padding: 0 2px;
    font-size: 14px;
    line-height: 1;
}

/* 错误提示 */
.hc-error {
    padding: 6px 12px;
    font-size: .82rem;
    color: #ef4444;
    background: rgba(239,68,68,.06);
    flex-shrink: 0;
}

/* 来源参考 */
.hc-sources {
    padding: 6px 12px;
    font-size: .8rem;
    color: #6b7280;
    border-top: 1px solid var(--e-border-color, #e5e7eb);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.hc-source-link {
    color: #6366f1;
    text-decoration: none;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(99,102,241,.08);
    transition: background .12s;
}
.hc-source-link:hover { background: rgba(99,102,241,.18); }

/* ── RichTextEditor 全屏（HtmlEditor）与应用 Sidebar 共存 ────────────
   Syncfusion RTE 全屏会给容器加 .e-rte-full-screen 并 position:fixed。
   应用 Sidebar（.app-sidebar，z-index:1000）位于最左侧，展开 220px / 收缩 64px。
   因此全屏时需要：
     1) 把 z-index 抬高到高于 Sidebar；
     2) 将 left / width 按 Sidebar 实际宽度避让，避免编辑器被侧边栏覆盖。
*/
.e-richtexteditor.e-rte-full-screen,
.e-richtexteditor.e-rte-fullscreen {
    z-index: 1100 !important;
    left: 64px !important;
    width: calc(100vw - 64px) !important;
    max-width: calc(100vw - 64px) !important;
}
/* Sidebar 处于展开态（非 dock-close）时，改为避让完整 220px 宽度 */
body:has(.app-sidebar.e-sidebar:not(.e-close)) .e-richtexteditor.e-rte-full-screen,
body:has(.app-sidebar.e-sidebar:not(.e-close)) .e-richtexteditor.e-rte-fullscreen {
    left: 220px !important;
    width: calc(100vw - 220px) !important;
    max-width: calc(100vw - 220px) !important;
}


