/* ============================================================================
 * EMS 多主题皮肤系统（可运行时切换）
 * ----------------------------------------------------------------------------
 * 原理：
 *   - 基础令牌定义在 enterprise-theme.css 的 :root（= 主题 C「深蓝品牌」当前样式）。
 *   - 本文件通过 <html data-ui-theme="a|b|c|d"> 覆盖 --enterprise-* 令牌，
 *     由于 enterprise-theme.css 的引擎映射区（--bb-* / --bs-* / --dxbl-*）
 *     几乎全部引用 var(--enterprise-*)，改令牌即可联动 BootstrapBlazor /
 *     Bootstrap / DevExpress 三套引擎，DX 组件代码零改动自动换肤。
 *   - 本文件在 App.razor 中位于所有 app 自定义样式之后加载，确保覆盖生效。
 *
 * 主题：
 *   a = 现代清爽 SaaS（浅色内容 + 深色石墨侧边栏 + 靛蓝）
 *   b = 深色专业控制台（整体深色）
 *   c = 深蓝品牌（当前样式，= 基础令牌，无需覆盖块）
 *   d = 活力青蓝科技（浅色内容 + 白色侧边栏 + 青蓝）
 *   t1 = 现代朱砂（t1.0 设计语言：浅色石板灰内容 + 深红侧栏 + 朱砂主色，默认主题）
 *
 * 修改记录：
 *   2026-11-07  主题完整性补齐（v2.94 三任务改造·任务2 每风格独立配色）：
 *               ① 主题 D 补 --ui-frame-dark（#0f2536，顶栏深石板风格 L 形同色）；
 *               ② 主题 C 新增最小覆盖块 --ui-frame-dark（#1a365d，同上，
 *                  不影响 C 默认外观）；③ 主题 A/D 补内容区画布底色
 *               （#f6f7f9 / #f2f7fb，与白卡片形成层次，对齐 t1 画布模式）。
 *               组织页 design-tpl.css 令牌同期改为全局主题令牌映射，
 *               切主题后整页 chrome 跟随（t1 保持原样）
 *   2026-11-07  新增主题 t1（t1.0 设计语言：朱砂 #C2403A + slate 冷灰 + 深红侧栏，
 *               与 design-tpl.css 同源令牌），设为默认主题；文件尾部新增
 *               「全局精修」区块（滚动条/焦点环/卡片/表格/弹窗，全主题生效）
 *   2026-10-29  菜单层级缩进收紧：顶级 33.6px→24px（与侧栏 logo 左缘对齐），
 *               二级 48→40 / 三级 62→56 / 四级 76→72（保持 16px 级差），
 *               修复左侧菜单树左边留白过宽的问题（全主题生效）
 *   2026-10-29  白色/浅灰蓝顶栏用户信息修复：触发器用户名改深色（--bb-logout-text-color 覆盖）；
 *               下拉用户信息横幅（蓝底 #0078d4，元素带 dropdown-item 类）强制恢复白字，
 *               修复被各主题 .layout-header .dropdown-item 颜色规则染成深灰导致看不清的问题
 * ============================================================================ */


/* ============================================================================
 * 主题 A：现代清爽 SaaS（靛蓝 Indigo）
 * ============================================================================ */
:root[data-ui-theme="a"] {    /* 框架深色（侧栏主体色，顶栏“深石板”风格引用此值以保证 L 形框架同色） */
    --ui-frame-dark: #1b2130;
    /* 品牌色 - 靛蓝 */
    --enterprise-primary: #4f46e5;
    --enterprise-primary-light: #4338ca;
    --enterprise-primary-lighter: #6366f1;
    --enterprise-primary-dark: #3730a3;

    /* 辅助色 */
    --enterprise-secondary: #64748b;
    --enterprise-accent: #f59e0b;
    --enterprise-success: #059669;
    --enterprise-warning: #d97706;
    --enterprise-danger: #dc2626;
    --enterprise-info: #0ea5e9;

    /* 中性色（浅色内容底） */
    --enterprise-gray-50: #f6f7f9;
    --enterprise-gray-100: #eef1f5;
    --enterprise-gray-200: #e5e9f0;
    --enterprise-gray-300: #d4dae4;
    --enterprise-gray-400: #b6bfcd;
    --enterprise-gray-500: #64748b;
    --enterprise-gray-600: #475569;
    --enterprise-gray-700: #334155;
    --enterprise-gray-800: #1f2937;
    --enterprise-gray-900: #0f172a;

    /* 文字 */
    --enterprise-text-primary: #1e293b;
    --enterprise-text-secondary: #64748b;
    --enterprise-text-muted: #94a3b8;

    /* 边框 / 阴影 / 圆角 */
    --enterprise-border-color: #e5e9f0;
    --enterprise-border-color-hover: #d4dae4;
    --enterprise-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --enterprise-shadow-md: 0 4px 8px rgba(16, 24, 40, 0.08);
    --enterprise-shadow-lg: 0 12px 20px rgba(16, 24, 40, 0.10);
    --enterprise-shadow-xl: 0 24px 40px rgba(16, 24, 40, 0.14);
    --enterprise-border-radius: 10px;

    /* 引擎映射（覆盖基础映射中硬编码的 RGB） */
    --bb-focus-ring-color: rgba(99, 102, 241, 0.35);
    --bs-primary-rgb: 79, 70, 229;
}

/* A：深色石墨侧边栏 */
[data-ui-theme="a"] .bb-layout .layout-side,
[data-ui-theme="a"] .layout .layout-side,
[data-ui-theme="a"] .enterprise-sidebar {
    background: #1b2130 !important;
    border-color: transparent !important;
    box-shadow: none !important;
}
[data-ui-theme="a"] .enterprise-sidebar-header {
    /* 与侧栏主体同色，Logo 区不再单独加深 */
    background: #1b2130 !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}
[data-ui-theme="a"] .enterprise-sidebar-title { color: #ffffff !important; }
[data-ui-theme="a"] .enterprise-sidebar-header small,
[data-ui-theme="a"] .enterprise-sidebar-header .text-muted { color: #8b93a7 !important; }
/* A：菜单项实际类名为 .nav-link（BootstrapBlazor），.menu-item 一并保留兜底 */
[data-ui-theme="a"] .layout-side .menu,
[data-ui-theme="a"] .layout-side .bb-menu,
[data-ui-theme="a"] .layout-side .enterprise-sidebar .menu {
    --bb-menu-item-hover-bg: #242b3d;
    --bb-menu-item-hover-color: #ffffff;
    --bb-menu-active-color: #ffffff;
    --bb-menu-active-bg: #4f46e5;
}
[data-ui-theme="a"] .layout-side .nav-link { color: #c2c9d6 !important; }
[data-ui-theme="a"] .layout-side .nav-link i,
[data-ui-theme="a"] .layout-side .nav-link .fa { color: inherit !important; }
[data-ui-theme="a"] .layout-side .nav-link:hover { background: #242b3d !important; color: #ffffff !important; }
[data-ui-theme="a"] .layout-side .nav-link.active { background: #4f46e5 !important; color: #ffffff !important; }
[data-ui-theme="a"] .layout-side .submenu .nav-link { padding-left: 2.1rem; font-size: 0.8125rem; }
[data-ui-theme="a"] .menu-item { color: #c2c9d6 !important; }
[data-ui-theme="a"] .menu-item:hover { background: #242b3d !important; color: #ffffff !important; }
[data-ui-theme="a"] .menu-item.active { background: rgba(99, 102, 241, 0.20) !important; color: #ffffff !important; }
[data-ui-theme="a"] .menu-item.active::before { background: #818cf8 !important; }
[data-ui-theme="a"] .menu,
[data-ui-theme="a"] .enterprise-sidebar .menu {
    scrollbar-color: #333c50 #1b2130;
}
[data-ui-theme="a"] .menu::-webkit-scrollbar-thumb,
[data-ui-theme="a"] .enterprise-sidebar .menu::-webkit-scrollbar-thumb { background: #333c50; }
[data-ui-theme="a"] .bb-layout .layout-banner { background: #1b2130; }
/* A：内容区画布（浅灰底，与白卡片形成层次；2026-11-07 主题完整性补齐） */
[data-ui-theme="a"] .bb-layout .layout-main,
[data-ui-theme="a"] .layout .layout-main { background: #f6f7f9 !important; }


/* ============================================================================
 * 主题 B：深色专业控制台（整体深色）
 * ============================================================================ */
:root[data-ui-theme="b"] {    /* 框架深色（侧栏主体色，顶栏“深石板”风格引用此值以保证 L 形框架同色） */
    --ui-frame-dark: #0b1016;
    /* 品牌色 - 深空靛蓝（暗底上用亮色作强调） */
    --enterprise-primary: #6366f1;
    --enterprise-primary-light: #818cf8;
    --enterprise-primary-lighter: #a5b4fc;
    --enterprise-primary-dark: #4338ca;

    /* 辅助色（暗底友好） */
    --enterprise-secondary: #7c8a9e;
    --enterprise-accent: #fbbf24;
    --enterprise-success: #34d399;
    --enterprise-warning: #fbbf24;
    --enterprise-danger: #f87171;
    --enterprise-info: #60a5fa;

    /* 中性色（深色底） */
    --enterprise-gray-50: #11161d;
    --enterprise-gray-100: #161d26;
    --enterprise-gray-200: #232d3a;
    --enterprise-gray-300: #2b3646;
    --enterprise-gray-400: #3c4a5e;
    --enterprise-gray-500: #7c8a9e;
    --enterprise-gray-600: #9fb0c3;
    --enterprise-gray-700: #cbd5e1;
    --enterprise-gray-800: #e5eaf1;
    --enterprise-gray-900: #0b1016;

    /* 文字（反色） */
    --enterprise-text-primary: #e5eaf1;
    --enterprise-text-secondary: #9fb0c3;
    --enterprise-text-muted: #7c8a9e;

    /* 边框 / 阴影 / 圆角 */
    --enterprise-border-color: #232d3a;
    --enterprise-border-color-hover: #2b3646;
    --enterprise-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --enterprise-shadow-md: 0 4px 10px rgba(0, 0, 0, 0.40);
    --enterprise-shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.45);
    --enterprise-shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.50);
    --enterprise-border-radius: 10px;

    /* 控件中性令牌深色覆盖：描边/悬停底/文本/警示色反色，供共享组件换肤 */
    --ctl-border: #2b3646;
    --ctl-border-hover: #3c4a5e;
    --ctl-bg-hover: #1f2937;
    --ctl-bg-active: #2b3646;
    --ctl-text: #cbd5e1;
    --ctl-text-hover: #e5eaf1;
    --ctl-icon: #7c8a9e;
    --ctl-danger-bg: rgba(248, 113, 113, 0.14);
    --ctl-danger-border: rgba(248, 113, 113, 0.40);
    --ctl-danger-text: #fca5a5;

    /* 语义表面/线条令牌深色覆盖（v2.96）：与 .card/.modal 等既有深色值对齐，
       page-template.css 与共享组件引用 var() 后自动反色，消除深色白框 */
    --surface-page: #11161d;
    --surface-card: #161d26;
    --surface-inset: #1a222d;
    --surface-hover: #1f2937;
    --surface-active: #2b3646;
    --line-soft: #1f2937;
    --line-default: #232d3a;
    --line-strong: #2b3646;
    --card-shadow: 0 4px 10px rgba(0, 0, 0, 0.40);

    /* DX 网格深色令牌（v2.96）：表头/边框/分页随深色反色，覆盖 DX 默认浅色 */
    --dxbl-grid-header-bg: #1a222d;
    --dxbl-grid-header-color: #9fb0c3;
    --dxbl-grid-border-color: #232d3a;
    --dxbl-pager-page-btn-color: #cbd5e1;
    --dxbl-pager-page-btn-hover-bg: #1f2937;
    --dxbl-pager-page-btn-hover-color: #e5eaf1;
    --dxbl-pager-active-page-btn-bg: #6366f1;
    --dxbl-pager-active-page-btn-color: #ffffff;
    --dxbl-pager-btn-color: #9fb0c3;
    --dxbl-pager-btn-hover-bg: #1f2937;
    --dxbl-pager-btn-hover-color: #e5eaf1;

    /* 引擎映射 */
    --bb-focus-ring-color: rgba(165, 180, 252, 0.40);
    --bs-primary-rgb: 99, 102, 241;

    /* Bootstrap 暗色底（配合 JS 设置的 data-bs-theme=dark） */
    --bs-body-bg: #11161d;
    --bs-body-color: #e5eaf1;
    --bs-secondary-color: #9fb0c3;
    --bs-card-bg: #161d26;
    --bs-card-border-color: #232d3a;
    --bs-tertiary-bg: #161d26;
    --bs-border-color: #232d3a;
    --bs-link-color: #a5b4fc;
    --bs-link-hover-color: #c7d2fe;
}

/* B：整体深色表面 */
[data-ui-theme="b"] .bb-layout .layout-main,
[data-ui-theme="b"] .layout .layout-main { background: #11161d !important; }
[data-ui-theme="b"] .bb-layout .layout-side,
[data-ui-theme="b"] .layout .layout-side,
[data-ui-theme="b"] .enterprise-sidebar {
    background: #0b1016 !important;
    border-color: #1c242f !important;
    box-shadow: none !important;
}
[data-ui-theme="b"] .bb-layout .layout-banner { background: #0b1016 !important; }
/* B：Logo 区与侧栏主体同色 */
[data-ui-theme="b"] .enterprise-sidebar-header { background: #0b1016 !important; border-color: #1c242f !important; }
[data-ui-theme="b"] .enterprise-sidebar-title { color: #e5eaf1 !important; }
[data-ui-theme="b"] .enterprise-sidebar-header small,
[data-ui-theme="b"] .enterprise-sidebar-header .text-muted { color: #7c8a9e !important; }
/* B：菜单项实际类名为 .nav-link（BootstrapBlazor），.menu-item 一并保留兜底 */
[data-ui-theme="b"] .layout-side .menu,
[data-ui-theme="b"] .layout-side .bb-menu {
    --bb-menu-item-hover-bg: #141b24;
    --bb-menu-item-hover-color: #e5eaf1;
    --bb-menu-active-color: #ffffff;
    --bb-menu-active-bg: rgba(99, 102, 241, 0.28);
}
[data-ui-theme="b"] .layout-side .nav-link { color: #9fb0c3 !important; }
[data-ui-theme="b"] .layout-side .nav-link i,
[data-ui-theme="b"] .layout-side .nav-link .fa { color: inherit !important; }
[data-ui-theme="b"] .layout-side .nav-link:hover { background: #141b24 !important; color: #e5eaf1 !important; }
[data-ui-theme="b"] .layout-side .nav-link.active {
    background: rgba(99, 102, 241, 0.28) !important;
    color: #ffffff !important;
    box-shadow: inset 3px 0 0 #818cf8;
}
[data-ui-theme="b"] .menu-item { color: #9fb0c3 !important; }
[data-ui-theme="b"] .menu-item:hover { background: #141b24 !important; color: #e5eaf1 !important; }
[data-ui-theme="b"] .menu-item.active { background: rgba(99, 102, 241, 0.22) !important; color: #ffffff !important; }
[data-ui-theme="b"] .menu-item.active::before { background: #818cf8 !important; }
[data-ui-theme="b"] .menu,
[data-ui-theme="b"] .enterprise-sidebar .menu { scrollbar-color: #2b3646 #0b1016; }
[data-ui-theme="b"] .menu::-webkit-scrollbar-thumb,
[data-ui-theme="b"] .enterprise-sidebar .menu::-webkit-scrollbar-thumb { background: #2b3646; }
/* B：卡片 / 表格 / 弹窗 / 输入 暗色化 */
[data-ui-theme="b"] .card,
[data-ui-theme="b"] .enterprise-card { background: #161d26 !important; border-color: #232d3a !important; color: #e5eaf1 !important; }
[data-ui-theme="b"] .card-header,
[data-ui-theme="b"] .enterprise-card-header { background: #131a22 !important; border-color: #232d3a !important; color: #cbd5e1 !important; }
[data-ui-theme="b"] .modal-content,
[data-ui-theme="b"] .bb-modal .modal-content { background: #161d26 !important; border-color: #2b3646 !important; color: #e5eaf1 !important; }
[data-ui-theme="b"] .modal-header,
[data-ui-theme="b"] .modal-footer { border-color: #232d3a !important; }
[data-ui-theme="b"] .form-control,
[data-ui-theme="b"] .input-group-text,
[data-ui-theme="b"] .form-select { background: #1a222d !important; border-color: #2b3646 !important; color: #e5eaf1 !important; }
[data-ui-theme="b"] .form-control::placeholder { color: #64748b !important; }
[data-ui-theme="b"] .text-muted { color: #7c8a9e !important; }
[data-ui-theme="b"] .dropdown-menu { background: #161d26 !important; border-color: #2b3646 !important; color: #e5eaf1 !important; }
[data-ui-theme="b"] .dropdown-item { color: #cbd5e1 !important; }
[data-ui-theme="b"] .dropdown-item:hover,
[data-ui-theme="b"] .dropdown-item:focus { background: #1f2937 !important; color: #fff !important; }
/* B：DevExpress 表格暗色化。
 * DX BootstrapExternal 主题不读取 CSS 变量，颜色直接写在类规则中，
 * 因此这里按实际类名做强制覆盖（surface 已由令牌联动，此处补齐文字/交互色）。 */
/* 2026-11-08 v2.96：去掉 .layout-main 作用域——DxPopup/DxDrawer 传送门
   渲染在 .layout-main 之外，弹窗内的表格同样需要暗色化 */
[data-ui-theme="b"] .dxbl-grid { background: #161d26; }
[data-ui-theme="b"] .dxbl-grid,
[data-ui-theme="b"] .dxbl-grid *,
[data-ui-theme="b"] .dxbl-grid *:before,
[data-ui-theme="b"] .dxbl-grid *:after { color: #d7dfeb !important; }
[data-ui-theme="b"] .dxbl-grid .dxbl-grid-header,
[data-ui-theme="b"] .dxbl-grid .dxbl-grid-header-row { color: #9fb0c3 !important; }
[data-ui-theme="b"] .dxbl-grid .dxbl-btn-primary,
[data-ui-theme="b"] .dxbl-grid .dxbl-btn-primary *,
[data-ui-theme="b"] .layout-main .dxbl-btn-primary { color: #ffffff !important; }
[data-ui-theme="b"] .dxbl-grid tbody tr:hover { background: #1f2937 !important; }
[data-ui-theme="b"] .dxbl-grid .dxbl-grid-empty-cell,
[data-ui-theme="b"] .dxbl-grid .dxbl-grid-table { background: #11161d; }
/* 单元格分隔线 / 选中行（v2.96，与 enterprise-theme.css 全局美化的深色对应） */
[data-ui-theme="b"] .dxbl-cell { border-color: #232d3a !important; }
[data-ui-theme="b"] .dxbl-grid .dxbl-grid-selected-row > td { background: rgba(99, 102, 241, 0.16) !important; }
/* 抽屉面板暗色化（v2.96：详情/快查抽屉深色主题下不再白底） */
[data-ui-theme="b"] .dxbl-drawer-panel { background: #161d26 !important; border-color: #232d3a !important; }
[data-ui-theme="b"] .dxbl-drawer .dxbl-drawer-header { background: #131a22 !important; border-color: #232d3a !important; color: #e5eaf1 !important; }

/* B：主内容区强制暗色文本与容器（覆盖各页面 scoped 样式中的固定浅色） */
[data-ui-theme="b"] .layout-main { color: #e5eaf1 !important; }
[data-ui-theme="b"] .layout-main .card { background: #161d26 !important; border-color: #232d3a !important; }
[data-ui-theme="b"] .layout-main .card-body { background: transparent !important; }
[data-ui-theme="b"] .layout-main .header-title,
[data-ui-theme="b"] .layout-main h1,
[data-ui-theme="b"] .layout-main h2,
[data-ui-theme="b"] .layout-main h3,
[data-ui-theme="b"] .layout-main h4,
[data-ui-theme="b"] .layout-main h5,
[data-ui-theme="b"] .layout-main h6 { color: #e5eaf1 !important; }
[data-ui-theme="b"] .layout-main .dxbl-text-edit,
[data-ui-theme="b"] .layout-main .dxbl-text-edit-input {
    background: #1a222d !important;
    background-color: #1a222d !important;
    color: #e5eaf1 !important;
    border-color: #2b3646 !important;
}
[data-ui-theme="b"] .layout-main .dxbl-text-edit-input::placeholder { color: #64748b !important; }
[data-ui-theme="b"] .layout-main .dxbl-btn-outline-secondary {
    color: #cbd5e1 !important;
    border-color: #2b3646 !important;
    background: transparent !important;
}
[data-ui-theme="b"] .layout-main .dxbl-btn-outline-secondary:hover {
    color: #ffffff !important;
    border-color: #3c4a5e !important;
    background: #1a222d !important;
}

/* B：各页面 scoped CSS 写死浅色表面色的兜底覆盖（scoped 样式带 data-b-* 属性选择器，
 * 特异性为 (0,3,0)，故此处选择器均 >= (0,3,0) 并加 !important 才能保证压过 scoped 规则）。
 * 色板与 B 块标准一致：卡片底 #161d26 / 头底 #131a22 / 输入底 #1a222d / 分割线 #2b3646 / 文字 #e5eaf1。 */
[data-ui-theme="b"] .layout-main .ports-search-toolbar,
[data-ui-theme="b"] .layout-main .airports-search-toolbar,
[data-ui-theme="b"] .layout-main .airline-search-toolbar,
[data-ui-theme="b"] .layout-main .hscode-search-container {
    background: #161d26 !important;
    border-color: #2b3646 !important;
}
[data-ui-theme="b"] .layout-main .main-card .card-header {
    background: #131a22 !important;
    border-color: #232d3a !important;
}
[data-ui-theme="b"] .layout-main .ports-search-box {
    background: #1a222d !important;
    border-color: #2b3646 !important;
    box-shadow: none !important;
}
[data-ui-theme="b"] .layout-main .filter-panel-compact {
    background: #131a22 !important;
    border-color: #2b3646 !important;
}
[data-ui-theme="b"] .layout-main .data-table th {
    background: #131a22 !important;
    border-color: #2b3646 !important;
    color: #9fb0c3 !important;
}
[data-ui-theme="b"] .layout-main .table-container {
    background: #161d26 !important;
}
/* B：港口信息页（unifiedports）残留覆盖。
 * 来源：UnifiedPortsInfoMgrPage.razor.css 中 .edit-header 写死 #f8f9fa→#e9ecef
 * 浅色渐变并带 !important（特异性 (0,2,0)），此处用 (0,3,0)+!important 压过；
 * 该类在 HS编码/船舶等页弹窗中复用，统一覆盖。DX 弹窗挂 body 层级，需同时覆盖 .dxbl-popup/.modal。 */
[data-ui-theme="b"] .dxbl-popup .edit-header,
[data-ui-theme="b"] .modal .edit-header,
[data-ui-theme="b"] .layout-main .edit-header {
    background: #131a22 !important;
    background-color: #131a22 !important;
    background-image: none !important;
    border-color: #2b3646 !important;
    box-shadow: none !important;
    color: #e5eaf1 !important;
}
/* B：DX 二级按钮（.dxbl-btn-secondary，如“高级筛选”/弹窗“取消”）写死浅灰 #dee2e6，
 * 主题 B 下统一改为输入底色 #1a222d（全局生效，各页通用） */
[data-ui-theme="b"] .layout-main .dxbl-btn-secondary,
[data-ui-theme="b"] .dxbl-popup .dxbl-btn-secondary,
[data-ui-theme="b"] .modal .dxbl-btn-secondary {
    background: #1a222d !important;
    background-color: #1a222d !important;
    border-color: #2b3646 !important;
    color: #9fb0c3 !important;
}
[data-ui-theme="b"] .layout-main .dxbl-btn-secondary:hover,
[data-ui-theme="b"] .dxbl-popup .dxbl-btn-secondary:hover,
[data-ui-theme="b"] .modal .dxbl-btn-secondary:hover {
    background: #1f2937 !important;
    background-color: #1f2937 !important;
    border-color: #3c4a5e !important;
    color: #e5eaf1 !important;
}
/* B：Bootstrap alert 提示块（PortsEditComponent/GoodsEditForm/HSCode 等页弹窗内写死浅色
 * alert 背景，如 #cff4fc）。主题 B 下按语义色改为暗色半透明底 + 亮色文字（全局生效）。 */
[data-ui-theme="b"] .layout-main .alert,
[data-ui-theme="b"] .dxbl-popup .alert,
[data-ui-theme="b"] .modal .alert {
    background-color: #1a222d !important;
    border-color: #2b3646 !important;
    color: #cbd5e1 !important;
}
[data-ui-theme="b"] .layout-main .alert-info,
[data-ui-theme="b"] .dxbl-popup .alert-info,
[data-ui-theme="b"] .modal .alert-info { background-color: rgba(6, 182, 212, 0.16) !important; border-color: rgba(103, 232, 249, 0.35) !important; color: #a5f3fc !important; }
[data-ui-theme="b"] .layout-main .alert-success,
[data-ui-theme="b"] .dxbl-popup .alert-success,
[data-ui-theme="b"] .modal .alert-success { background-color: rgba(16, 185, 129, 0.16) !important; border-color: rgba(52, 211, 153, 0.35) !important; color: #a7f3d0 !important; }
[data-ui-theme="b"] .layout-main .alert-warning,
[data-ui-theme="b"] .dxbl-popup .alert-warning,
[data-ui-theme="b"] .modal .alert-warning { background-color: rgba(245, 158, 11, 0.16) !important; border-color: rgba(251, 191, 36, 0.35) !important; color: #fde68a !important; }
[data-ui-theme="b"] .layout-main .alert-danger,
[data-ui-theme="b"] .dxbl-popup .alert-danger,
[data-ui-theme="b"] .modal .alert-danger { background-color: rgba(239, 68, 68, 0.16) !important; border-color: rgba(248, 113, 113, 0.35) !important; color: #fecaca !important; }
[data-ui-theme="b"] .layout-main .alert-secondary,
[data-ui-theme="b"] .dxbl-popup .alert-secondary,
[data-ui-theme="b"] .modal .alert-secondary { background-color: #1a222d !important; border-color: #2b3646 !important; color: #cbd5e1 !important; }
/* B：船舶信息页弹窗（vesselsinfo）残留覆盖。
 * 来源：VesselsEditDialog.razor.css —— .form-group-card 写死 #fff 白卡片，
 * .form-tips 写死 #fff3cd 浅黄提示条。DX 弹窗挂 body 层级，用 (0,3,0)+!important 压过 scoped。 */
[data-ui-theme="b"] .dxbl-popup .form-group-card,
[data-ui-theme="b"] .modal .form-group-card {
    background: #1a222d !important;
    background-color: #1a222d !important;
    border-color: #2b3646 !important;
}
[data-ui-theme="b"] .dxbl-popup .form-tips,
[data-ui-theme="b"] .modal .form-tips {
    background: rgba(245, 158, 11, 0.16) !important;
    background-color: rgba(245, 158, 11, 0.16) !important;
    border-color: rgba(251, 191, 36, 0.35) !important;
    color: #fde68a !important;
}


/* ============================================================================
 * 主题 C：深蓝品牌（= 当前样式 / 基础令牌，无需覆盖块）
 * 说明：不设置 data-ui-theme 或设为 "c" 时，回退到 enterprise-theme.css 的
 *       基础令牌，视觉上与改造前完全一致，作为「保持原样」的基线。
 * 2026-11-07 完整性补齐：仅补框架深色令牌（顶栏选「深石板」风格时引用，
 *       与深蓝品牌同族，使 L 形框架同色）；不影响 C 的默认外观。
 * ============================================================================ */
:root[data-ui-theme="c"] {
    --ui-frame-dark: #1a365d;
}


/* ============================================================================
 * 主题 D：活力青蓝科技（浅色内容 + 白色侧边栏 + 青蓝）
 * ============================================================================ */
:root[data-ui-theme="d"] {    /* 框架深色（顶栏“深石板”风格引用，与青蓝品牌同族深蓝） */
    --ui-frame-dark: #0f2536;
    /* 品牌色 - 青蓝 Sky */
    --enterprise-primary: #0284c7;
    --enterprise-primary-light: #0369a1;
    --enterprise-primary-lighter: #0ea5e9;
    --enterprise-primary-dark: #075985;

    /* 辅助色 */
    --enterprise-secondary: #6b8299;
    --enterprise-accent: #f59e0b;
    --enterprise-success: #059669;
    --enterprise-warning: #d97706;
    --enterprise-danger: #dc2626;
    --enterprise-info: #06b6d4;

    /* 中性色（冷调浅底） */
    --enterprise-gray-50: #f2f7fb;
    --enterprise-gray-100: #eaf3fa;
    --enterprise-gray-200: #dbe9f3;
    --enterprise-gray-300: #c5d9e8;
    --enterprise-gray-400: #a3c0d6;
    --enterprise-gray-500: #6b8299;
    --enterprise-gray-600: #4e6a86;
    --enterprise-gray-700: #28455e;
    --enterprise-gray-800: #16324a;
    --enterprise-gray-900: #0f2536;

    /* 文字 */
    --enterprise-text-primary: #123047;
    --enterprise-text-secondary: #56708a;
    --enterprise-text-muted: #8aa0b4;

    /* 边框 / 阴影 / 圆角 */
    --enterprise-border-color: #dbe9f3;
    --enterprise-border-color-hover: #c5d9e8;
    --enterprise-shadow-sm: 0 1px 2px rgba(14, 116, 144, 0.08);
    --enterprise-shadow-md: 0 4px 10px rgba(14, 116, 144, 0.10);
    --enterprise-shadow-lg: 0 12px 24px rgba(14, 116, 144, 0.12);
    --enterprise-shadow-xl: 0 24px 48px rgba(14, 116, 144, 0.16);
    --enterprise-border-radius: 10px;

    /* 引擎映射 */
    --bb-focus-ring-color: rgba(14, 165, 233, 0.35);
    --bs-primary-rgb: 2, 132, 199;
}

/* D：白色侧边栏 + 青蓝强调（基于浅色令牌，仅需微调菜单激活竖条可读性） */
[data-ui-theme="d"] .bb-layout .layout-side,
[data-ui-theme="d"] .layout .layout-side,
[data-ui-theme="d"] .enterprise-sidebar {
    background: #ffffff !important;
    border-color: #e6eef6 !important;
}
/* D：Logo 区与侧栏主体同色（白） */
[data-ui-theme="d"] .enterprise-sidebar-header { background: #ffffff !important; border-color: #e6eef6 !important; }
/* D：菜单项实际类名为 .nav-link（BootstrapBlazor） */
[data-ui-theme="d"] .layout-side .menu,
[data-ui-theme="d"] .layout-side .bb-menu {
    --bb-menu-item-hover-bg: #f2f8fd;
    --bb-menu-item-hover-color: #0369a1;
    --bb-menu-active-color: #0369a1;
    --bb-menu-active-bg: #e0f2fe;
}
[data-ui-theme="d"] .layout-side .nav-link { color: #41586e !important; }
[data-ui-theme="d"] .layout-side .nav-link:hover { background: #f2f8fd !important; color: #0369a1 !important; }
[data-ui-theme="d"] .layout-side .nav-link.active { background: linear-gradient(90deg, #e0f2fe, #eef2ff) !important; color: #0369a1 !important; font-weight: 600; }
[data-ui-theme="d"] .menu-item.active { background: linear-gradient(90deg, #e0f2fe, #eef2ff) !important; color: #0369a1 !important; }
[data-ui-theme="d"] .menu-item.active::before { background: #0ea5e9 !important; }
[data-ui-theme="d"] .bb-layout .layout-banner { background: #ffffff; }
/* D：内容区画布（冷调浅底，与白卡片形成层次；2026-11-07 主题完整性补齐） */
[data-ui-theme="d"] .bb-layout .layout-main,
[data-ui-theme="d"] .layout .layout-main { background: #f2f7fb !important; }


/* ============================================================================
 * 主题 T1：现代朱砂（t1.0 设计语言，默认主题）
 * 与 EMS.Server/wwwroot/css/design-tpl.css（.dtpl 作用域）同源令牌：
 *   主色朱砂 #C2403A / 中性 slate 冷灰 / 圆角 10 / 阴影 sh-1~4
 * 侧栏为深红「L 形框架」，顶栏默认白色（--ui-frame-dark 供顶栏"深石板"风格引用）
 * ============================================================================ */
:root[data-ui-theme="t1"] {
    /* 品牌色 - 朱砂（t1.0 设计语言） */
    --enterprise-primary: #C2403A;
    --enterprise-primary-light: #A93631;
    --enterprise-primary-lighter: #D95650;
    --enterprise-primary-dark: #8F2D2A;

    /* 辅助色（t1.0 状态色：mint/amber/coral/blue 语义映射） */
    --enterprise-secondary: #667085;
    --enterprise-accent: #E2A33C;
    --enterprise-success: #2E7D54;
    --enterprise-warning: #A86A12;
    --enterprise-danger: #B93B31;
    --enterprise-info: #33639F;

    /* 中性色（slate 冷灰，= t1.0 ink/line/bg 令牌） */
    --enterprise-gray-50: #F4F5F8;
    --enterprise-gray-100: #EFF1F5;
    --enterprise-gray-200: #E4E7EC;
    --enterprise-gray-300: #D4D8E0;
    --enterprise-gray-400: #B7BECC;
    --enterprise-gray-500: #8A93A3;
    --enterprise-gray-600: #667085;
    --enterprise-gray-700: #39414F;
    --enterprise-gray-800: #2A3140;
    --enterprise-gray-900: #1E2430;

    /* 文字 */
    --enterprise-text-primary: #1E2430;
    --enterprise-text-secondary: #667085;
    --enterprise-text-muted: #8A93A3;

    /* 边框 / 阴影 / 圆角（t1.0 sh-1~4） */
    --enterprise-border-color: #E4E7EC;
    --enterprise-border-color-hover: #D4D8E0;
    --enterprise-shadow-sm: 0 1px 2px rgba(20, 24, 32, 0.05);
    --enterprise-shadow-md: 0 2px 8px rgba(20, 24, 32, 0.07);
    --enterprise-shadow-lg: 0 8px 24px rgba(20, 24, 32, 0.12);
    --enterprise-shadow-xl: 0 18px 48px rgba(20, 24, 32, 0.20);
    --enterprise-border-radius: 10px;

    /* 引擎映射（BootstrapBlazor 焦点环 / Bootstrap 主色 rgb） */
    --bb-focus-ring-color: rgba(194, 64, 58, 0.30);
    --bs-primary-rgb: 194, 64, 58;

    /* 框架深色（侧栏主体色，顶栏“深石板”风格引用此值以保证 L 形框架同色） */
    --ui-frame-dark: #3A201D;

    /* 菜单（深红侧栏上的浅玫瑰灰文字） */
    --bb-menu-item-hover-bg: #4A2A26;
    --bb-menu-item-hover-color: #ffffff;
    --bb-menu-active-color: #ffffff;
    --bb-menu-active-bg: #C2403A;
}

/* T1：深红侧栏（渐变深一点的下缘，与顶栏"深石板"风格构成同色 L 形框架） */
[data-ui-theme="t1"] .bb-layout .layout-side,
[data-ui-theme="t1"] .layout .layout-side,
[data-ui-theme="t1"] .enterprise-sidebar {
    background: linear-gradient(180deg, #3A201D 0%, #2C1715 100%) !important;
    border-color: #2C1715 !important;
}
[data-ui-theme="t1"] .enterprise-sidebar-header { background: #2C1715 !important; border-color: #462823 !important; }
[data-ui-theme="t1"] .enterprise-sidebar-title { color: #ffffff !important; }
[data-ui-theme="t1"] .enterprise-sidebar-header small,
[data-ui-theme="t1"] .enterprise-sidebar-header .text-muted { color: #B08A84 !important; }
[data-ui-theme="t1"] .layout-side .menu,
[data-ui-theme="t1"] .layout-side .bb-menu,
[data-ui-theme="t1"] .enterprise-sidebar .menu {
    --bb-menu-item-hover-bg: #4A2A26;
    --bb-menu-item-hover-color: #ffffff;
    --bb-menu-active-color: #ffffff;
    --bb-menu-active-bg: #C2403A;
    background: transparent;
}
[data-ui-theme="t1"] .layout-side .nav-link { color: #CDB4B0 !important; }
[data-ui-theme="t1"] .layout-side .nav-link i,
[data-ui-theme="t1"] .layout-side .nav-link .fa { color: inherit !important; }
[data-ui-theme="t1"] .layout-side .nav-link:hover { background: #4A2A26 !important; color: #ffffff !important; }
[data-ui-theme="t1"] .layout-side .nav-link.active { background: #C2403A !important; color: #ffffff !important; }
[data-ui-theme="t1"] .layout-side .submenu .nav-link { padding-left: 2.1rem; font-size: 0.8125rem; }
[data-ui-theme="t1"] .menu-item { color: #CDB4B0 !important; }
[data-ui-theme="t1"] .menu-item:hover { background: #4A2A26 !important; color: #ffffff !important; }
[data-ui-theme="t1"] .menu-item.active { background: rgba(194, 64, 58, 0.22) !important; color: #ffffff !important; }
[data-ui-theme="t1"] .menu-item.active::before { background: #D95650 !important; }
[data-ui-theme="t1"] .menu,
[data-ui-theme="t1"] .enterprise-sidebar .menu { scrollbar-color: #4A2A26 #2C1715; }
[data-ui-theme="t1"] .menu::-webkit-scrollbar-thumb,
[data-ui-theme="t1"] .enterprise-sidebar .menu::-webkit-scrollbar-thumb { background: #4A2A26; }
[data-ui-theme="t1"] .bb-layout .layout-banner { background: #2C1715; }
/* T1：内容区画布（t1.0 --bg） */
[data-ui-theme="t1"] .bb-layout .layout-main,
[data-ui-theme="t1"] .layout .layout-main { background: #F4F5F8 !important; }


/* ============================================================================
 * 顶栏（Header）按主题还原预览稿配色
 * header-override.css 对 .layout-header 强制了主色渐变（!important），
 * 预览稿中仅主题 C 为深色渐变顶栏；A/D 为白色顶栏（主色只作强调），
 * B 为近黑深色顶栏。此处用更高特异性选择器覆盖，主题 C 不加规则保持原样。
 * ============================================================================ */
/* A：白色顶栏 + 浅灰下边框（预览稿 --topbar-bg:#ffffff / --topbar-border:#e8ebf0） */
html[data-ui-theme="a"] .layout-header,
html[data-ui-theme="a"] .layout .layout-header {
    background: #ffffff !important;
    border-bottom: 1px solid #e8ebf0 !important;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04) !important;
    color: #334155 !important;
}
/* A：顶栏内按钮/图标/文字在浅底上用深色 */
html[data-ui-theme="a"] .layout-header .bb-dropdown-toggle,
html[data-ui-theme="a"] .layout-header .nav-link,
html[data-ui-theme="a"] .layout-header .dropdown-item,
html[data-ui-theme="a"] .layout-header .bb-icon,
html[data-ui-theme="a"] .layout-header .btn,
html[data-ui-theme="a"] .layout-header a { color: #475569 !important; }
html[data-ui-theme="a"] .layout-header .dropdown-menu { color: #334155 !important; }

/* B：深色顶栏（预览稿 --topbar-bg:#0d1218 / --topbar-border:#1e2630） */
html[data-ui-theme="b"] .layout-header,
html[data-ui-theme="b"] .layout .layout-header {
    background: #0d1218 !important;
    border-bottom: 1px solid #1e2630 !important;
    box-shadow: none !important;
    color: #cbd5e1 !important;
}
html[data-ui-theme="b"] .layout-header .bb-dropdown-toggle,
html[data-ui-theme="b"] .layout-header .nav-link,
html[data-ui-theme="b"] .layout-header .dropdown-item,
html[data-ui-theme="b"] .layout-header .bb-icon,
html[data-ui-theme="b"] .layout-header .btn,
html[data-ui-theme="b"] .layout-header a { color: #cbd5e1 !important; }

/* D：白色顶栏 + 浅青灰下边框（预览稿 --topbar-bg:#ffffff / --topbar-border:#e0ecf5） */
html[data-ui-theme="d"] .layout-header,
html[data-ui-theme="d"] .layout .layout-header {
    background: #ffffff !important;
    border-bottom: 1px solid #e0ecf5 !important;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.05) !important;
    color: #28455e !important;
}
html[data-ui-theme="d"] .layout-header .bb-dropdown-toggle,
html[data-ui-theme="d"] .layout-header .nav-link,
html[data-ui-theme="d"] .layout-header .dropdown-item,
html[data-ui-theme="d"] .layout-header .bb-icon,
html[data-ui-theme="d"] .layout-header .btn,
html[data-ui-theme="d"] .layout-header a { color: #43607a !important; }
html[data-ui-theme="d"] .layout-header .dropdown-menu { color: #28455e !important; }

/* T1：白色顶栏 + 石板灰下边框（与内容区画布同族令牌） */
html[data-ui-theme="t1"] .layout-header,
html[data-ui-theme="t1"] .layout .layout-header {
    background: #ffffff !important;
    border-bottom: 1px solid #E4E7EC !important;
    box-shadow: 0 1px 3px rgba(20, 24, 32, 0.05) !important;
    color: #39414F !important;
}
html[data-ui-theme="t1"] .layout-header .bb-dropdown-toggle,
html[data-ui-theme="t1"] .layout-header .nav-link,
html[data-ui-theme="t1"] .layout-header .dropdown-item,
html[data-ui-theme="t1"] .layout-header .bb-icon,
html[data-ui-theme="t1"] .layout-header .btn,
html[data-ui-theme="t1"] .layout-header a { color: #47505F !important; }
html[data-ui-theme="t1"] .layout-header .dropdown-menu { color: #39414F !important; }


/* ============================================================================
 * 顶栏（Header）可配置风格（data-ui-header，与主题独立配置的第二个维度）
 * white=白色极简 / light=浅灰蓝 / dark=深石板 / brand=品牌主色渐变（跟随主题主色）
 * 本区块位于各主题默认顶栏规则之后，data-ui-header 存在时（首帧脚本必写）优先生效
 * ============================================================================ */
/* 白色 / 浅灰蓝：浅底深字（选择器含 .layout .layout-header 变体以压过各主题默认顶栏规则） */
html[data-ui-header="white"] .layout-header,
html[data-ui-header="white"] .layout .layout-header {
    background: #ffffff !important;
    border-bottom: 1px solid #e8ebf0 !important;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06) !important;
    color: #334155 !important;
}
html[data-ui-header="light"] .layout-header,
html[data-ui-header="light"] .layout .layout-header {
    background: linear-gradient(180deg, #f8fafc 0%, #edf2f8 100%) !important;
    border-bottom: 1px solid #dde5ee !important;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06) !important;
    color: #334155 !important;
}
html[data-ui-header="white"] .layout-header .enterprise-layout-title,
html[data-ui-header="light"] .layout-header .enterprise-layout-title { color: #1e293b !important; }
html[data-ui-header="white"] .layout-header .btn,
html[data-ui-header="white"] .layout-header a,
html[data-ui-header="light"] .layout-header .btn,
html[data-ui-header="light"] .layout-header a { color: #475569 !important; }
html[data-ui-header="white"] .layout-header i,
html[data-ui-header="light"] .layout-header i { color: #64748b !important; }
html[data-ui-header="white"] .layout-header .btn:hover i,
html[data-ui-header="white"] .layout-header a:hover i,
html[data-ui-header="light"] .layout-header .btn:hover i,
html[data-ui-header="light"] .layout-header a:hover i { color: #1e293b !important; }
html[data-ui-header="white"] .layout-header .dropdown-menu,
html[data-ui-header="light"] .layout-header .dropdown-menu { color: #334155 !important; }
/* 用户信息触发器：默认 --bb-logout-text-color 跟随 --bb-header-color（白色），
   浅色顶栏上白字不可见，覆盖为深色（仅 white/light，dark/brand 保留白字）。
   注意：必须带上 .layout .layout-header 前缀——BootstrapBlazor 包 CSS 中存在
   .layout .layout-header .dropdown-logout{--bb-logout-text-color: var(--bb-layout-header-color)}
   （特异性 0,3,0），低于该值的前缀会被其压回白色 */
html[data-ui-header="white"] .layout .layout-header .dropdown-logout,
html[data-ui-header="light"] .layout .layout-header .dropdown-logout { --bb-logout-text-color: #1e293b; }

/* 下拉用户信息横幅：背景恒为 --bb-logout-user-bg（#0078d4 蓝），文字应恒为白。
   横幅元素带 dropdown-item 类，会被上方各主题的 .layout-header .dropdown-item
   颜色规则（!important）染成深灰造成蓝底深灰低对比；此处以更高特异性压回白字（全顶栏风格通用） */
html[data-ui-theme] .layout-header .dropdown-logout .dropdown-user,
html[data-ui-theme] .layout .layout-header .dropdown-logout .dropdown-user,
html[data-ui-header] .layout-header .dropdown-logout .dropdown-user,
html[data-ui-header] .layout .layout-header .dropdown-logout .dropdown-user { color: #fff !important; }

/* 深石板：深底浅字
   背景使用 var(--ui-frame-dark)（各主题令牌中定义 = 该主题侧栏主体色），
   使顶栏与侧栏构成同一个色的 L 形框架；未定义的主题回退为 #1b2130 */
html[data-ui-header="dark"] .layout-header,
html[data-ui-header="dark"] .layout .layout-header {
    background: var(--ui-frame-dark, #1b2130) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25) !important;
    color: #e2e8f0 !important;
}
html[data-ui-header="dark"] .layout-header .enterprise-layout-title { color: #f1f5f9 !important; }
html[data-ui-header="dark"] .layout-header .btn,
html[data-ui-header="dark"] .layout-header a { color: #cbd5e1 !important; }
html[data-ui-header="dark"] .layout-header i { color: #94a3b8 !important; }
html[data-ui-header="dark"] .layout-header .btn:hover i,
html[data-ui-header="dark"] .layout-header a:hover i { color: #f1f5f9 !important; }
html[data-ui-header="dark"] .layout-header .dropdown-menu { color: #334155 !important; }

/* 品牌主色：渐变取主题令牌，白字；随当前主题主色变化 */
html[data-ui-header="brand"] .layout-header,
html[data-ui-header="brand"] .layout .layout-header {
    background: linear-gradient(135deg, var(--enterprise-primary, #4f46e5) 0%, var(--enterprise-primary-dark, #312e81) 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 2px 8px rgba(15, 37, 64, 0.2) !important;
    color: #ffffff !important;
}
html[data-ui-header="brand"] .layout-header .enterprise-layout-title { color: #ffffff !important; }
html[data-ui-header="brand"] .layout-header .btn,
html[data-ui-header="brand"] .layout-header a { color: rgba(255, 255, 255, 0.92) !important; }
html[data-ui-header="brand"] .layout-header i { color: rgba(255, 255, 255, 0.85) !important; }
html[data-ui-header="brand"] .layout-header .btn:hover i,
html[data-ui-header="brand"] .layout-header a:hover i { color: #ffffff !important; }
html[data-ui-header="brand"] .layout-header .dropdown-menu { color: #334155 !important; }


/* ============================================================================
 * 菜单层级缩进（所有主题通用，与主题色无关的结构性修正）
 * 结构：ul.submenu > li > a.nav-link 为当前层菜单项，子级 ul.submenu 嵌套在 li 内。
 * 原实现中二级菜单 padding-left(16px) 反而比顶级(33.6px)更靠左，层级不清；
 * 现按层级逐级增加缩进，每级 16px 级差；2026-10-29 整体左移收紧：
 * 顶级 24px（与侧栏 logo 左缘 24px 对齐，原 33.6px 留白过宽），
 * 二级 40 / 三级 56 / 四级 72（原 48 / 62 / 76）。
 * ============================================================================ */
.layout-side ul.submenu > li > a.nav-link { padding-left: 24px !important; }
.layout-side ul.submenu ul.submenu > li > a.nav-link { padding-left: 40px !important; }
.layout-side ul.submenu ul.submenu ul.submenu > li > a.nav-link { padding-left: 56px !important; }
.layout-side ul.submenu ul.submenu ul.submenu ul.submenu > li > a.nav-link { padding-left: 72px !important; }


/* ============================================================================
 * 主题切换器（顶栏组件样式，与任何主题兼容）
 * ============================================================================ */
.ems-theme-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    opacity: 0.92;
}
.ems-theme-switcher:hover { background: rgba(255, 255, 255, 0.16) !important; opacity: 1; }
.ems-theme-switcher:active { transform: scale(0.94); }
.ems-theme-switcher .fa { font-size: 15px; }

.ems-theme-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: #ffffff;
    color: #1f2430;
    border: 1px solid #e5e9f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    padding: 8px;
    z-index: 2100;
    max-height: 70vh;
    overflow-y: auto;
}
.ems-theme-panel-divider {
    height: 1px;
    margin: 8px 4px;
    background: #e5e9f0;
}
.ems-theme-panel-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 6px 8px 4px;
}
.ems-theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border: none;
    background: transparent;
    border-radius: 9px;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    color: #1f2430;
    transition: background 0.12s ease;
}
.ems-theme-option:hover { background: #f1f3f7; }
.ems-theme-option.selected { background: #eef2ff; }
.ems-theme-option.selected .ems-theme-name { font-weight: 700; color: #4338ca; }
.ems-theme-swatch {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}
.ems-theme-swatch::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 9px;
    background: rgba(0, 0, 0, 0.10);
}
.ems-theme-swatch.a { background: linear-gradient(135deg, #4f46e5 0%, #1b2130 100%); }
.ems-theme-swatch.b { background: linear-gradient(135deg, #6366f1 0%, #0b1016 100%); }
.ems-theme-swatch.c { background: linear-gradient(135deg, #1a365d 0%, #2d5282 100%); }
.ems-theme-swatch.d { background: linear-gradient(135deg, #0ea5e9 0%, #e0f2fe 100%); }
.ems-theme-swatch.t1 { background: linear-gradient(135deg, #C2403A 0%, #3A201D 100%); }
/* 顶栏风格色块（h- 前缀） */
.ems-theme-swatch.h-white { background: linear-gradient(135deg, #ffffff 60%, #e8ebf0 100%); }
.ems-theme-swatch.h-light { background: linear-gradient(135deg, #f8fafc 40%, #d9e4f0 100%); }
.ems-theme-swatch.h-dark { background: linear-gradient(135deg, #1e2937 40%, #0f172a 100%); }
.ems-theme-swatch.h-brand { background: linear-gradient(135deg, #4f46e5 40%, #312e81 100%); }
.ems-theme-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.ems-theme-name { font-size: 13px; font-weight: 600; }
.ems-theme-desc { font-size: 11px; color: #94a3b8; }
.ems-theme-check { margin-left: auto; color: #4f46e5; font-size: 13px; }

/* 深色主题下切换器面板保持可读（面板始终浅色，无需处理） */


/* ============================================================================
 * 全局精修（所有主题生效，与主题色无关的结构性/视觉增强，2026-11-07 新增）
 * 说明：仅改"观感"（滚动条/焦点环/圆角/阴影/过渡/表格密度），不改布局尺寸；
 *       颜色尽量取 enterprise 令牌与 Bootstrap 变量，自动跟随各主题。
 * ============================================================================ */

/* --- 滚动条：细圆角、低对比，深色模式自动加深 --- */
* { scrollbar-width: thin; scrollbar-color: rgba(100, 116, 139, 0.40) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.35);
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.55); background-clip: content-box; }
html[data-bs-theme="dark"] * { scrollbar-color: rgba(148, 163, 184, 0.30) transparent; }
html[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.28); }
html[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.45); }

/* --- 字体渲染：抗锯齿 + 易读性优化 --- */
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* --- 焦点可见性：按钮/菜单链接键盘焦点环（颜色跟随主题焦点环令牌） --- */
.btn:focus-visible,
.nav-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--bb-focus-ring-color, rgba(100, 116, 139, 0.25));
}

/* --- 按钮：统一过渡 + 按下微反馈（仅 Bootstrap 系 .btn，DX 按钮用 .dxbl-btn 不受影响） --- */
.btn {
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease,
        box-shadow 0.15s ease, transform 0.06s ease;
}
.btn:active { transform: translateY(1px); }

/* --- 链接：颜色过渡（避免 hover 跳色生硬） --- */
a { transition: color 0.12s ease; }

/* --- 卡片：边框/阴影跟随令牌，悬停轻微提影 --- */
.card {
    border-color: var(--enterprise-border-color, #e5e9f0);
    box-shadow: var(--enterprise-shadow-sm, 0 1px 2px rgba(16, 24, 40, 0.06));
    transition: box-shadow 0.18s ease;
}
.card:hover { box-shadow: var(--enterprise-shadow-md, 0 2px 8px rgba(16, 24, 40, 0.08)); }

/* --- 表格：表头更紧凑（小字号 + 字距），悬停行柔和背景 --- */
.table thead th {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.table > :not(caption) > * > * { vertical-align: middle; }
.table-hover > tbody > tr:hover { background-color: rgba(100, 116, 139, 0.06); }
html[data-bs-theme="dark"] .table-hover > tbody > tr:hover { background-color: rgba(148, 163, 184, 0.08); }

/* --- 弹窗：更大圆角 + 主题级大阴影 --- */
.modal-content {
    border-radius: 14px;
    border-color: var(--enterprise-border-color, #e5e9f0);
    box-shadow: var(--enterprise-shadow-xl, 0 24px 40px rgba(16, 24, 40, 0.14));
}

/* --- 下拉菜单：圆角 + 主题级阴影 --- */
.dropdown-menu {
    border-radius: 10px;
    border-color: var(--enterprise-border-color, #e5e9f0);
    box-shadow: var(--enterprise-shadow-lg, 0 12px 20px rgba(16, 24, 40, 0.10));
}
.dropdown-item { border-radius: 6px; }

/* --- 徽章：圆角统一 6px、字重 600（观感统一，不改尺寸） --- */
.badge { border-radius: 6px; font-weight: 600; }
