/* ── 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;
}
/* 无论父级字体如何，始终保证 e-icons 使用 Syncfusion 图标字体 */
.e-icons {
    font-family: 'e-icons' !important;
}

:root {
    /* ── 基础色阶 ── */
    --app-bg: #f5f7fb;
    --app-surface: #ffffff;
    --app-bg-subtle: #f7f8fa;
    --app-surface-alt: #f8fafc;
    --app-text: #111827;
    --app-text-muted: #6b7280;
    --app-border: #e5e7eb;
    --app-hover: rgba(15, 23, 42, 0.08);
    --app-bg-hover: #f1f5f9;
    --app-primary: var(--color-sf-primary, var(--sf-primary, #2563eb));
    --app-primary-text: #ffffff;
    /* ── 状态语义色 ── */
    --app-success-bg: #dcfce7;
    --app-success-text: #166534;
    --app-success-border: #bbf7d0;
    --app-warning-bg: #fff7ed;
    --app-warning-text: #92400e;
    --app-warning-border: #fed7aa;
    --app-danger-bg: #fee2e2;
    --app-danger-text: #991b1b;
    --app-danger-border: #fecaca;
    --app-info-bg: #e0f2fe;
    --app-info-text: #0369a1;
    --app-info-border: #bae6fd;
    /* ── 代码块 ── */
    --app-code-bg: #f1f5f9;
    --app-code-text: #0f172a;
    --app-code-border: #e2e8f0;
}

body[data-sf-theme$="-dark"],
body[data-sf-theme="highcontrast"] {
    --app-bg: #0f172a;
    --app-surface: #111827;
    --app-bg-subtle: #1e293b;
    --app-surface-alt: #1e293b;
    --app-text: #e5e7eb;
    --app-text-muted: #94a3b8;
    --app-border: #374151;
    --app-hover: rgba(148, 163, 184, 0.2);
    --app-bg-hover: #1e293b;
    /* ── 状态语义色 暗色 ── */
    --app-success-bg: #14532d;
    --app-success-text: #86efac;
    --app-success-border: #166534;
    --app-warning-bg: #451a03;
    --app-warning-text: #fdba74;
    --app-warning-border: #92400e;
    --app-danger-bg: #7f1d1d;
    --app-danger-text: #fca5a5;
    --app-danger-border: #991b1b;
    --app-info-bg: #0c4a6e;
    --app-info-text: #7dd3fc;
    --app-info-border: #0369a1;
    /* ── 代码块 暗色 ── */
    --app-code-bg: #1e293b;
    --app-code-text: #e2e8f0;
    --app-code-border: #334155;
}

/* 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;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
    padding: 16px 0 0;
    background: var(--app-bg);
    color: var(--app-text);
}

.grid-page-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.grid-page-layout .page-header,
.grid-page-layout .filter-bar,
.grid-page-layout .load-error-banner,
.grid-page-layout .pager-bar {
    flex: 0 0 auto;
}

.grid-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.grid-content > * {
    flex: 1 1 auto;
    min-height: 0;
}

.grid-content .generic-grid-inner {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.grid-content .generic-grid-inner > .e-grid {
    flex: 1 1 auto;
    min-height: 0;
    height: 100% !important;
}

/* ── 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;
}

/* 列头勾选框垂直居中（自定义 padding 撑高表头后 Syncfusion 默认未居中） */
.e-grid .e-headercell .e-headerchkcelldiv {
    display: flex;
    align-items: center;
    height: 100%;
}

.e-grid .e-headercell .e-checkbox-wrapper {
    display: flex;
    align-items: center;
}

.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(--app-bg-subtle) !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(--app-text) !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(--app-primary) !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;
}

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

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

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

.page-header-left { display: flex; align-items: center; gap: 10px; }
.page-header-left h2 { margin: 0; }

/* 页面头部工具栏按钮区 */
.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-row 右侧 */
.filter-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}
.filter-toolbar { display: flex; gap: 6px; align-items: center; }

.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 模式分页附加栏：由 JS 挂载到 Syncfusion .e-gridpager 内部，
   与内置翻页、PageSize 下拉处于同一个导航工具条 DOM 区域。 */
.grid-pager-addon {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-left: auto;
    padding: 0 12px;
    font-size: 0.8125rem;
    color: var(--app-text-muted);
    background: transparent;
    border: none;
    height: 100%;
    flex: 0 0 auto;
    min-width: max-content;
    white-space: nowrap;
    pointer-events: auto;
}
.generic-grid-inner {
    position: relative;
}
.generic-grid-inner > .grid-pager-addon {
    display: none;
}
.e-grid .e-gridpager {
    display: flex;
    align-items: center;
}
.e-grid .e-gridpager .grid-pager-addon {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: auto !important;
    max-width: none !important;
    min-width: max-content !important;
    white-space: nowrap !important;
}
.e-grid .e-gridpager .grid-pager-addon .pager-addon-jump,
.e-grid .e-gridpager .grid-pager-addon .pager-addon-stat {
    display: inline-flex !important;
    align-items: center !important;
    width: auto !important;
    max-width: none !important;
    min-width: max-content !important;
    white-space: nowrap !important;
}
.e-grid .e-gridpager .e-pagercontainer,
.e-grid .e-gridpager .e-pagesizes {
    display: flex !important;
    align-items: center !important;
    align-self: center !important;
    height: 32px;
    min-height: 32px;
    line-height: 32px;
}
.e-grid .e-gridpager .e-pagesizes,
.e-grid .e-gridpager .e-pagerdropdown {
    height: 32px;
    min-height: 32px;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
.e-grid .e-gridpager .e-pagerdropdown,
.e-grid .e-gridpager .e-pagerdropdown .e-input-group,
.e-grid .e-gridpager .e-pagerdropdown .e-ddl {
    display: inline-flex !important;
    align-items: center !important;
    align-self: center !important;
    vertical-align: middle !important;
}
.e-grid .e-gridpager .e-pagerdropdown .e-input-group,
.e-grid .e-gridpager .e-pagerdropdown .e-ddl {
    height: 31px !important;
    min-height: 31px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
.grid-pager-addon > * {
    flex: 0 0 auto;
    pointer-events: auto;
}
.pager-addon-stat {
    min-width: max-content;
    overflow: visible;
    white-space: nowrap;
}
.pager-addon-stat b { color: var(--app-text); font-weight: 600; }
.pager-addon-jump {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.pager-jump-input {
    width: 42px;
    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: var(--app-danger-bg);
    border: 1px solid var(--app-danger-border);
    border-radius: 6px;
    color: var(--app-danger-text);
    padding: 10px 16px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

/* Badge 状态徽章 */
.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.72rem;
    white-space: nowrap;
}
/* 表单查看模式专用：按钮风格圆角标签（叠加在 .badge 上） */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 16px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    border: 1.5px solid color-mix(in srgb, currentColor 30%, transparent);
    justify-self: start; /* 防止在 grid 单元格中被拉伸 */
    width: fit-content;
}
.badge-pill::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    opacity: 0.85;
}
.badge-success   { background: #dcfce7; color: #166534; }
.badge-muted     { background: #f3f4f6; color: #6b7280; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-warning   { background: #fff7ed; color: #92400e; }
.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-warning   { background: #451a03; color: #fdba74; }
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: var(--app-danger-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
    min-width: 0;
}
.field-hint { font-size: 0.75rem; color: var(--app-text-muted); margin-top: 3px; }
.req { color: var(--app-danger-text); }
.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: 120px 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.form-row label { font-size: 0.8125rem; font-weight: 500; white-space: nowrap; }
.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: var(--app-danger-text); 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;
}
/* 使组件内的 ComboBox 宽度撑满容器 */
.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;
    text-align: justify;
}

.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; }

/* ═══════════════════════════════════════════════════════════════════
   File Preview Component Styles
   ═══════════════════════════════════════════════════════════════════ */

/* ── Container ──────────────────────────────────────────────────── */
.fp-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 6px;
}

/* ── Viewer base ────────────────────────────────────────────────── */
.fp-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.fp-content {
    flex: 1;
    overflow: auto;
    position: relative;
    min-height: 0;
}

/* ── SfSpinner overlay ──────────────────────────────────────────── */
.fp-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--app-surface);
    z-index: 10;
    opacity: 0.92;
    border-radius: inherit;
}

/* ── Toolbar ────────────────────────────────────────────────────── */
.fp-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
    min-height: 40px;
    flex-shrink: 0;
}

.fp-toolbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 0 1 auto;
}

.fp-toolbar-icon {
    font-size: 16px;
    color: var(--app-primary);
    flex-shrink: 0;
}

.fp-toolbar-filename {
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.fp-toolbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.fp-toolbar-right {
    flex-shrink: 0;
}

.fp-toolbar-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.fp-tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px !important;
    font-size: 12px !important;
    height: 26px !important;
    min-height: 26px !important;
}

/* 纯图标工具栏按钮：固定 26×26 方形，去除横向 padding */
.fp-tb-icon-btn {
    padding: 0 !important;
    width: 26px !important;
    min-width: 26px !important;
    justify-content: center;
}

.fp-tb-icon-btn .e-icons {
    font-size: 14px;
    line-height: 1;
}

.fp-tb-label {
    font-size: 12px;
    color: var(--app-text);
    white-space: nowrap;
    padding: 0 4px;
}

.fp-tb-zoom-label {
    font-size: 11px;
    color: var(--app-text);
    min-width: 36px;
    text-align: center;
    opacity: 0.7;
}

.fp-tb-divider {
    width: 1px;
    height: 18px;
    background: var(--app-border);
    flex-shrink: 0;
    margin: 0 4px;
}

.fp-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    font-size: 12px !important;
    padding: 3px 10px !important;
    height: 26px !important;
}

.fp-download-label {
    font-size: 12px;
}

/* ── Image viewer ───────────────────────────────────────────────── */
.fp-image-content {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    background: repeating-conic-gradient(#e5e7eb 0% 25%, var(--app-surface) 0% 50%)
                0 0 / 20px 20px;
}

.fp-image-wrap {
    display: inline-block;
    transition: transform 0.2s ease;
}

.fp-image {
    display: block;
    max-width: 100%;
}

/* ── Video viewer ───────────────────────────────────────────────── */
.fp-video-content {
    display: flex;
    flex-direction: column;
    background: #000;
}

.fp-video {
    width: 100%;
    flex: 1;
    max-height: calc(100% - 48px);
    display: block;
    object-fit: contain;
}

.fp-video-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.85);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.fp-vc-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    opacity: 0.85;
    transition: opacity 0.15s;
}
.fp-vc-btn:hover { opacity: 1; background: rgba(255,255,255,0.12); }

/* 静音状态：e-volume 图标加删除线视觉提示 */
.fp-muted {
    position: relative;
    opacity: 0.45;
}

.fp-vc-time {
    font-size: 12px;
    color: #ccc;
    white-space: nowrap;
}

.fp-vc-progress {
    flex: 1;
    min-width: 80px;
    accent-color: var(--app-primary);
}

.fp-vc-volume {
    width: 72px;
    accent-color: var(--app-primary);
}

/* ── PDF viewer ─────────────────────────────────────────────────── */
.fp-pdf-content {
    height: 100%;
}

/* ── Word viewer ────────────────────────────────────────────────── */
.fp-word-content {
    height: 100%;
}

/* ── Excel viewer ───────────────────────────────────────────────── */
.fp-excel-content {
    height: 100%;
}

/* ── Audio viewer ───────────────────────────────────────────────── */
.fp-audio-content {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--app-bg);
}

.fp-audio-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px 24px;
    background: var(--app-surface);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    min-width: 320px;
    max-width: 560px;
    width: 90%;
}

.fp-audio-icon {
    font-size: 48px;
    color: var(--app-primary);
    opacity: 0.85;
}

.fp-audio-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--app-text);
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fp-audio-hidden {
    display: none;
}

.fp-audio-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
    background: var(--app-hover);
    padding: 8px 12px;
    border-radius: 8px;
}

/* ── PPT viewer (image-based) ───────────────────────────────────── */
.fp-ppt-content {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    background: #3a3a3a;
}

.fp-ppt-slide-wrap {
    display: inline-block;
    transition: transform 0.2s ease;
    padding: 16px;
}

.fp-ppt-slide-img {
    display: block;
    max-width: 100%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    border-radius: 2px;
}

.fp-ppt-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    color: var(--app-text);
    text-align: center;
    height: 100%;
    width: 100%;
    background: var(--app-bg);
}

.fp-ppt-error-icon {
    font-size: 40px;
    color: #e55353;
    opacity: 0.8;
}

.fp-ppt-error-text {
    font-size: 14px;
    margin: 0;
    opacity: 0.85;
}

.fp-ppt-page-input {
    width: 50px;
    text-align: center;
    padding: 2px 4px;
    font-size: 12px;
    border: 1px solid var(--app-border);
    border-radius: 3px;
    height: 26px;
    background: var(--app-surface);
    color: var(--app-text);
}

.fp-ppt-page-input::-webkit-inner-spin-button,
.fp-ppt-page-input::-webkit-outer-spin-button {
    opacity: 0.5;
}

/* ── Text/CSV/JSON viewer ────────────────────────────────────────────── */
.fp-text-content, .fp-json-content {
    height: 100%;
}

.fp-text-pre, .fp-json-pre {
    margin: 0;
    padding: 16px;
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    line-height: 1.6;
    color: var(--app-text);
    tab-size: 4;
}

.fp-csv-wrap {
    padding: 8px;
    overflow: auto;
}

.fp-csv-table {
    border-collapse: collapse;
    font-size: 13px;
    width: 100%;
}
.fp-csv-table th,
.fp-csv-table td {
    padding: 6px 10px;
    border: 1px solid var(--app-border);
    text-align: left;
    white-space: nowrap;
}
.fp-csv-table thead th {
    background: var(--app-hover);
    font-weight: 600;
    position: sticky;
    top: 0;
}
.fp-csv-table tbody tr:hover td {
    background: var(--app-hover);
}

/* ── Markdown viewer ────────────────────────────────────────────── */
.fp-md-content {
    height: 100%;
}

.fp-md-body {
    padding: 24px 32px;
    max-width: 860px;
    margin: 0 auto;
    font-size: 15px;
    line-height: 1.75;
    color: var(--app-text);
}
.fp-md-body h1,.fp-md-body h2,.fp-md-body h3 { margin-top: 1.4em; }
.fp-md-body code { background: var(--app-hover); padding: 2px 5px; border-radius: 3px; font-size: 0.88em; }
.fp-md-body pre  { background: var(--app-hover); padding: 14px 16px; border-radius: 6px; overflow: auto; }
.fp-md-body pre code { background: none; padding: 0; }
.fp-md-body blockquote { border-left: 3px solid var(--app-primary); margin: 0; padding-left: 16px; opacity: 0.8; }
.fp-md-body img { max-width: 100%; }
.fp-md-body table { border-collapse: collapse; width: 100%; }
.fp-md-body th,.fp-md-body td { border: 1px solid var(--app-border); padding: 6px 10px; }
.fp-md-body thead th { background: var(--app-hover); }

/* ── EPUB viewer ────────────────────────────────────────────────── */
.fp-epub-content {
    height: 100%;
}

.fp-epub-layout {
    display: flex;
    height: 100%;
    min-width: 0;
    overflow: hidden;
}

.fp-epub-toc {
    width: 280px;
    min-width: 220px;
    max-width: 38%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--app-border);
    background: var(--app-bg-subtle);
    color: var(--app-text);
    overflow: hidden;
}

.fp-epub-toc-title {
    flex-shrink: 0;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid var(--app-border);
}

.fp-epub-toc-list {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 6px 0;
}

.fp-epub-toc-item {
    width: 100%;
    display: block;
    border: 0;
    background: transparent;
    color: var(--app-text);
    text-align: left;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.35;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fp-epub-toc-item:hover {
    background: var(--app-hover);
}

.fp-epub-toc-item.is-active {
    background: var(--app-info-bg);
    color: var(--app-primary);
    font-weight: 600;
}

.fp-epub-reader {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

.fp-epub-area {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── Unsupported viewer ─────────────────────────────────────────── */
.fp-unsupported-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.fp-unsupported-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 24px;
    text-align: center;
}

.fp-unsupported-icon {
    font-size: 48px;
    color: var(--app-border);
}

.fp-unsupported-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--app-text);
    margin: 0;
    word-break: break-all;
}

.fp-unsupported-tip {
    font-size: 13px;
    color: var(--app-text);
    opacity: 0.6;
    margin: 0;
}

.fp-unsupported-download {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

/* ── 兼容性检测覆盖层（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;
}

/* ──────────────────────────────────────────────────────────────────────────
   Dynamic Form Renderer — 动态编辑表单渲染器
   ────────────────────────────────────────────────────────────────────────── */
.dyn-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 4px;
}
.dyn-form-empty {
    padding: 24px;
    text-align: center;
    color: var(--app-text-muted);
}
.dyn-form-group {
    border: 1px solid var(--app-border);
    border-radius: 6px;
    padding: 8px 12px 12px;
    background: var(--app-surface);
}
.dyn-form-group-title {
    padding: 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--app-text);
}
.dyn-form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 10px 14px;
}
.dyn-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.dyn-field-label {
    font-size: 12px;
    color: var(--app-text-muted);
    margin: 0;
}
.dyn-field-required {
    color: var(--app-danger-text, #dc2626);
    margin-left: 2px;
}
.dyn-field-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dyn-field-help {
    font-size: 11px;
    color: var(--app-text-muted);
}
.dyn-field-error {
    font-size: 11px;
    color: var(--app-danger-text, #dc2626);
}
.dyn-field-warning {
    font-size: 11px;
    color: var(--app-warning-text, #b45309);
}
.dyn-radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* 动态表单多行文本框：空态一行高，随内容自动撑开，超过 max-height 后内部滚动。
   主方案：field-sizing: content（浏览器原生按内容自适应，Chrome 123+/Firefox 137+/
            Safari 17.4+ 均已支持）。
   后备：js/dyn-textarea-autosize.js 会在不支持 field-sizing 的浏览器上写 inline
         height 兜底。不管哪种路径，min/max-height 在此集中声明。 */
.dyn-textarea-autosize.e-input-group textarea,
.dyn-textarea-autosize textarea.e-input,
.dyn-textarea-autosize textarea {
    field-sizing: content;
    min-height: 36px !important;
    max-height: 384px;
    height: auto;
    resize: none;
    overflow-y: auto;
    line-height: 1.5;
    box-sizing: border-box;
}

/* ──────────────────────────────────────────────────────────────────────────
   ProjectOutcomeEdit — 成果数据编辑页
   ────────────────────────────────────────────────────────────────────────── */
.outcome-edit-page {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    height: auto;
}
.outcome-splitter {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    width: 100%;
}
.outcome-pane {
    display: flex; flex-direction: column; height: 100%;
    background: var(--app-surface);
}
.outcome-pane-left { border-right: 1px solid var(--app-border); }
.outcome-toolbar {
    display: flex; gap: 8px; align-items: center;
    padding: 8px; border-bottom: 1px solid var(--app-border);
}
.outcome-toolbar-gap { flex: 1 1 auto; }
/* 搜索框融合控件 */
.outcome-search-box {
    display: inline-flex; align-items: center;
    height: 30px; border-radius: 4px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.outcome-search-box:focus-within {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-primary) 18%, transparent);
}
.outcome-search-icon {
    padding: 0 6px 0 8px;
    color: var(--app-text-muted);
    pointer-events: none;
    font-size: 13px;
}
.outcome-search-input {
    flex: 1 1 auto; min-width: 160px; max-width: 320px;
    border: none; outline: none; background: transparent;
    color: var(--app-text); font-size: 13px;
    padding: 0; height: 100%;
}
.outcome-search-input::placeholder { color: var(--app-text-muted); }
.outcome-search-clear {
    display: flex; align-items: center; justify-content: center;
    width: 22px; height: 100%; padding: 0;
    border: none; background: transparent; cursor: pointer;
    color: var(--app-text-muted); font-size: 12px;
}
.outcome-search-clear:hover { color: var(--app-text); }
.outcome-search-btn {
    height: 100%; padding: 0 10px;
    border: none; border-left: 1px solid var(--app-border);
    background: var(--app-bg-subtle); cursor: pointer;
    color: var(--app-text); font-size: 13px; white-space: nowrap;
}
.outcome-search-btn:hover { background: var(--app-bg-hover); }
/* 左侧成果行列表：GenericGrid（替代原 HTML table） */
.outcome-grid-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
    /* flex-column：generic-grid-inner 取剩余高度，addon 覆盖在 pager 同一行右侧 */
    display: flex;
    flex-direction: column;
    /* container query 锚点，用于 addon 行窄屏左对齐切换 */
    container-type: inline-size;
    container-name: outcome-grid;
}
.outcome-dict-loading {
    position: absolute;
    inset: 0;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: color-mix(in srgb, var(--app-surface) 88%, transparent);
    color: var(--app-text);
    font-size: 14px;
    font-weight: 500;
}
/* SfGrid 外层包裹，在 flex-column 中撑满剩余高度 */
.outcome-grid-wrap .generic-grid-inner {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.outcome-grid-wrap .e-grid { border: none; }
/* outcome 上下文覆盖：addon 位于内置 pager 内并右对齐 */
.outcome-grid-wrap .e-grid .e-gridpager .grid-pager-addon {
    height: 100%;
    flex-wrap: nowrap;
    justify-content: flex-end;
    border-top: none;
    margin-left: auto;
    padding: 0 10px;
    gap: 10px;
    font-size: 0.75rem;
}
.outcome-grid-wrap .e-grid .e-gridpager .grid-pager-addon > * {
    pointer-events: auto;
}
/* 在 outcome 上下文 stat 为只读说明文字，保持右侧对齐且不阻断底层点击 */
.outcome-grid-wrap .e-grid .e-gridpager .grid-pager-addon .pager-addon-stat {
    text-align: right;
}
.outcome-grid-wrap .e-grid .e-gridpager .grid-pager-addon .pager-addon-jump {
    justify-content: flex-end;
}
.outcome-grid-wrap .e-grid .e-gridpager .grid-pager-addon .pager-jump-input {
    width: 38px;
    height: 20px;
    padding: 1px 4px;
    font-size: 0.75rem;
}
/* 成果页内置分页器收紧尺寸，并固定左对齐 */
.outcome-grid-wrap .e-grid .e-gridpager {
    min-height: 44px;
    height: 44px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 0.8125rem;
}
.outcome-grid-wrap .e-grid .e-gridpager .e-pagercontainer,
.outcome-grid-wrap .e-grid .e-gridpager .e-pagesizes {
    display: flex;
    align-items: center;
}
.outcome-grid-wrap .e-grid .e-gridpager .e-pagercontainer,
.outcome-grid-wrap .e-grid .e-gridpager .e-numericcontainer {
    gap: 0;
}
.outcome-grid-wrap .e-grid .e-gridpager .e-numericitem,
.outcome-grid-wrap .e-grid .e-gridpager .e-currentitem,
.outcome-grid-wrap .e-grid .e-gridpager .e-first,
.outcome-grid-wrap .e-grid .e-gridpager .e-prev,
.outcome-grid-wrap .e-grid .e-gridpager .e-next,
.outcome-grid-wrap .e-grid .e-gridpager .e-last,
.outcome-grid-wrap .e-grid .e-gridpager .e-pp,
.outcome-grid-wrap .e-grid .e-gridpager .e-np {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    height: 28px;
    padding: 0;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 0.8125rem;
    vertical-align: middle;
}
.outcome-grid-wrap .e-grid .e-gridpager .e-first::before,
.outcome-grid-wrap .e-grid .e-gridpager .e-prev::before,
.outcome-grid-wrap .e-grid .e-gridpager .e-next::before,
.outcome-grid-wrap .e-grid .e-gridpager .e-last::before,
.outcome-grid-wrap .e-grid .e-gridpager .e-pp::before,
.outcome-grid-wrap .e-grid .e-gridpager .e-np::before {
    line-height: 1;
}
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown {
    width: 88px;
}
.outcome-grid-wrap .e-grid .e-gridpager .e-pagesizes,
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown,
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown .e-input-group,
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown .e-ddl {
    display: inline-flex;
    align-items: center;
    align-self: center;
    vertical-align: middle;
}
.outcome-grid-wrap .e-grid .e-gridpager .e-pagesizes,
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown {
    height: 28px;
    min-height: 28px;
    margin: 0 !important;
}
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown .e-input-group,
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown .e-ddl {
    min-height: 28px;
    height: 28px;
    font-size: 0.8125rem;
}
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown .e-input-group {
    padding-top: 0;
    padding-bottom: 0;
}
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown .e-input-group input,
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown .e-ddl .e-input-value,
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown .e-ddl .e-input {
    height: 26px;
    line-height: 26px;
    min-height: 26px;
}
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown .e-input-group-icon,
.outcome-grid-wrap .e-grid .e-gridpager .e-pagerdropdown .e-ddl-icon {
    height: 26px;
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.outcome-table-wrap { flex: 1 1 auto; overflow: auto; }
.outcome-table {
    width: 100%; border-collapse: collapse; font-size: 13px; color: var(--app-text);
}
.outcome-table thead {
    position: sticky; top: 0; z-index: 1; background: var(--app-bg-subtle);
}
.outcome-table th,
.outcome-table td {
    border-bottom: 1px solid var(--app-border);
    padding: 6px 10px;
    text-align: left;
    white-space: nowrap;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.outcome-table tbody tr { cursor: pointer; }
.outcome-table tbody tr:hover { background: var(--app-hover); }
.outcome-row-selected { background: var(--app-bg-hover); }
.outcome-table-empty { text-align: center; color: var(--app-text-muted); padding: 24px; }
.outcome-pager {
    display: flex; gap: 8px; align-items: center; justify-content: flex-end;
    padding: 6px 10px; border-top: 1px solid var(--app-border);
    color: var(--app-text-muted); font-size: 12px;
}
.outcome-row-count { color: var(--app-text-muted); }
.outcome-pane-right {
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
}
/* 关闭 Syncfusion Splitter 右侧 pane 自带的滚动，避免双滚动条；
   滚动统一交由 .outcome-pane-right 承担，以便 form-header 能 sticky。*/
.outcome-splitter .e-pane.e-scrollable:has(> .outcome-pane-right) {
    overflow: hidden;
}
.outcome-form-placeholder {
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: var(--app-text-muted);
}
.outcome-form-header {
    position: sticky;
    top: -10px;
    z-index: 3;
    display: flex; align-items: center; gap: 10px;
    margin: -10px -10px 8px;
    padding: 10px 10px 8px;
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
}
.outcome-form-title { flex: 1 1 auto; font-weight: 600; }
.outcome-form-actions { display: flex; gap: 6px; }

/* 主/子资料标题列（grid） */
.outcome-th-ref {
    background: var(--app-bg-alt, #f5f7fa);
    color: var(--app-text-secondary, #666);
    font-style: italic;
    white-space: nowrap;
}
.outcome-td-ref {
    color: var(--app-text-secondary, #555);
    font-size: 12px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 主/子资料标题卡片（表单底部） */
.outcome-source-titles {
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--app-bg-alt, #f5f7fa);
    border: 1px solid var(--app-border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.outcome-source-title-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.outcome-source-title-label {
    flex: 0 0 80px;
    font-size: 12px;
    color: var(--app-text-muted);
    padding-top: 1px;
}
.outcome-source-title-value {
    flex: 1 1 auto;
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text);
    word-break: break-all;
}

/* ─────────────────────────────────────────────────────────
   权限置灰容器：AuthorizePermission Mode=Disable 的外层包裹。
   - pointer-events:none 阻止点击事件到达里面的按钮/链接；
   - opacity 表达"不可用"视觉；
   - cursor:not-allowed 与 title 结合提示"无权操作"。
   注意 <span> 本身不能接收 pointer 事件，但里面的子元素会继承 none。
   ───────────────────────────────────────────────────────── */
.epoch-auth-disabled {
    display: inline-block;
    cursor: not-allowed;
    position: relative;
}
.epoch-auth-disabled > * {
    pointer-events: none;
    opacity: 0.45;
    filter: grayscale(100%);
}

.epoch-auth-forbidden {
    display: inline-block;
    width: 0;
    height: 0;
}

/* ── 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(--app-surface);
    color: var(--app-text);
    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: var(--app-primary); }
.hc-resize-handle:active { background: var(--app-primary); }

.hc-history-panel {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--app-border);
    background: var(--app-bg-subtle);
    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(--app-border);
}
.hc-history-list { flex: 1; overflow-y: auto; padding: 6px 0; }
.hc-history-empty { padding: 16px 12px; font-size: .82rem; color: var(--app-text-muted); 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: color-mix(in srgb, var(--app-primary) 8%, transparent); }
.hc-history-item--active { background: color-mix(in srgb, var(--app-primary) 14%, transparent); font-weight: 600; }
.hc-history-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-history-date { font-size: .68rem; color: var(--app-text-muted); white-space: nowrap; }
.hc-history-del {
    opacity: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--app-danger-text);
    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(--app-border);
    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(--app-text);
    transition: background .12s, color .12s;
}
.hc-icon-btn:hover { background: color-mix(in srgb, var(--app-primary) 12%, transparent); color: var(--app-primary); }
.hc-icon-btn--active { color: var(--app-primary); background: color-mix(in srgb, var(--app-primary) 10%, transparent); }
.hc-icon-btn--close:hover { background: color-mix(in srgb, var(--app-danger-text) 10%, transparent); color: var(--app-danger-text); }

.hc-assist-wrap {
    flex: 1;
    min-height: 0;
    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;
}

.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: var(--app-primary); }
.hc-banner-title { font-size: 1.1rem; font-weight: 700; }
.hc-banner-desc  { font-size: .85rem; color: var(--app-text-muted); 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: var(--app-text-muted);
    padding: 3px 6px;
    border-radius: 4px;
    transition: background .12s;
}
.hc-attach-label:hover { background: color-mix(in srgb, var(--app-primary) 8%, transparent); color: var(--app-primary); }
.hc-attach-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-attach-clear { border: none; background: transparent; cursor: pointer; color: var(--app-text-muted); padding: 0 2px; font-size: 14px; line-height: 1; }

.hc-error { padding: 6px 12px; font-size: .82rem; color: var(--app-danger-text); background: color-mix(in srgb, var(--app-danger-text) 6%, transparent); flex-shrink: 0; }

.hc-sources {
    padding: 6px 12px;
    font-size: .8rem;
    color: var(--app-text-muted);
    border-top: 1px solid var(--app-border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.hc-source-link {
    color: var(--app-primary);
    text-decoration: none;
    padding: 1px 6px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--app-primary) 8%, transparent);
    transition: background .12s;
}
.hc-source-link:hover { background: color-mix(in srgb, var(--app-primary) 18%, transparent); }

.hc-disclaimer {
    margin: 10px 0 0;
    padding: 7px 12px;
    font-size: .78rem;
    color: var(--app-text-muted);
    background: var(--app-bg-subtle);
    border-top: 1px solid var(--app-border);
    border-radius: 0 0 6px 6px;
    line-height: 1.55;
}

.hc-guest-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: .72rem;
    padding: 2px 7px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--app-warning-bg) 60%, transparent);
    color: var(--app-warning-text);
    border: 1px solid color-mix(in srgb, var(--app-warning-border) 50%, transparent);
    white-space: nowrap;
}

/* ── 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;
}

/* ── 帮助文章 Markdown 正文渲染区（全局共享，HelpCenter / HelpArticlePage 均使用）── */
.article-content {
    padding: 22px 0 10px;
    border-top: 1px solid var(--app-border);
    color: var(--app-text);
    line-height: 1.82;
}
/* 字号调节：统一缩放正文排版，并强制常见富文本标签继承字号（帮助中心 + 公开文档页） */
div.help-detail-content.article-content,
div.docs-detail-content.article-content {
    font-size: calc(1rem * var(--help-article-scale, 1)) !important;
}
div.help-detail-content.article-content p,
div.help-detail-content.article-content li,
div.help-detail-content.article-content ul,
div.help-detail-content.article-content ol,
div.help-detail-content.article-content blockquote,
div.help-detail-content.article-content td,
div.help-detail-content.article-content th,
div.help-detail-content.article-content a,
div.help-detail-content.article-content span,
div.help-detail-content.article-content strong,
div.help-detail-content.article-content em,
div.help-detail-content.article-content b,
div.help-detail-content.article-content i,
div.help-detail-content.article-content u,
div.help-detail-content.article-content s,
div.docs-detail-content.article-content p,
div.docs-detail-content.article-content li,
div.docs-detail-content.article-content ul,
div.docs-detail-content.article-content ol,
div.docs-detail-content.article-content blockquote,
div.docs-detail-content.article-content td,
div.docs-detail-content.article-content th,
div.docs-detail-content.article-content a,
div.docs-detail-content.article-content span,
div.docs-detail-content.article-content strong,
div.docs-detail-content.article-content em,
div.docs-detail-content.article-content b,
div.docs-detail-content.article-content i,
div.docs-detail-content.article-content u,
div.docs-detail-content.article-content s {
    font-size: inherit !important;
}
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    color: var(--app-text);
    margin-top: 1.8em;
    margin-bottom: 0.6em;
    line-height: 1.3;
}
div.help-detail-content.article-content h1,
div.docs-detail-content.article-content h1 { font-size: calc(1.5rem * var(--help-article-scale, 1)) !important; }
div.help-detail-content.article-content h2,
div.docs-detail-content.article-content h2 { font-size: calc(1.2rem * var(--help-article-scale, 1)) !important; }
div.help-detail-content.article-content h3,
div.docs-detail-content.article-content h3 { font-size: calc(1.05rem * var(--help-article-scale, 1)) !important; }
.article-content h1 { font-size: 1.5rem; }
.article-content h2 { font-size: 1.2rem; }
.article-content h3 { font-size: 1.05rem; }
.article-content p,
.article-content li { line-height: 1.82; }
.article-content a {
    color: var(--app-primary);
    text-decoration: none;
}
.article-content a:hover { text-decoration: underline; }
.article-content code {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--app-code-bg);
    color: var(--app-code-text);
    font-size: 0.88em;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}
.article-content pre {
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--app-code-bg);
    border: 1px solid var(--app-code-border);
    overflow-x: auto;
    margin: 1em 0;
}
.article-content pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
    color: var(--app-code-text);
}
.article-content blockquote {
    margin: 1em 0;
    padding: 10px 16px;
    border-left: 4px solid var(--app-primary);
    background: color-mix(in srgb, var(--app-primary) 6%, var(--app-surface));
    border-radius: 0 6px 6px 0;
    color: var(--app-text-muted);
}
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.9rem;
}
.article-content table th,
.article-content table td {
    padding: 8px 12px;
    border: 1px solid var(--app-border);
    text-align: left;
}
.article-content table th {
    background: var(--app-bg-subtle);
    font-weight: 600;
    color: var(--app-text);
}
.article-content hr {
    border: none;
    border-top: 1px solid var(--app-border);
    margin: 1.5em 0;
}
.article-content img {
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid var(--app-border);
}

/* 隐藏 src 为空或缺失的无效图片占位符 */
.article-content img[src=""],
.article-content img:not([src]) {
    display: none;
}

