* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
:root {
    --primary-color: #1a1a1a;
    --secondary-color: #2d2d2d;
    --accent-color: #0066ff;
    --accent-hover: #0052cc;
    --brand-core: #141824;
    --brand-ai-start: #0066ff;
    --brand-ai-end: #7c3aed;
    --brand-gradient: linear-gradient(135deg, var(--brand-ai-start) 0%, var(--brand-ai-end) 100%);
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --card-bg: var(--bg-primary);
    --input-bg: var(--bg-primary);
    --text-primary: #1a1a1a;
    --text-color: var(--text-primary);
    --text-secondary: #6c757d;
    --text-muted: #6b7280;
    --border-color: #e9ecef;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --icon-close-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E");
    --icon-check-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
    --icon-x-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E");
    --close-btn-color: #1d2129;
    --close-btn-bg-hover: #f2f3f5;
    --close-btn-bg-active: #e5e6eb;
}
html {
    color-scheme: light;
}
html[data-theme="dark"] {
    color-scheme: dark;
    --primary-color: #e5e7eb;
    --secondary-color: #cbd5e1;
    --accent-color: #60a5fa;
    --accent-hover: #93c5fd;
    --brand-core: #f8fafc;
    --brand-ai-start: #60a5fa;
    --brand-ai-end: #a78bfa;
    --bg-primary: #111827;
    --bg-secondary: #0b1120;
    --bg-tertiary: #1f2937;
    --card-bg: #111827;
    --input-bg: #0b1120;
    --text-primary: #e5e7eb;
    --text-color: var(--text-primary);
    --text-secondary: #a7b0c0;
    --text-muted: #9ca3af;
    --border-color: #263244;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --error-color: #f87171;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.38);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.45);
    --close-btn-color: #e5e7eb;
    --close-btn-bg-hover: #1f2937;
    --close-btn-bg-active: #243044;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}
html[data-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 28rem),
        var(--bg-secondary);
}
.container {
    max-width: 100%;
    margin: 0;
    background: var(--bg-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    /* 主侧边栏与右侧内容之间预留水平间距，避免导航项文字贴到内容边框 */
    column-gap: 0px;
}
.main-layout > .content-area {
    margin-top: 0;
}
/* 主侧边栏样式 - 紧凑宽度，参考常见后台 200~220px */
.main-sidebar {
    /* 稍微拉宽侧边栏，给多语言菜单文案更多缓冲空间 */
    width: 224px;
    background: linear-gradient(180deg, #fafbfc 0%, #f5f7fa 100%);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
    position: relative;
    transition: width 0.2s ease;
}
html[data-theme="dark"] .main-sidebar {
    background: linear-gradient(180deg, #111827 0%, #0b1120 100%);
    box-shadow: 2px 0 14px rgba(0, 0, 0, 0.36);
}
.main-sidebar.collapsed {
    width: 64px;
}
.sidebar-collapse-btn {
    position: absolute;
    top: 16px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.sidebar-collapse-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-color);
}
.main-sidebar.collapsed .sidebar-collapse-btn {
    right: 16px;
    transform: rotate(180deg);
}
.sidebar-collapse-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    transition: transform 0.2s ease;
}
.main-sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}
.main-sidebar-header .logo span,
.main-sidebar-header .brand-wordmark {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--brand-core);
}
.main-sidebar-header .brand-wordmark__ai {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.main-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 0;
    background: transparent;
    padding-top: 56px;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.2s ease;
}
/* 侧边栏滚动条：默认隐藏，悬停时显示 */
.main-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.main-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.main-sidebar-nav::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 999px;
    transition: background 0.2s ease;
}
.main-sidebar-nav:hover {
    scrollbar-color: rgba(0, 0, 0, 0.22) transparent;
}
.main-sidebar-nav:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.22);
}
.main-sidebar-nav:hover::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .main-sidebar-nav:hover {
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}
html[data-theme="dark"] .main-sidebar-nav:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
}
html[data-theme="dark"] .main-sidebar-nav:hover::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.42);
}
.nav-section-label {
    padding: 16px 19px 6px;
    color: var(--text-secondary);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0.72;
    user-select: none;
}
.nav-section-label:first-child {
    padding-top: 2px;
}
.main-sidebar.collapsed .nav-section-label {
    height: 1px;
    margin: 8px 12px;
    padding: 0;
    overflow: hidden;
    background: var(--border-color);
    opacity: 0.7;
}
.main-sidebar.collapsed .nav-section-label span {
    display: none;
}
.nav-item {
    margin-bottom: 0;
}
.nav-item-content {
    display: flex;
    align-items: center;
    gap: 10px;
    /* 侧边栏导航项：左 16px 对齐图标，右 32px 预留更大安全间距，避免长文案贴边 */
    padding: 10px 32px 10px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    position: relative;
    font-size: 0.9375rem;
    border-left: 3px solid transparent;
    justify-content: flex-start;
}
.main-sidebar.collapsed .nav-item-content {
    padding: 12px 12px 12px 9px;
    justify-content: center;
    position: relative;
    gap: 0;
}
.main-sidebar.collapsed .nav-item-content:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 12px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    border-radius: 4px;
    font-size: 0.8125rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.main-sidebar.collapsed .nav-item-content:hover::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 6px;
    border: 6px solid transparent;
    border-right-color: rgba(0, 0, 0, 0.85);
    z-index: 1001;
    pointer-events: none;
}
.nav-item-content:hover {
    background: rgba(0, 102, 255, 0.06);
    color: var(--text-primary);
}
.nav-item.active > .nav-item-content {
    background: linear-gradient(90deg, rgba(0, 102, 255, 0.12) 0%, rgba(0, 102, 255, 0.06) 100%);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    font-weight: 500;
}
.nav-item.active > .nav-item-content svg {
    stroke: var(--accent-color);
}
.nav-item-content svg {
    flex-shrink: 0;
    stroke: currentColor;
    width: 18px;
    height: 18px;
}
.nav-item-content span {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 400;
    white-space: nowrap;
    /* 防止长标题顶到边界：在右侧内边距内做省略而不是越界 */
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
    transition: opacity 0.2s ease;
}
.main-sidebar.collapsed .nav-item-content span {
    display: none;
}
.nav-item-has-submenu .nav-item-content {
    justify-content: space-between;
}
.main-sidebar.collapsed .nav-item-has-submenu .nav-item-content {
    justify-content: center;
}
.main-sidebar.collapsed .submenu-arrow {
    display: none;
}
.submenu-arrow {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    stroke: var(--text-secondary);
}
.nav-item.expanded .submenu-arrow {
    transform: rotate(90deg);
}
.nav-item.expanded > .nav-item-content {
    color: var(--text-primary);
    font-weight: 500;
}
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(255, 255, 255, 0.5);
}
.nav-item.expanded .nav-submenu {
    max-height: 300px;
}
.nav-submenu-item {
    padding: 10px 20px 10px 56px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 0.875rem;
    position: relative;
    border-left: 3px solid transparent;
}
.main-sidebar.collapsed .nav-submenu {
    display: none;
}
.main-sidebar.collapsed .nav-item.expanded .nav-submenu {
    display: none;
}
/* 子菜单弹出框样式 */
.submenu-popup {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    min-width: 160px;
    margin-left: 8px;
    animation: popupFadeIn 0.2s ease;
}
@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
.submenu-popup-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-size: 0.875rem;
    white-space: nowrap;
}
.submenu-popup-item:hover {
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-color);
}
.submenu-popup-item:active {
    background: rgba(0, 102, 255, 0.12);
}
.submenu-popup-item.active {
    background: rgba(0, 102, 255, 0.1);
    color: var(--accent-color);
    font-weight: 500;
}
.nav-submenu-item:hover {
    background: rgba(0, 102, 255, 0.06);
    color: var(--text-primary);
}
.nav-submenu-item.active {
    background: linear-gradient(90deg, rgba(0, 102, 255, 0.12) 0%, rgba(0, 102, 255, 0.06) 100%);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    font-weight: 500;
}
/* 内容区域 */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: #f5f7fa;
}
/* 模板默认 active 页是仪表盘。带其他 hash 直接刷新时，在路由脚本同步选中
   目标页之前隐藏内容区，避免先闪出仪表盘再跳转。 */
html.initial-route-pending .content-area {
    visibility: hidden;
}
/* 对话页面不需要page-header */
#page-chat .page-header {
    display: none;
}
#page-chat .page-content {
    padding: 0;
    overflow: hidden;
}
.page {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.page.active {
    display: flex;
}
.page-header {
    padding: 12px 20px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.page-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}
.page-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
@media (max-width: 760px) {
    .vulnerability-alert-header {
        align-items: flex-start;
    }

    .vulnerability-alert-controls {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
    }

    .vulnerability-alert-binding-row {
        width: 100%;
        padding-top: 12px;
        padding-left: 0;
        border-top: 1px solid var(--border-color);
        border-left: 0;
    }
}
@media (max-width: 520px) {
    .vulnerability-alert-settings {
        margin-top: 20px;
    }

    .vulnerability-alert-header {
        padding: 15px 16px;
    }

    .vulnerability-alert-switch-label {
        display: none;
    }
}
.page-header-actions .btn-danger,
.page-header-actions .btn-secondary,
.page-header-actions .btn-primary {
    padding: 7px 16px;
    font-size: 0.875rem;
    line-height: 1.25;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.page-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px;
    min-height: 0;
}
/* 任务管理页面内容区域底部圆角 */
#page-tasks .page-content {
    /* 确保底部左右角都是圆角 */
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    /* 勿用 overflow:hidden：会覆盖 .page-content 的 overflow-y:auto，任务多时无法滚动 */
    overflow-x: hidden;
    overflow-y: auto;
}
/* 对话页左侧列表折叠（腾出空间给主对话区） */
.conversation-sidebar.collapsed {
    width: 56px;
}
/* 折叠后箭头朝右表示「展开」 */
.conversation-sidebar.collapsed .conversation-sidebar-collapse-btn {
    transform: rotate(180deg);
}
.conversation-sidebar.collapsed .sidebar-content {
    display: none;
}
.conversation-sidebar.collapsed .hitl-sidebar-card {
    display: none;
}
.conversation-sidebar.collapsed .conversation-reasoning-card {
    display: none;
}
.conversation-sidebar.collapsed .conversation-sidebar-header {
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    gap: 10px;
    border-bottom: none;
}
.conversation-sidebar.collapsed .conversation-sidebar-collapse-btn {
    order: 2;
}
.conversation-sidebar.collapsed .new-chat-btn {
    order: 1; /* 窄条：先「+」再折叠，纵向排列 */
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    margin: 0;
    border-radius: 8px;
    gap: 0;
    flex: none;
}
/* 折叠时只保留「+」，隐藏「新对话」文案 */
.conversation-sidebar.collapsed .new-chat-btn span:last-child {
    display: none;
}
.conversation-sidebar.collapsed .new-chat-btn span:first-child {
    font-size: 1.5em;
    margin: 0;
}
header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: var(--text-primary);
    padding: 10px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
html[data-theme="dark"] header {
    background: linear-gradient(135deg, #111827 0%, #0b1120 100%);
    box-shadow: none;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo svg {
    color: var(--accent-color);
}
/* 品牌字标：CyberStrike + AI 渐变 */
.brand-wordmark {
    display: inline-flex;
    align-items: baseline;
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    white-space: nowrap;
}
.brand-wordmark--lg {
    font-size: 1.5rem;
}
.brand-wordmark--sm {
    font-size: 1.25rem;
}
.brand-wordmark__core {
    color: var(--brand-core);
}
.brand-wordmark__ai {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}
.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 102, 255, 0.18);
    flex-shrink: 0;
    object-fit: cover;
}
.logo h1,
.logo .brand-wordmark {
    font-size: 1.375rem;
}
.header-logo-link {
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.header-logo-link:hover {
    opacity: 1;
    transform: translateY(-1px);
}
.header-logo-link:hover .brand-logo {
    box-shadow: 0 4px 14px rgba(0, 102, 255, 0.28);
}
.version-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    padding: 3px 9px;
    font-size: 0.625rem;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    color: var(--brand-ai-start);
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
    border: 1px solid rgba(0, 102, 255, 0.22);
    border-radius: 999px;
    letter-spacing: 0.04em;
    vertical-align: middle;
    user-select: none;
    line-height: 1.4;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.lang-switcher {
    position: relative;
}
.lang-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 400;
    transition: all 0.2s ease;
}
.lang-switcher-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.lang-switcher-icon {
    font-size: 0.9rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.lang-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 120px;
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
    border: 1px solid var(--border-color);
    padding: 4px 0;
    z-index: 100;
}
.lang-option {
    padding: 6px 12px;
    font-size: 0.8125rem;
    cursor: pointer;
    white-space: nowrap;
}
.lang-option:hover {
    background: var(--bg-tertiary);
    color: var(--accent-color);
}
.header-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.header-actions button svg {
    stroke: currentColor;
}
.header-actions button:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-1px);
}
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 104px;
    line-height: 1;
}
.theme-toggle-icon {
    display: none;
    flex: 0 0 auto;
}
html[data-theme-preference="system"] .theme-toggle-icon--system,
html[data-theme-preference="light"] .theme-toggle-icon--light,
html[data-theme-preference="dark"] .theme-toggle-icon--dark {
    display: block;
}
html[data-theme="dark"] .header-actions button,
html[data-theme="dark"] .lang-switcher-btn {
    background: #111827;
    border-color: #2b374b;
}
html[data-theme="dark"] .header-actions button:hover,
html[data-theme="dark"] .lang-switcher-btn:hover {
    background: #1f2937;
    border-color: var(--accent-color);
}
/* 用户菜单样式 */
.user-menu-container {
    position: relative;
}
.notification-btn.active {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.user-avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}
.user-avatar-btn:hover,
.user-avatar-btn.active {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.user-avatar-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
}
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(320px, calc(100vw - 24px));
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    z-index: 1000;
    overflow: hidden;
}
.user-menu-profile {
    padding: 14px;
}
.user-menu-profile-row {
    display: block;
}
.user-menu-profile-main {
    min-width: 0;
}
.user-menu-profile-label {
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.2;
}
.user-menu-profile-name {
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu-profile-username {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu-profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}
.user-menu-profile-pill {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}
.user-menu-divider {
    height: 1px;
    background: var(--border-color);
}
.user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.user-menu-item:hover {
    background: var(--bg-tertiary);
    color: var(--accent-color);
}
.user-menu-item svg {
    stroke: currentColor;
    flex-shrink: 0;
}
html[data-theme="dark"] .user-menu-dropdown {
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}
.hitl-inline-actions .btn-primary,
.hitl-inline-actions .btn-secondary {
    min-width: 64px;
}
.hitl-reviewer-toggle-btn.is-active {
    background: #fff;
    color: var(--accent-color, #0066ff);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}
.hitl-filter-select-ui.open .hitl-filter-select-trigger {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.hitl-filter-select-ui.open {
    z-index: 120;
}
.hitl-filter-select-ui.open .hitl-filter-select-caret {
    transform: rotate(180deg);
}
.hitl-filter-select-ui.open .hitl-filter-select-dropdown {
    display: block;
}
.hitl-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}
.hitl-filter-select-option.is-selected .hitl-filter-select-check {
    visibility: visible;
}
.hitl-filter-select-ui.is-disabled .hitl-filter-select-trigger {
    opacity: 0.6;
    cursor: not-allowed;
}
.hitl-logs-pagination .monitor-pagination,
.hitl-pending-pagination .monitor-pagination {
    margin-top: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.btn-link {
    appearance: none;
    border: none;
    background: none;
    color: var(--accent-color, #0066ff);
    cursor: pointer;
    font-size: 13px;
    padding: 0 6px 0 0;
}
.conversation-project-filter-ui.open .conversation-project-filter-trigger {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}
.conversation-project-filter-ui.open {
    z-index: 120;
}
.conversation-project-filter-ui.open .conversation-project-filter-caret {
    transform: rotate(180deg);
}
.conversation-project-filter-ui.open .conversation-project-filter-dropdown {
    display: flex;
}
.conversation-project-filter-option.is-selected {
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-color);
    font-weight: 500;
}
.conversation-project-filter-option.is-selected .conversation-project-filter-check {
    opacity: 1;
}
.conversation-item.active {
    background: var(--bg-primary);
    border-color: var(--accent-color);
}
.conversation-item.active .conversation-delete-btn {
    opacity: 0.6;
}
.conversation-item.active:hover .conversation-delete-btn {
    opacity: 1;
}

/* 带 conversation hash 刷新时，在目标对话数据完成恢复前不展示默认新对话状态。
   该状态在同一事件循环内设置，避免“无项目”与欢迎页短暂闪现。 */
.chat-turn-rail-marker.is-active::before {
    width: 12px;
    background: #20242a;
}
.chat-turn-rail-marker.is-active:hover::before {
    width: 22px;
    background: #20242a;
}
@media (max-width: 820px) {
    .chat-turn-rail {
        display: none !important;
    }
}
@media (prefers-reduced-motion: reduce) {
    .chat-turn-rail-marker::before {
        transition: none;
    }

    .chat-turn-rail-marker.has-pending-new:last-child::before {
        animation: none;
    }

    .chat-return-latest,
    .chat-return-latest.is-streaming .chat-return-latest-dot {
        transition: none;
        animation: none;
    }
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (hover: none) {
    .message-delete-turn-btn {
        opacity: 0.65;
    }
}
.mcp-tool-list.expanded {
    display: flex;
}
.process-details-content .progress-timeline.expanded {
    max-height: min(70vh, 760px);
    overflow-x: hidden;
    overflow-y: auto;
    opacity: 1;
    margin-top: 12px;
    scroll-behavior: smooth;
    /* 详情内部可滚动时优先滚详情；到达边界或运行中取消内层滚动时，
       继续把滚轮自然传给外层 #chat-messages，避免鼠标悬停卡片后“滚不动”。 */
    overscroll-behavior: auto;
    scrollbar-gutter: stable;
}
.process-details-auto-sentinel.is-error {
    color: var(--danger-color, #dc2626);
    background: rgba(220, 38, 38, 0.08);
    cursor: pointer;
}
.ai-channel-manager-hint.is-success {
    color: var(--text-muted, #718096);
}
.ai-channel-manager-hint.is-error {
    color: var(--error-color, #e53e3e);
}
.ai-channel-list-item.active {
    background: var(--card-bg, #fff);
    border-color: color-mix(in srgb, var(--accent-color, #3182ce) 58%, transparent);
    box-shadow: 0 8px 18px rgba(49, 130, 206, 0.12), inset 3px 0 0 var(--accent-color, #3182ce);
}
.ai-channel-editor-form .form-group {
    margin-bottom: 0;
}
.ai-channel-editor-form .form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: normal;
}
.ai-channel-editor-form .form-hint {
    display: block;
    margin-top: 5px;
    color: var(--text-muted, #718096);
    font-size: 0.75rem;
    line-height: 1.45;
}
.ai-channel-section-actions .connection-test-result.is-error {
    border-color: color-mix(in srgb, var(--danger-color, #e53e3e) 42%, var(--border-color, #e2e8f0));
    background: color-mix(in srgb, var(--danger-color, #e53e3e) 8%, var(--surface-color, #ffffff));
    color: var(--danger-color, #e53e3e);
}
.ai-channel-section-actions .connection-test-result.is-success {
    border-color: color-mix(in srgb, var(--success-color, #38a169) 38%, var(--border-color, #e2e8f0));
    background: color-mix(in srgb, var(--success-color, #38a169) 9%, var(--surface-color, #ffffff));
    color: var(--success-color, #38a169);
}
html[data-theme="dark"] .ai-channel-section-actions .connection-test-result.is-error {
    border-color: rgba(248, 113, 113, 0.42);
    background: rgba(127, 29, 29, 0.22);
    color: #f87171;
}
html[data-theme="dark"] .ai-channel-section-actions .connection-test-result.is-success {
    border-color: rgba(52, 211, 153, 0.38);
    background: rgba(6, 78, 59, 0.22);
    color: #34d399;
}
html[data-theme="dark"] .ai-channel-list-item.active {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(96, 165, 250, 0.46);
    box-shadow: inset 2px 0 0 rgba(96, 165, 250, 0.95);
}
html[data-theme="dark"] .ai-channel-editor-actions .btn-secondary {
    background: rgba(15, 23, 42, 0.72);
}
html[data-theme="dark"] .ai-channel-editor-actions .btn-secondary.danger {
    background: rgba(127, 29, 29, 0.28);
    border-color: rgba(248, 113, 113, 0.42);
    color: #fca5a5;
}
html[data-theme="dark"] .ai-channel-editor-actions .btn-secondary.danger:hover {
    background: rgba(153, 27, 27, 0.38);
    border-color: rgba(248, 113, 113, 0.68);
    color: #fecaca;
}
@media (max-width: 980px) {
    .ai-channel-manager-header,
    .ai-channel-editor-head {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-channel-editor-meta {
        justify-content: flex-start;
    }

    .ai-channel-switcher {
        align-items: stretch;
        flex-direction: column;
    }

    .ai-channel-editor {
        overflow-y: visible;
    }
}
@media (max-width: 640px) {
    .ai-channel-manager-header,
    .ai-channel-switcher,
    .ai-channel-editor {
        padding-left: 14px;
        padding-right: 14px;
    }

    .ai-channel-switcher-actions {
        justify-content: flex-start;
    }

    .ai-channel-header-actions {
        justify-content: flex-start;
    }

    .ai-channel-switcher-field {
        grid-template-columns: 1fr;
    }

    .ai-channel-form-section-head,
    .ai-channel-form-grid,
    .ai-channel-reasoning-grid {
        grid-template-columns: 1fr;
    }

    .ai-channel-form-section-head,
    .ai-channel-section-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .ai-channel-section-actions {
        justify-content: flex-start;
        min-width: 0;
    }
}
.session-settings-select.open .session-settings-select-trigger {
    outline: none;
    border-color: var(--accent-color, #3182ce);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.14);
}
.session-settings-select.open .session-settings-select-caret {
    color: var(--accent-color, #3182ce);
    transform: rotate(180deg) translateY(1px);
}
.session-settings-select.open .session-settings-select-menu {
    display: block;
}
.session-settings-select-option.is-selected {
    background: rgba(49, 130, 206, 0.12);
    color: var(--accent-color, #3182ce);
    font-weight: 700;
}
.conversation-reasoning-card .hitl-reviewer-toggle-btn.is-active {
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
@media (max-width: 420px) {
    .session-settings-inline {
        grid-template-columns: 1fr;
    }
}
.chat-input-container.drag-over {
    background: rgba(0, 102, 255, 0.06);
    border-radius: 12px;
    outline: 2px dashed rgba(0, 102, 255, 0.35);
    outline-offset: -2px;
}
/* WebKit 浏览器（Chrome,
Safari {
    width: 4px; /* 最窄的滚动条 */
}
@media (prefers-reduced-motion: reduce) {
    .chat-input-container .send-btn,
    .chat-input-container .send-btn::before,
    .chat-input-container .send-btn svg {
        transition: none;
    }

    .chat-input-container .send-btn::before {
        display: none;
    }

    .chat-input-container .send-btn:hover,
    .chat-input-container .send-btn:active {
        transform: none;
    }

    .chat-input-container .send-btn:hover svg,
    .chat-input-container .send-btn:active svg {
        transform: none;
    }
}
.mention-item.active {
    background: linear-gradient(105deg, rgba(0, 102, 255, 0.08), rgba(0, 102, 255, 0.02)) !important;
    border-left-color: rgba(0, 102, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 102, 255, 0.22);
    color: rgba(15, 23, 42, 0.95);
}
.mention-item.active .mention-item-name,
.mention-item.active .mention-item-desc,
.mention-item.active .mention-item-meta,
.mention-item.active .mention-status {
    color: rgba(15, 23, 42, 0.95);
}
.mention-item.active .mention-status {
    background: rgba(0, 102, 255, 0.12);
    color: #0052cc;
}
/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 20% -10%, rgba(0, 102, 255, 0.08), transparent 60%),
        radial-gradient(1000px 500px at 90% 110%, rgba(124, 58, 237, 0.07), transparent 60%),
        var(--bg-secondary);
    animation: loginPageIn 0.3s ease-out;
}
@keyframes loginPageIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes loginCardIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    animation: loginCardIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.login-brand {
    padding: 32px 28px 24px;
    text-align: center;
    background: linear-gradient(180deg, rgba(0, 102, 255, 0.07) 0%, rgba(124, 58, 237, 0.04) 50%, transparent 100%);
    border-bottom: 1px solid var(--border-color);
}
.login-title {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.35em;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}
.login-title .brand-wordmark {
    font-size: 1.375rem;
}
.login-brand h2 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.login-subtitle {
    margin: 8px 0 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px 28px 28px;
}
.login-form .form-group {
    margin-bottom: 0;
}
.login-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.9375rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-form input[type="text"]::placeholder,
.login-form input[type="password"]::placeholder {
    color: var(--text-muted);
}
.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}
.login-notice {
    color: var(--accent-color);
    background: rgba(0, 102, 255, 0.08);
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.8125rem;
}
.login-error {
    color: var(--error-color);
    background: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.8125rem;
}
.login-card .login-submit {
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-color) 0%, #0047ab 100%) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(0, 102, 255, 0.4);
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.login-card .login-submit:hover {
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.45);
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--accent-hover) 0%, #003d8a 100%) !important;
}
.login-card .login-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 102, 255, 0.35);
}
html[data-theme="dark"] .login-card .login-submit {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    border: 1px solid rgba(96, 165, 250, 0.4) !important;
    box-shadow:
        0 5px 12px rgba(2, 6, 23, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .login-card .login-submit:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    border-color: rgba(147, 197, 253, 0.56) !important;
    box-shadow:
        0 7px 16px rgba(2, 6, 23, 0.36),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .login-card .login-submit:active {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
    border-color: rgba(96, 165, 250, 0.34) !important;
    box-shadow:
        0 3px 8px rgba(2, 6, 23, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
html[data-theme="dark"] .login-card .login-submit:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(96, 165, 250, 0.24),
        0 5px 12px rgba(2, 6, 23, 0.32);
}
html[data-theme="dark"] .login-card .login-submit:disabled {
    background: #24324a !important;
    border-color: rgba(148, 163, 184, 0.2) !important;
    color: #94a3b8 !important;
    box-shadow: none;
    opacity: 1;
    transform: none;
    cursor: not-allowed;
}
.login-card .login-submit:hover .login-submit-arrow {
    transform: translateX(3px);
}
/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.52);
    overflow: auto;
    animation: fadeIn 0.15s ease-out;
}
.modal-content {
    background-color: var(--bg-primary);
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: slideDown 0.18s ease-out;
    overflow: hidden;
    contain: layout style paint;
}
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--accent-color) 0%, #0052cc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* 允许标题在 flex 中收缩/换行，避免把右侧按钮挤压变形 */
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}
/* 统一关闭按钮：32×32 正方形容器 + 16px 居中图标；默认无背景，hover 显示 #f2f3f5 */
.modal-close {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--close-btn-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
    font-size: 0;
    transition: background 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
}
.modal-close svg {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
}
.modal-close:not(:has(svg))::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    background-color: currentColor;
    -webkit-mask-image: var(--icon-close-mask);
    mask-image: var(--icon-close-mask);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}
.modal-close:hover {
    background: var(--close-btn-bg-hover);
    color: var(--close-btn-color);
}
.modal-close:active {
    background: var(--close-btn-bg-active);
    color: var(--close-btn-color);
}
.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.modal-body .form-group {
    margin-bottom: 14px;
}
.modal-body .form-group:last-child {
    margin-bottom: 0;
}
#mcp-detail-modal {
    background: rgba(3, 7, 18, 0.58);
    backdrop-filter: blur(4px);
}
#mcp-detail-modal .modal-header {
    min-height: 64px;
    padding: 16px 24px;
    background: #ffffff;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: none;
    backdrop-filter: none;
}
#mcp-detail-modal .modal-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.12rem;
    line-height: 1.25;
    letter-spacing: 0;
    color: var(--text-primary);
    background: none;
    -webkit-text-fill-color: currentColor;
}
#mcp-detail-modal .modal-header h2::before {
    content: '';
    width: 4px;
    height: 22px;
    border-radius: 999px;
    background: #64748b;
    box-shadow: none;
    flex: 0 0 auto;
}
#mcp-detail-modal .modal-body {
    padding: 24px 26px 26px;
    background: #f8fafc;
}
#mcp-detail-modal .detail-result-tab.active {
    background: #ffffff;
    color: var(--text-primary);
    box-shadow: none;
}
#mcp-detail-modal .detail-result-panel.active {
    display: block;
}
@media (max-width: 900px) {
    #mcp-detail-modal .mcp-detail-content {
        width: calc(100vw - 28px);
        margin: 24px auto;
        max-height: calc(100vh - 48px);
    }

    #mcp-detail-modal .detail-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    #mcp-detail-modal .detail-info-grid .detail-item:nth-child(4) {
        grid-column: 1 / -1;
    }
}
@media (max-width: 640px) {
    #mcp-detail-modal .mcp-detail-content {
        width: 100%;
        min-height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    #mcp-detail-modal .modal-header,
    #mcp-detail-modal .modal-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    #mcp-detail-modal .detail-section {
        padding: 16px;
    }

    #mcp-detail-modal .detail-info-grid {
        grid-template-columns: 1fr;
    }

    #mcp-detail-modal .detail-info-grid .detail-item:nth-child(4) {
        grid-column: auto;
    }

    #mcp-detail-modal .detail-section-header {
        align-items: flex-start;
        flex-direction: column;
    }
}
/* 全局滚动条：细条，默认隐藏，悬停显示 */
* {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
*:hover {
    scrollbar-color: color-mix(in srgb, var(--text-muted, #94a3b8) 55%, transparent) transparent;
}
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 999px;
}
/* 未悬停时强制隐藏，覆盖各模块常显滑块 */
:not(:hover)::-webkit-scrollbar-thumb {
    background: transparent !important;
}
*:hover::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text-muted, #94a3b8) 55%, transparent);
}
*:hover::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--text-muted, #94a3b8) 80%, transparent);
}
/* 响应式设计 */
@media (max-width: 768px) {
    body {
        height: 100vh;
        overflow: hidden;
    }
    
    .container {
        border-radius: 0;
        height: 100vh;
        overflow: hidden;
    }
    
    header {
        padding: 10px 20px;
        flex-shrink: 0;
    }
    
    .logo h1,
    .logo .brand-wordmark {
        font-size: 1.2rem;
    }

    .brand-logo {
        width: 32px;
        height: 32px;
    }

    .version-badge {
        padding: 2px 7px;
        font-size: 0.5625rem;
    }
    
    .header-subtitle {
        display: none;
    }
    
    .main-layout {
        overflow: hidden;
        min-height: 0;
    }
    
    /* 主侧边栏在移动设备上可以折叠或调整 */
    .main-sidebar {
        width: 200px;
    }
    
    .main-sidebar.collapsed {
        width: 64px;
    }
    
    .sidebar-collapse-btn {
        width: 28px;
        height: 28px;
    }
    
    .main-sidebar-header .logo span {
        font-size: 1rem;
    }
    
    .nav-item-content {
        padding: 10px 12px;
        font-size: 0.875rem;
    }
    
    .nav-item-content span {
        font-size: 0.875rem;
    }
    
    .conversation-sidebar,
    .sidebar {
        width: 240px;
        height: 100%;
        overflow: hidden;
    }

    /* 对话列表折叠态在窄屏下仍保持窄条，避免被 240px 覆盖 */
    .conversation-sidebar.collapsed {
        width: 56px;
    }
    
    .sidebar-content {
        min-height: 0;
    }
    
    .chat-container {
        height: 100%;
        overflow: hidden;
    }
    
    .chat-messages {
        padding: 16px;
        min-height: 0;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-input-container {
        padding: 16px;
        flex-shrink: 0;
    }
    
    .page-header {
        padding: 16px;
        flex-wrap: wrap;
    }
    
    .page-header h2 {
        font-size: 1.25rem;
    }
    
    .page-content {
        padding: 16px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}
.progress-timeline.expanded {
    max-height: 2000px;
    overflow-x: hidden;
    overflow-y: auto;
}
/* 流式执行中：内层迭代与外层 #chat-messages 各自滚动、各自跟随最新内容。 */
.progress-container.is-streaming .progress-timeline.expanded,
.process-details-container.is-streaming .process-details-content .progress-timeline.expanded {
    max-height: min(64vh, 720px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: auto;
    scrollbar-gutter: stable;
}

@media (max-width: 768px) {
    .active-tasks-bar {
        padding: 10px 16px;
    }
}
/* 设置页面布局 */
.settings-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: var(--bg-primary);
}
/* 设置侧边栏 */
.settings-sidebar {
    width: 200px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    padding: 0;
}
.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
}
.settings-nav-item {
    padding: 14px 20px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background: transparent;
    border-left: 3px solid transparent;
    position: relative;
}
.settings-nav-item:hover {
    background: var(--bg-secondary);
}
.settings-nav-item.active {
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-color);
    font-weight: 500;
    border-left-color: var(--accent-color);
}
/* 设置内容区域 */
.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    background: var(--bg-primary);
}
.settings-section-content {
    display: none;
}
.settings-section-content.active {
    display: block;
}
.settings-section-header {
    margin-bottom: 32px;
}
.settings-section-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.settings-subsection {
    margin-bottom: 24px;
    padding: 0;
}
.settings-subsection h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}
.robot-card.is-active {
    border-color: var(--accent-color);
    background: var(--bg-primary);
}
.robot-binding-code-card {
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.robot-binding-code-card.is-active {
    border-color: rgba(0, 102, 255, 0.32);
    box-shadow: 0 10px 28px rgba(0, 102, 255, 0.08);
}
.robot-binding-code-card.is-expired {
    border-color: rgba(220, 53, 69, 0.28);
}
.robot-binding-account-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.is-active .robot-binding-state {
    color: var(--success-color);
}
.is-expired .robot-binding-state {
    color: var(--error-color);
}
.is-expired .robot-binding-code-row code {
    color: var(--error-color);
    font-size: 1.4rem;
    letter-spacing: 0.08em;
}
.is-expired .robot-binding-timer-copy strong,
.is-expired .robot-binding-timer-copy span {
    color: var(--error-color);
}
.robot-binding-account-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid var(--border-color);
    border-radius: 11px;
    background: var(--bg-primary);
    transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.robot-binding-account-card:hover {
    border-color: rgba(0, 102, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.robot-binding-platform-icon,
.robot-binding-empty-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--accent-color);
    background: rgba(0, 102, 255, 0.1);
    font-size: 0.92rem;
    font-weight: 700;
}
.robot-binding-account-main {
    flex: 1;
    min-width: 0;
}
.robot-binding-account-name {
    justify-content: flex-start;
}
.robot-binding-account-name span {
    padding: 2px 7px;
    border-radius: 999px;
    color: var(--success-color);
    background: rgba(40, 167, 69, 0.1);
    font-size: 0.68rem;
    font-weight: 700;
}
.robot-binding-account-main small {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: var(--text-secondary);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.robot-binding-empty-state {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border: 1px dashed var(--border-color);
    border-radius: 11px;
    color: var(--text-secondary);
    background: var(--bg-primary);
}
.robot-binding-empty-state strong {
    color: var(--text-primary);
}
.robot-binding-empty-state p {
    margin: 2px 0 0;
    font-size: 0.78rem;
}
.modal-footer.robot-binding-footer {
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    padding: 14px 26px;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 145%);
}
.robot-binding-footer > .btn-secondary {
    flex: 0 0 auto;
    min-width: 66px;
    min-height: 38px;
}
html[data-theme="dark"] .robot-binding-platform-icon,
html[data-theme="dark"] .robot-binding-empty-icon {
    background: rgba(96, 165, 250, 0.14);
}
@media (max-width: 680px) {
    .robot-account-binding-content {
        width: calc(100% - 20px);
        margin: 10px auto;
        max-height: calc(100vh - 20px);
    }

    .robot-binding-header,
    .robot-binding-body {
        padding-left: 18px;
        padding-right: 18px;
    }

    .robot-binding-guide {
        justify-content: flex-start;
    }

    .robot-binding-guide-arrow {
        display: none;
    }

    .robot-binding-code-row {
        align-items: stretch;
        flex-direction: column;
    }

    .robot-binding-code-actions .btn-primary,
    .robot-binding-code-actions .btn-secondary {
        flex: 1;
    }

    .robot-binding-account-card {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .robot-binding-unbind-btn {
        margin-left: 50px;
    }

    .modal-footer.robot-binding-footer {
        gap: 10px;
        min-height: 68px;
        padding: 12px 18px;
    }

    .robot-binding-service-hint {
        flex: 1;
        font-size: 0.74rem;
    }

}
@media (max-width: 768px) {
    .robot-manager-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .robot-manager-toolbar .btn-primary {
        width: 100%;
    }

    .robot-card {
        flex-direction: column;
    }

    .robot-card-meta {
        flex-direction: row;
        align-items: center;
    }
}
.robot-command-entry .settings-description {
    margin: 0;
}
@media (max-width: 768px) {
    .robot-command-entry {
        align-items: stretch;
        flex-direction: column;
    }

    .robot-command-entry .btn-secondary {
        width: 100%;
    }
}
.form-hint {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}
.settings-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}
/* 系统设置 - 日志审计 */
.audit-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 0 0 12px;
}
.audit-section-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}
.audit-summary-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.audit-summary-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-secondary, rgba(0, 0, 0, 0.03));
    border: 1px solid var(--border-color);
}
.audit-summary-tag strong {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}
.audit-summary-tag--ok strong {
    color: #0d7a3e;
}
.audit-summary-tag--warn strong {
    color: #c0392b;
}
.audit-summary-tag-label {
    white-space: nowrap;
}
.audit-filter-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
}
.audit-filter-fields {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.audit-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 14px;
}
.audit-field--event {
    flex: 0 1 360px;
    min-width: 200px;
    max-width: 420px;
}
.audit-field--result {
    flex: 0 0 170px;
    min-width: 112px;
}
.audit-filter-time-group {
    display: flex;
    flex: 1 1 360px;
    gap: 12px 14px;
    margin-left: auto;
    min-width: 320px;
}
.audit-filter-time-group .audit-field--time {
    flex: 1 1 0;
    min-width: 150px;
}
.audit-field:not(.audit-field--event):not(.audit-field--keyword):not(.audit-field--result):not(.audit-field--time) {
    flex: 0 1 150px;
    min-width: 130px;
}
.audit-filter-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 14px;
}
.audit-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.audit-field > span {
    flex: none;
    white-space: nowrap;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.2;
}
.audit-field--keyword {
    flex: 1 1 240px;
    min-width: 200px;
}
.audit-field select,
.audit-field input[type="text"]:not(.audit-datetime-input) {
    width: 100%;
    height: 34px;
    box-sizing: border-box;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8125rem;
}
.audit-field .audit-datetime-field {
    width: 100%;
    min-width: 0;
}
.audit-logs-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    margin-left: auto;
}
.audit-logs-actions .btn-secondary,
.audit-logs-actions .btn-primary {
    height: 34px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    box-sizing: border-box;
    font-size: 0.8125rem;
}
/* 事件类型：两个下拉与「结果」等控件同款边框，无外层套框 */
.audit-filter-cascade {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}
.audit-filter-cascade select {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    height: 34px;
    box-sizing: border-box;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8125rem;
}
.audit-filter-cascade select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--bg-secondary, #f5f6f8);
}
.audit-native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.audit-filter-cascade .audit-custom-select,
.audit-field--result .audit-custom-select {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
}
.audit-field--result .audit-custom-select {
    width: 100%;
}
.audit-custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    height: 34px;
    box-sizing: border-box;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8125rem;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.audit-custom-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}
.audit-custom-select-caret {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1;
}
.audit-custom-select-trigger:hover:not(:disabled) {
    border-color: rgba(0, 102, 255, 0.45);
}
.audit-custom-select.open .audit-custom-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}
.audit-custom-select.is-disabled .audit-custom-select-trigger {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--bg-secondary, #f5f6f8);
}
.audit-custom-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 2000;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
}
.audit-custom-select.open .audit-custom-select-dropdown {
    display: block;
}
.audit-custom-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: 0.8125rem;
    line-height: 1.2;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.12s ease;
}
.audit-custom-select-option:hover {
    background: var(--bg-secondary);
}
.audit-custom-select-check {
    flex: 0 0 14px;
    width: 14px;
    font-size: 0.75rem;
    line-height: 1;
    color: var(--accent-color);
    opacity: 0;
    text-align: center;
}
.audit-custom-select-option.is-selected .audit-custom-select-check {
    opacity: 1;
}
.audit-custom-select-option.is-selected {
    color: var(--accent-color);
    font-weight: 500;
}
.audit-custom-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.audit-filter-cascade-arrow {
    flex-shrink: 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1;
    user-select: none;
    pointer-events: none;
}
.audit-time-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.audit-time-presets-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.audit-time-preset-btn {
    padding: 0.25rem 0.65rem;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.audit-time-preset-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.audit-datetime-field {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 34px;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    padding-right: 2px;
}
.audit-datetime-field:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.12);
}
.audit-datetime-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
    cursor: pointer;
}
.audit-datetime-input:focus {
    outline: none;
}
.audit-datetime-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
}
.audit-datetime-btn:hover {
    background: var(--bg-secondary, #f5f6f8);
    color: var(--accent-color);
}
.audit-datetime-clear-btn {
    font-size: 1.1rem;
    line-height: 1;
}
.audit-dt-popover {
    position: fixed;
    z-index: 1100;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 12px;
}
.audit-dt-popover-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.audit-dt-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.audit-dt-month-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}
.audit-dt-nav {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}
.audit-dt-nav:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.audit-dt-body {
    display: flex;
    gap: 10px;
}
.audit-dt-calendar {
    flex: 1;
    min-width: 0;
}
.audit-dt-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}
.audit-dt-weekdays span {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding: 2px 0;
}
.audit-dt-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.audit-dt-day {
    height: 30px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    cursor: pointer;
}
.audit-dt-day:hover {
    background: var(--bg-secondary, #f5f6f8);
}
.audit-dt-day.is-other-month {
    color: var(--text-secondary);
    opacity: 0.45;
}
.audit-dt-day.is-selected {
    background: var(--accent-color);
    color: #fff;
}
.audit-dt-day.is-selected:hover {
    background: var(--accent-hover);
}
.audit-dt-time {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    border-left: 1px solid var(--border-color);
    padding-left: 8px;
}
.audit-dt-time-col {
    display: flex;
    flex-direction: column;
    width: 52px;
    min-width: 52px;
}
.audit-dt-time-label {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.audit-dt-time-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 210px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.audit-dt-time-item {
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    cursor: pointer;
    flex-shrink: 0;
}
.audit-dt-time-item:hover {
    background: var(--bg-secondary, #f5f6f8);
}
.audit-dt-time-item.is-selected {
    background: var(--accent-color);
    color: #fff;
}
.audit-dt-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--border-color);
}
.audit-dt-footer-btn {
    padding: 0.3rem 0.75rem;
    font-size: 0.8125rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
}
.audit-dt-footer-btn:hover {
    background: rgba(0, 102, 255, 0.08);
}
.audit-dt-footer-btn--primary {
    background: var(--accent-color);
    color: #fff;
}
.audit-dt-footer-btn--primary:hover {
    background: var(--accent-hover);
}
#settings-section-audit .audit-log-list {
    margin-bottom: 0;
}
.audit-log-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
}
.audit-log-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
}
.audit-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    table-layout: auto;
    min-width: 720px;
}
.audit-log-table th,
.audit-log-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.audit-log-table thead {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
}
.audit-log-table th {
    white-space: nowrap;
}
.audit-log-table tbody tr:last-child td {
    border-bottom: none;
}
.audit-log-row {
    cursor: pointer;
    transition: background 0.12s ease;
}
.audit-log-row:hover {
    background: rgba(0, 102, 255, 0.06);
}
.audit-log-col-time {
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}
.audit-log-col-msg {
    max-width: 280px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.audit-log-col-ip {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    white-space: nowrap;
}
.audit-log-col-resource {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.audit-log-cell-muted {
    color: var(--text-muted);
}
.audit-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    border: 1px solid transparent;
}
.audit-tag--cat {
    color: var(--accent-color);
    background: rgba(0, 102, 255, 0.08);
    border-color: rgba(0, 102, 255, 0.18);
}
.audit-tag--act {
    color: var(--text-secondary);
    background: var(--bg-secondary, rgba(0, 0, 0, 0.03));
    border-color: var(--border-color);
}
#settings-section-audit .audit-logs-pagination {
    margin-top: 12px;
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
}
#settings-section-audit .audit-logs-pagination .monitor-pagination {
    margin-top: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.audit-detail-pre {
    max-height: 320px;
    overflow: auto;
    font-size: 0.75rem;
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 6px;
    margin-top: 12px;
}
.audit-timezone-hint {
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.9;
}
@media (max-width: 640px) {
    .audit-filter-bottom {
        flex-direction: column;
        align-items: stretch;
    }

    .audit-filter-time-group {
        margin-left: 0;
        flex: 1 1 100%;
        min-width: 0;
    }

    .audit-logs-actions {
        margin-left: 0;
        justify-content: flex-start;
    }

    .audit-summary-tags {
        justify-content: flex-start;
    }
}
.audit-export-dropdown {
    position: relative;
    display: inline-flex;
    align-items: flex-end;
}
.audit-export-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.audit-export-caret {
    font-size: 0.7rem;
    opacity: 0.75;
}
.audit-export-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 140px;
    padding: 4px 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 50;
}
.audit-export-menu-item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
}
.audit-export-menu-item:hover {
    background: var(--bg-secondary);
}
#settings-section-audit .audit-logs-pagination .pagination-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.audit-detail-body p {
    margin: 0 0 8px;
    font-size: 0.875rem;
}
.audit-resource-removed {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}
.audit-resource-meta code {
    font-size: 0.8125rem;
    word-break: break-all;
}
.terminal-tab.active {
    color: #e6edf3;
    background: #0d1117;
    font-weight: 500;
}
.terminal-pane.active {
    display: block;
}
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.form-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}
.form-group > label {
    flex: none;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}
/* 提示/错误说明独占一行，避免与控件挤在同一行 */
.form-group > small,
.form-group > .form-hint,
.form-group > .field-error {
    flex: 1 1 100%;
}
/* 上传区等大面积组件保持上下结构 */
.form-group:has(.picture-upload-area) {
    flex-direction: column;
    align-items: stretch;
}
@media (max-width: 720px) {
    .form-group {
        flex-direction: column;
        align-items: stretch;
    }
}
.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
    font-family: inherit;
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
}
#webshell-modal .form-group input:not([type="checkbox"]):not([type="radio"]),
#webshell-modal .form-group select {
    font-weight: 400;
}
.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.settings-custom-select.open .settings-custom-select-caret {
    transform: rotate(180deg);
}
.settings-custom-select.open .settings-custom-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}
.settings-custom-select.is-disabled .settings-custom-select-trigger {
    cursor: not-allowed;
    opacity: 0.56;
    background: var(--bg-secondary, #f5f6f8);
}
.settings-custom-select.open .settings-custom-select-menu {
    display: block;
}
.settings-custom-select-option.is-selected {
    color: var(--accent-color);
    font-weight: 600;
    background: rgba(0, 102, 255, 0.08);
}
.settings-custom-select-option.is-disabled {
    cursor: not-allowed;
    opacity: 0.45;
}
.settings-custom-select-option.is-selected .settings-custom-select-check {
    opacity: 1;
}
.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}
.form-group input:not([type="checkbox"]):not([type="radio"]):hover,
.form-group select:hover {
    border-color: var(--accent-color);
}
.form-group input:not([type="checkbox"]):not([type="radio"]).error,
.form-group select.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}
.form-group input:not([type="checkbox"]):not([type="radio"]).error:focus,
.form-group select.error:focus {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}
.model-pick-dropdown.open .model-pick-caret {
    transform: rotate(180deg);
    color: var(--accent-color);
}
.model-pick-dropdown.open .model-pick-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
    background: var(--bg-primary);
}
.model-pick-dropdown.is-disabled .model-pick-trigger {
    opacity: 0.55;
    cursor: not-allowed;
}
.model-pick-dropdown.open .model-pick-menu {
    display: flex;
    flex-direction: column;
    animation: model-pick-menu-in 0.16s ease-out;
}
@keyframes model-pick-menu-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.model-pick-option.is-selected {
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-color);
    font-weight: 600;
}
.model-pick-option.is-selected .model-pick-option-check {
    opacity: 1;
}
/* 现代化复选框样式 */
.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 12px;
    margin: 0;
    justify-content: flex-start;
    width: 100%;
    cursor: pointer;
    user-select: none;
    padding: 8px 0;
    transition: all 0.2s ease;
}
.checkbox-label:hover {
    opacity: 0.9;
}
.modern-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.checkbox-custom {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
.checkbox-custom::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.modern-checkbox:checked + .checkbox-custom {
    background: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
.modern-checkbox:checked + .checkbox-custom::before {
    transform: translateX(20px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.modern-checkbox:focus + .checkbox-custom {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
.modern-checkbox:checked:focus + .checkbox-custom {
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
.checkbox-text {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
    transition: color 0.2s ease;
}
.checkbox-label:hover .checkbox-text {
    color: var(--accent-color);
}
.modern-checkbox:disabled + .checkbox-custom {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-tertiary);
}
.modern-checkbox:disabled + .checkbox-custom + .checkbox-text {
    opacity: 0.5;
    cursor: not-allowed;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 4px;
}
.tools-status-filter .btn-filter {
    padding: 6px 12px;
    border: none;
    border-right: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.tools-status-filter .btn-filter:last-child {
    border-right: none;
}
.tools-status-filter .btn-filter:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.tools-status-filter .btn-filter.active {
    background: var(--accent-color);
    color: #fff;
}
.external-mcp-item.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}
.monitor-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    background: var(--bg-primary);
    gap: 16px;
    flex-wrap: wrap;
}
.pagination-container {
    margin-top: 0;
}
/* Skill 包内文件树：区分不可点击的文件夹与可点击的文件 */
#skill-package-tree {
    flex: 0 0 240px;
    max-height: 440px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 4px;
    font-size: 13px;
    line-height: 1.4;
}
#skill-view-body {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.skill-tree-file.is-selected {
    font-weight: 600;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-color);
}
/* 左侧：信息显示和每页数量选择器 - 更自然的设计 */
.pagination-fixed .pagination-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    /* 去掉背景色和边框，更自然 */
    padding: 0;
    background: transparent;
    border-radius: 0;
}
.pagination-fixed .pagination-info span {
    color: var(--text-primary);
    white-space: nowrap;
    font-weight: 400;
}
.pagination-fixed .pagination-info .pagination-page-size {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 400;
}
.pagination-fixed .pagination-info .pagination-page-size select {
    padding: 4px 24px 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
    min-width: 60px;
    max-width: 80px;
    font-weight: 500;
    /* 更柔和的边框 */
    border-color: rgba(233, 236, 239, 0.8);
    /* 确保四个角都是圆角 */
    border-radius: 8px !important;
    /* 确保下拉框不被拉伸 */
    flex-shrink: 0;
    box-sizing: border-box;
    /* 确保下拉箭头正确显示 */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
}
.pagination-fixed .pagination-info .pagination-page-size select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
    background: var(--bg-primary);
}
.pagination-fixed .pagination-info .pagination-page-size select:hover {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
}
/* 右侧：分页按钮组 - 更统一的设计 */
.pagination-fixed .pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.pagination-fixed .pagination-controls .btn-secondary {
    padding: 5px 12px;
    font-size: 0.8125rem;
    min-width: auto;
    transition: all 0.2s ease;
    font-weight: 500;
    border-radius: 6px;
    /* 更柔和的边框 */
    border-color: rgba(233, 236, 239, 0.8);
    /* 确保四个角都是圆角 */
    border-radius: 8px !important;
}
.pagination-fixed .pagination-controls .btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 102, 255, 0.1);
}
.pagination-fixed .pagination-controls .btn-secondary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 102, 255, 0.08);
}
.pagination-fixed .pagination-controls .btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-muted);
}
.pagination-fixed .pagination-page {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 5px 10px;
    white-space: nowrap;
    font-weight: 400;
    /* 添加圆角设计，四个角都是圆的 */
    border-radius: 8px !important;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}
/* 响应式优化 */
@media (max-width: 768px) {
    .pagination-fixed .pagination {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
        padding: 16px;
    }
    
    .pagination-fixed .pagination-info {
        width: 100%;
        justify-content: center;
        gap: 16px;
    }
    
    .pagination-fixed .pagination-controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .pagination-fixed .pagination-controls .btn-secondary {
        flex: 1;
        min-width: 60px;
        max-width: 120px;
    }
}
.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 16px;
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pagination-controls button {
    padding: 6px 12px;
    font-size: 0.875rem;
    min-width: auto;
}
.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.pagination-page-size {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.pagination-page-size select {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
}
.pagination-page-size select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}
.pagination-page-size select:hover {
    border-color: var(--accent-color);
}
.pagination-btn:hover:not(.disabled):not(.active) {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}
.pagination-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    font-weight: 500;
}
.pagination-page {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0 8px;
}
.pagination-page-size {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.pagination-page-size label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.pagination-page-size select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 70px;
}
.pagination-page-size select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}
.pagination-page-size select:hover {
    border-color: var(--accent-color);
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}
.btn-primary {
    padding: 7px 16px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn-secondary {
    padding: 7px 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}
.mcp-monitor-page .page-content {
    padding: 16px 20px;
    background: #f1f5f9;
}
.mcp-monitor-page .page-header {
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}
.mcp-monitor-page .page-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.monitor-filter-select-ui.open .monitor-filter-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}
.monitor-filter-select-ui.open {
    z-index: 120;
}
.monitor-filter-select-ui.is-disabled .monitor-filter-select-trigger {
    opacity: 0.6;
    cursor: not-allowed;
}
.monitor-filter-select-ui.open .monitor-filter-select-caret {
    transform: rotate(180deg);
}
.monitor-filter-select-ui.open .monitor-filter-select-dropdown {
    display: block;
}
.monitor-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}
.monitor-filter-select-option.is-selected .monitor-filter-select-check {
    visibility: visible;
}
@media (max-width: 768px) {
    .mcp-stats-kpi {
        flex-direction: column;
    }
}
@media (max-width: 768px) {
    .mcp-stats-kpi__item:not(:last-child)::after {
        right: 16px;
        left: 16px;
        top: auto;
        bottom: 0;
        width: auto;
        height: 1px;
    }
}
.mcp-stats-kpi__value--rate.is-success { color: #15803d; }
.mcp-stats-kpi__value--rate.is-danger { color: #dc2626; }
.mcp-stats-kpi__status.is-success { color: #15803d; }
.mcp-stats-kpi__status.is-danger { color: #dc2626; }
@media (max-width: 900px) {
    .mcp-stats-combined__body--full {
        min-height: 160px;
    }
}
@media (max-width: 720px) {
    .mcp-stats-combined__body--full,
    .mcp-stats-combined__body--tools {
        flex-direction: column;
        min-height: 0;
    }
    .mcp-stats-combined__main {
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }
    .mcp-stats-tool-item__metrics,
    .mcp-stats-tool-item__metrics-head {
        grid-template-columns: 3rem 2.5rem 4rem;
        column-gap: 0.875rem;
        padding-left: 12px;
    }
    .mcp-stats-tool-item__track {
        width: min(100%, 180px);
    }
    .mcp-stats-combined__timeline {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        min-width: 0;
        border-left: none;
    }
}
.workflow-package-steps .is-active {
    color: var(--text-primary);
}
.workflow-package-steps .is-active b {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, var(--accent-color), #7c3aed);
    color: #fff;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent-color) 10%, var(--bg-primary)), 0 5px 14px color-mix(in srgb, var(--accent-color) 28%, transparent);
}
.workflow-package-modal .btn-primary {
    background: var(--accent-color);
    box-shadow: none;
    transition: background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}
.workflow-package-modal .btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: none;
    transform: none;
}
.workflow-package-modal .btn-primary:active:not(:disabled) {
    background: color-mix(in srgb, var(--accent-color) 88%, #000);
    box-shadow: none;
    transform: none;
}
.workflow-package-modal .btn-primary:disabled,
.workflow-package-modal .btn-primary:disabled:hover {
    background: color-mix(in srgb, var(--accent-color) 62%, var(--bg-tertiary));
    box-shadow: none;
    opacity: .62;
    transform: none;
    cursor: not-allowed;
}
.workflow-package-modal .btn-secondary {
    transition: background-color 150ms ease, border-color 150ms ease;
}
.workflow-package-modal .btn-secondary:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--accent-color) 35%, var(--border-color));
    background: var(--bg-tertiary);
    box-shadow: none;
    transform: none;
}
.workflow-package-status.is-success {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.1);
}
.workflow-package-status.is-success .workflow-package-status-icon {
    background: rgba(34, 197, 94, .18);
}
.workflow-package-status.is-success .workflow-package-status-icon::after {
    content: '✓';
    color: var(--success-color);
}
.workflow-package-choice.is-selected {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 8%, var(--bg-primary));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 8%, transparent);
}
.workflow-package-footer-actions .btn-primary,
.workflow-package-footer-actions .btn-secondary {
    min-width: 94px;
    min-height: 36px;
    border-radius: 9px;
    font-weight: 650;
}
.workflow-package-footer-actions .btn-primary {
    background: var(--accent-color);
}
@media (max-width: 760px) {
    .workflow-package-modal {
        padding: 10px;
    }

    .workflow-package-modal-content {
        width: 100%;
        max-height: calc(100vh - 20px);
        margin: 0 auto;
        border-radius: 15px;
    }

    .workflow-package-modal-header {
        padding: 18px !important;
    }

    .workflow-package-title-icon,
    .workflow-package-safe-badge,
    .workflow-package-steps small,
    .workflow-package-footer-note {
        display: none;
    }

    .workflow-package-modal-body {
        grid-template-columns: minmax(0, 1fr);
        padding: 14px;
    }

    .workflow-package-steps {
        padding: 12px 18px;
    }

    .workflow-package-steps::before {
        top: 26px;
        left: 25%;
        right: 25%;
    }

    .workflow-package-steps b {
        flex-basis: 28px;
        width: 28px;
        height: 28px;
    }

    .workflow-package-dropzone {
        min-height: 138px;
    }

    .workflow-package-summary-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .workflow-package-modal-footer {
        justify-content: flex-end;
        padding: 14px;
    }
}
/* RBAC workspace: keep navigation stable and long resource collections bounded. */
.platform-rbac-page > .page-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: color-mix(in srgb, var(--bg-secondary) 72%, var(--bg-primary));
}
.rbac-topbar {
    flex: 0 0 auto;
}
.rbac-workspace-view:not([hidden]) {
    flex: 1 1 auto;
    min-height: 0;
}
.rbac-layout {
    grid-template-columns: minmax(280px, 328px) minmax(0, 1fr);
    align-items: stretch;
    height: 100%;
    overflow: hidden;
}
.rbac-panel {
    height: 100%;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}
.rbac-panel-users {
    position: static;
    height: 100%;
    max-height: none;
}
.rbac-panel-detail {
    display: flex;
    min-width: 0;
}
.rbac-panel-detail .rbac-tab-panel:not([hidden]) {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.rbac-panel-users .rbac-list,
.rbac-panel-detail .rbac-tab-panel {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--text-muted) 60%, transparent) transparent;
}
.rbac-panel-users .rbac-list::-webkit-scrollbar,
.rbac-panel-detail .rbac-tab-panel::-webkit-scrollbar,
.rbac-resource-picker::-webkit-scrollbar,
.rbac-assignments-list::-webkit-scrollbar {
    width: 6px;
}
.rbac-panel-users .rbac-list::-webkit-scrollbar-thumb,
.rbac-panel-detail .rbac-tab-panel::-webkit-scrollbar-thumb,
.rbac-resource-picker::-webkit-scrollbar-thumb,
.rbac-assignments-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-muted) 52%, transparent);
}
.rbac-user-name,
.rbac-user-handle {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-user-name {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.875rem;
    font-weight: 650;
    line-height: 1.25;
}
.rbac-user-row .rbac-pill {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    min-height: 20px;
    padding: 1px 7px;
    font-size: 0.6875rem;
}
.rbac-user-handle {
    grid-column: 1 / -1;
    grid-row: 2;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.25;
}
.rbac-user-summary {
    grid-column: 1 / -1;
    grid-row: 3;
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.rbac-assignment-help {
    flex: 0 0 auto;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.71875rem;
    line-height: 1.35;
}
.rbac-assignment-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
}
.rbac-resource-section {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
}
.rbac-resource-section-head {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 54px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-secondary) 70%, var(--bg-primary));
}
.rbac-resource-section-head > div:first-child {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}
.rbac-resource-section-head strong {
    color: var(--text-primary);
    font-size: 0.8125rem;
}
.rbac-resource-section-head span {
    color: var(--text-secondary);
    font-size: 0.71875rem;
}
.rbac-assignment-filters {
    display: grid;
    grid-template-columns: minmax(112px, 0.7fr) minmax(150px, 1.3fr);
    gap: 8px;
    margin-top: 0;
    width: 100%;
}
.rbac-assignment-filterbar {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-secondary) 35%, var(--bg-primary));
}
.rbac-resource-filterbar {
    display: grid;
    grid-template-columns: minmax(110px, 0.65fr) minmax(150px, 1fr) minmax(190px, 1.25fr);
    gap: 8px;
}
.rbac-resource-filterbar :is(.form-select, .form-input),
.rbac-resource-filterbar .settings-custom-select-trigger {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    height: 40px;
}
.rbac-assignment-filters :is(.form-select, .form-input) {
    height: 40px;
    min-height: 40px;
}
.rbac-assignment-filters .settings-custom-select-trigger {
    height: 40px;
    min-height: 40px;
    padding: 8px 11px;
    border-radius: 8px;
    font-size: 0.8125rem;
}
.platform-rbac-page .settings-custom-select {
    width: 100%;
    min-width: 0;
}
.platform-rbac-page .settings-custom-select-menu {
    z-index: 3200;
}
.platform-rbac-page .settings-custom-select-trigger,
.rbac-assignment-filters .settings-custom-select-trigger {
    min-height: 40px;
    height: 40px;
    padding: 8px 11px;
    border-radius: 8px;
    font-size: 0.8125rem;
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}
.platform-rbac-page .settings-custom-select-trigger:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--accent-color) 38%, var(--border-color));
}
.platform-rbac-page .settings-custom-select.open .settings-custom-select-trigger,
#rbac-user-modal .settings-custom-select.open .settings-custom-select-trigger,
#rbac-role-modal .settings-custom-select.open .settings-custom-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
}
.platform-rbac-page .settings-custom-select-option.is-selected,
#rbac-user-modal .settings-custom-select-option.is-selected,
#rbac-role-modal .settings-custom-select-option.is-selected {
    color: var(--accent-color);
    background: rgba(0, 102, 255, 0.08);
}
.rbac-resource-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    max-height: 300px;
    margin: 0;
    padding: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.rbac-resource-option-main {
    min-width: 0;
}
.rbac-resource-option-main strong,
.rbac-resource-option-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-resource-option-detail {
    max-width: 120px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.75rem;
}
.rbac-no-role-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid rgba(234, 88, 12, 0.28);
    border-radius: 8px;
    background: rgba(234, 88, 12, 0.08);
}
.rbac-no-role-notice[hidden] {
    display: none !important;
}
.rbac-no-role-notice-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.rbac-no-role-notice-copy strong {
    color: #9a3412;
    font-size: 0.8125rem;
}
.rbac-no-role-notice-copy span {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.45;
}
@keyframes rbac-focus-pulse {
    0%, 100% {
        box-shadow: none;
    }

    50% {
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
    }
}
.rbac-role-grid.rbac-focus-pulse,
#rbac-tab-roles.rbac-focus-pulse {
    animation: rbac-focus-pulse 1.2s ease;
    border-radius: 8px;
}
.rbac-pending-bar {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    min-height: 0;
    margin: 0 0 12px;
    padding: 9px 10px;
    border: 1px solid rgba(37, 99, 235, 0.24);
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.05);
}
.rbac-pending-bar[hidden] {
    display: none !important;
}
.rbac-pending-bar-head {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
}
.rbac-pending-list {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
    min-width: 0;
    max-height: 72px;
    padding-right: 2px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.rbac-pending-item {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 260px;
    padding: 4px 5px 4px 9px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-primary);
}
.rbac-pending-item-main {
    display: flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
}
.rbac-pending-item-main strong {
    font-size: 0.75rem;
    font-weight: 600;
}
.rbac-pending-item-main strong,
.rbac-pending-item-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-pending-item-main small {
    color: var(--text-muted);
    font-size: 0.6875rem;
}
.rbac-pending-bar-actions {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 8px;
}
.rbac-pending-remove {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}
.rbac-pending-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color, #dc2626);
}
@container rbac-page (max-width: 760px) {
    .rbac-pending-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .rbac-pending-bar-actions {
        justify-content: flex-end;
    }

    .rbac-pending-list {
        max-height: 108px;
    }
}
.rbac-resource-option-main small {
    display: flex;
    align-items: center;
    gap: 6px;
}
.rbac-assignments-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    max-height: 300px;
    padding: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.rbac-assignments-list .rbac-empty,
.rbac-assignments-list .empty-state,
.rbac-resource-picker .rbac-picker-status,
.rbac-resource-picker .rbac-empty {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    margin: 0;
    padding: 20px 16px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-secondary) 55%, var(--bg-primary));
}
.rbac-assignment-row {
    min-height: 52px;
    padding: 9px 10px;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent);
    border-radius: 0;
    background: transparent;
}
.rbac-assignment-row:last-child {
    border-bottom: 0;
}
.rbac-assignment-row:hover {
    background: color-mix(in srgb, var(--accent-color) 3%, var(--bg-primary));
}
.rbac-pagination {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) max-content;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 48px;
    padding: 8px;
    border-top: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-secondary) 68%, var(--bg-primary));
    margin-top: auto;
}
.rbac-pagination[hidden] {
    display: none !important;
}
.rbac-pagination > span {
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.71875rem;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-pagination .btn-small {
    min-height: 30px;
    padding: 4px 9px;
}
@container rbac-page (max-width: 980px) {
    .rbac-assignment-columns {
        grid-template-columns: minmax(0, 1fr);
    }
}
@container rbac-page (max-width: 760px) {
    .platform-rbac-page > .page-content {
        overflow-y: auto;
    }

    .rbac-layout {
        height: auto;
        min-height: min(720px, 100%);
        overflow: visible;
    }

    .rbac-panel {
        height: auto;
    }

    .rbac-panel-users {
        height: auto;
        max-height: min(420px, 60vh);
    }

    .rbac-assignment-columns { min-height: 0; }

    .rbac-panel-detail #rbac-tab-assignments.rbac-tab-panel:not([hidden]) {
        overflow-y: visible;
    }
}
@media (max-height: 860px) {
    .rbac-assignment-help {
        display: none;
    }

    .rbac-panel-detail .rbac-selected-summary > div {
        padding: 7px 10px;
    }
}
@container rbac-page (max-width: 560px) {
    .rbac-assignment-filters {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .rbac-resource-section-head > div:first-child {
        align-items: flex-start;
        flex-direction: column;
    }
}
.mcp-stats-proportion-seg.is-active {
    filter: brightness(1.08);
    z-index: 1;
}
.mcp-stats-tool-item.is-active {
    background: rgba(0, 102, 255, 0.09);
}
.mcp-stats-tool-item__rate.is-success { color: #15803d; }
.mcp-stats-tool-item__rate.is-danger { color: #dc2626; }
.mcp-stats-timeline__range.is-active {
    background: #fff;
    color: var(--accent-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.mcp-stats-timeline-dot.is-active {
    opacity: 1;
}
.mcp-stats-timeline-dot.is-active {
    fill: #1d4ed8;
}
.mcp-stats-tool-item.is-active {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.38);
}
.mcp-stats-tool-item__pill.is-success {
    color: #15803d;
    background: rgba(34, 197, 94, 0.13);
}
.mcp-stats-tool-item__pill.is-danger {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.12);
}
.mcp-stats-timeline-bar.is-active {
    fill: rgba(59, 130, 246, 0.42);
}
@media (max-width: 1180px) {
    .mcp-stats-tools-panel__list {
        grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    }
}
@media (max-width: 720px) {
    .mcp-stats-tools-panel__list {
        grid-template-columns: 1fr;
    }
    .mcp-stats-combined__main {
        max-width: none;
    }
    .mcp-stats-combined__timeline {
        max-width: none !important;
    }
    .mcp-stats-timeline-moments {
        align-items: center;
        flex-direction: row;
    }
    .mcp-stats-timeline-moments__list {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
    }
}
html[data-theme="dark"] .mcp-stats-tool-item.is-active {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.46);
}
html[data-theme="dark"] .mcp-stats-tool-item__pill.is-success {
    color: #86efac;
    background: rgba(34, 197, 94, 0.14);
}
html[data-theme="dark"] .mcp-stats-tool-item__pill.is-danger {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.14);
}
html[data-theme="dark"] .mcp-stats-timeline-bar.is-active {
    fill: rgba(96, 165, 250, 0.46);
}
@media (max-width: 900px) {
    .mcp-stats-panel__body {
        grid-template-columns: 1fr;
    }
}
.mcp-stats-rate.is-success { color: #15803d; }
.mcp-stats-rate.is-danger { color: #dc2626; }
tr.mcp-stats-tool-row[data-tool-name].is-active {
    background: rgba(0, 102, 255, 0.07);
}
@media (max-width: 900px) {
    .mcp-stats-panel__aside {
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        padding: 20px 16px 24px;
    }
}
.mcp-stats-dist-segment.is-active { filter: brightness(1.06); }
@media (prefers-reduced-motion: reduce) {
    tr.mcp-stats-tool-row[data-tool-name],
    .mcp-stats-dist-segment {
        transition: none;
    }
}
.mcp-monitor-page .monitor-section.monitor-executions:has(.monitor-filter-select-ui.open) {
    overflow: visible;
    z-index: 5;
}
.mcp-monitor-page .monitor-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.monitor-execution-actions .btn-delete {
    color: var(--error-color, #dc3545);
}
.monitor-execution-actions .btn-delete:hover {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.4);
    color: #c82333;
}
/* 统一表头复选框大小 */
#monitor-select-all {
    --theme-checkbox-size: 18px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
    margin: 0;
    vertical-align: middle;
    display: inline-block;
}
.monitor-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
/* btn-sm 与 btn-small 等价（C2 / WebShell 等模块使用 btn-sm 别名） */
.btn-small {
    padding: 6px 14px;
    font-size: 0.8125rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
}

/* 小号按钮统一尺寸，避免 .btn-danger 默认大 padding 导致同行按钮高低不齐 */
.btn-primary.btn-small,
.btn-primary.btn-sm,
.btn-secondary.btn-small,
.btn-secondary.btn-sm,
.btn-danger.btn-small,
.btn-ghost.btn-small {
    padding: 6px 14px;
    font-size: 0.8125rem;
    border-radius: 6px;
    line-height: 1.25;
}
.rbac-assignment-toolbar-main :is(
    input.form-input,
    .settings-custom-select-trigger,
    .btn-primary.btn-small
) {
    height: 40px;
    min-height: 40px;
    box-sizing: border-box;
    border-radius: 8px;
}
.rbac-assignment-toolbar-main .btn-primary.btn-small {
    padding: 0 14px;
    line-height: 1.25;
}
.btn-small:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn-small.btn-danger,
.btn-danger.btn-small {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.3);
    color: var(--error-color);
}
.btn-small.btn-danger:hover,
.btn-danger.btn-small:hover {
    background: rgba(220, 53, 69, 0.15);
    border-color: var(--error-color);
    color: #c82333;
}
.form-group textarea {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9375rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
    width: 100%;
    font-family: inherit;
    resize: vertical;
    min-height: 200px;
}
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}
.form-group textarea.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}
/* 响应式优化 */
@media (max-width: 768px) {
    .mcp-management-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
        max-height: none;
    }

    .mcp-management-panel {
        min-height: 0;
    }

    .mcp-tools-panel .tools-list,
    .mcp-external-panel .external-mcp-list {
        min-height: 200px;
        max-height: 52vh;
    }

    .tools-actions {
        gap: 6px;
    }
    
    .tools-actions button {
        padding: 6px 12px;
        font-size: 0.8125rem;
    }
    
    .search-box {
        min-width: 100px;
    }
    
    .search-box input {
        font-size: 0.8125rem;
        padding: 6px 10px;
    }
    
    .btn-search {
        padding: 6px 12px;
        min-width: 36px;
    }
    
    .page-size-selector {
        font-size: 0.75rem;
    }
    
    .page-size-selector select {
        padding: 4px 8px;
        font-size: 0.75rem;
        min-width: 50px;
    }
    
    .tools-stats {
        padding: 4px 8px;
        font-size: 0.7rem;
        gap: 8px;
    }
    
    .tools-stats span {
        gap: 4px;
    }
    
    .external-mcp-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .external-mcp-stats {
        margin-left: 0;
        width: 100%;
        justify-content: space-around;
    }
    
    .external-mcp-item-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .external-mcp-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .external-mcp-item-details {
        grid-template-columns: 1fr;
    }
}
.attack-chain-filters button.btn-secondary {
    padding: 7px 16px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1.5px solid rgba(15, 23, 42, 0.1);
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    white-space: nowrap;
}
.attack-chain-filters button.btn-secondary:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(59, 130, 246, 0.06) 100%);
    border-color: #6366f1;
    color: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.18);
}
.modal-header {
    padding: 16px 22px !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07) !important;
    background:
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    flex-shrink: 0;
    position: relative;
}
.modal-header::after {
    content: '';
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(99, 102, 241, 0.25) 50%, transparent 100%);
    pointer-events: none;
}
.modal-header h2 {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.3px !important;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.modal-header h2::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 22px;
    border-radius: 3px;
    background: linear-gradient(180deg, #3b82f6 0%, #6366f1 60%, #a855f7 100%);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
    -webkit-text-fill-color: initial;
}
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        margin-top: 0;
    }
    to {
        opacity: 1;
        max-height: 1500px;
        padding-top: 20px;
        margin-top: 8px;
    }
}
.attack-chain-action-btn.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow:
        0 4px 14px rgba(99, 102, 241, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}
.attack-chain-action-btn.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 50%, #7c3aed 100%) !important;
    box-shadow:
        0 10px 22px rgba(99, 102, 241, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}
.attack-chain-action-btn.btn-secondary {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    color: #334155 !important;
    border-color: rgba(15, 23, 42, 0.1) !important;
}
.attack-chain-action-btn.btn-secondary:hover {
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%) !important;
    border-color: #6366f1 !important;
    color: #4338ca !important;
}
.modal-header-actions .modal-close {
    user-select: none;
}
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    font-size: 0.9375rem;
    font-weight: 500;
    position: relative;
    z-index: 2;
}
.attack-chain-container .loading-spinner::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 10px;
    border-radius: 50%;
    border: 2.5px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    animation: ac-spin 0.9s linear infinite;
}
@keyframes ac-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.custom-select.open .custom-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}
.custom-select.open .custom-select-trigger svg {
    transform: rotate(180deg);
}
.custom-select.open .custom-select-dropdown {
    display: block;
}
.custom-select-option.selected {
    background: var(--accent-color);
    color: white;
}
.custom-select-option.selected:hover {
    background: var(--accent-hover);
}
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 0.9375rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
}
/* 响应式设计 */
@media (max-width: 768px) {
    .knowledge-items-grid {
        grid-template-columns: 1fr;
    }
    
    .knowledge-stats-bar {
        flex-direction: column;
        gap: 12px;
    }
    
    .knowledge-stat-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .knowledge-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .knowledge-filters select {
        min-width: 100%;
    }
    
    .retrieval-stats-bar {
        flex-direction: column;
        gap: 12px;
    }
    
    .retrieval-stat-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .retrieval-logs-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .retrieval-logs-filters label {
        min-width: 100%;
    }
    
    .retrieval-log-details-grid {
        grid-template-columns: 1fr;
    }
    
    .retrieval-log-card-header {
        flex-wrap: wrap;
    }
    
    .retrieval-log-result-badge {
        width: 100%;
        text-align: center;
    }
}
/* 旋转动画 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
.conversation-sort-option.is-selected {
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-color);
    font-weight: 500;
}
.conversation-sort-option.is-selected:hover {
    background: rgba(0, 102, 255, 0.12);
}
.conversation-sort-option.is-selected .conversation-sort-option-icon {
    background: rgba(0, 102, 255, 0.12);
    color: var(--accent-color);
    box-shadow: inset 0 0 0 1px rgba(0, 102, 255, 0.16);
}
.conversation-sort-option.is-selected .conversation-sort-option-check {
    opacity: 1;
}
.batch-manage-modal-content .conversation-project-filter-ui.open {
    z-index: 400;
}
.context-menu-item-has-submenu .submenu-arrow {
    width: 12px;
    height: 12px;
    margin-left: auto;
}
.tasks-filters {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 16px;
}
.tasks-filters label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}
.tasks-filters select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-width: 150px;
    cursor: pointer;
    transition: all 0.2s;
}
.tasks-filters select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}
.tasks-filters select:hover {
    border-color: var(--accent-color);
}
.tasks-filters input[type="text"] {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    width: 200px;
    transition: all 0.2s;
}
.tasks-filters input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}
.tasks-filters input[type="text"]:hover {
    border-color: var(--accent-color);
}
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
@media (max-width: 768px) {
    .tasks-stats-bar {
        flex-direction: column;
        gap: 12px;
    }
    
    .task-stat-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .tasks-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tasks-filters select {
        min-width: 100%;
    }

    .batch-queues-filters.tasks-filters.batch-queues-filters--compact {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .batch-queues-filters.tasks-filters.batch-queues-filters--compact select {
        min-width: 120px;
        width: auto;
    }

    .batch-queues-filters__search {
        flex: 1 1 100%;
    }
    
    .tasks-batch-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-header-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .task-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .task-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    
    .task-duration {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
}
.batch-queues-board #batch-queues-pagination .monitor-pagination {
    margin-top: 0;
}
.batch-queues-filters.tasks-filters {
    margin-bottom: 12px;
}
/* 任务管理 · 筛选条：标签与控件同一行，降低占用高度 */
.batch-queues-filters.tasks-filters.batch-queues-filters--compact {
    padding: 8px 12px;
    margin-bottom: 10px;
    gap: 10px 16px;
    align-items: center;
}
.batch-queues-filters.tasks-filters.batch-queues-filters--compact label {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}
.batch-queues-filters.tasks-filters.batch-queues-filters--compact label > span {
    flex-shrink: 0;
    font-size: 0.8125rem;
    max-width: 9em;
    line-height: 1.25;
}
.batch-queues-filters.tasks-filters.batch-queues-filters--compact select {
    min-width: 120px;
    padding: 6px 10px;
    font-size: 0.8125rem;
}
.batch-queues-filters.tasks-filters.batch-queues-filters--compact .tasks-filter-select-ui {
    position: relative;
    min-width: 120px;
}
.tasks-filter-select-ui.open .tasks-filter-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}
.tasks-filter-select-ui.open {
    z-index: 120;
}
.tasks-filter-select-ui.open .tasks-filter-select-caret {
    transform: rotate(180deg);
}
.tasks-filter-select-ui.open .tasks-filter-select-dropdown {
    display: block;
}
.tasks-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}
.tasks-filter-select-option.is-selected .tasks-filter-select-check {
    visibility: visible;
}
.tasks-filter-select-ui.is-disabled .tasks-filter-select-trigger {
    opacity: 0.6;
    cursor: not-allowed;
}
.batch-queues-filters.tasks-filters.batch-queues-filters--compact input[type="text"] {
    padding: 6px 10px;
    font-size: 0.8125rem;
    min-width: 0;
}
@media (max-width: 520px) {
    .batch-queue-item__band-right {
        margin-left: 0;
        flex-basis: 100%;
    }

    .batch-queue-progress-meta--band {
        text-align: left;
    }

    .batch-queue-progress-meta--band .batch-queue-progress-note {
        text-align: left;
    }
}
@media (max-width: 520px) {
    .bq-kv,
    .bq-kv--block {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}
/* 批量队列详情弹窗：标题很长时避免挤压右侧按钮 */
#batch-queue-detail-modal .modal-header {
    align-items: flex-start;
    gap: 12px;
}
#batch-queue-detail-modal .modal-header > div {
    flex-shrink: 0;
}
.batch-task-header .btn-small {
    margin-left: 0;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .batch-queue-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .batch-queue-item__inner--grid {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "lead actions"
            "cluster cluster"
            "progress progress";
        row-gap: 8px;
    }

    .batch-queue-item--no-actions .batch-queue-item__inner--grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "lead"
            "cluster"
            "progress";
    }

    .batch-queue-item__cluster {
        align-items: flex-start;
        text-align: left;
        max-width: none;
        justify-self: stretch;
    }

    .batch-queue-item__status-inline {
        justify-content: flex-start;
        width: 100%;
    }

    .batch-queue-item__inner--grid .batch-queue-item__pct {
        text-align: left;
    }

    .batch-queue-item__idline--lead {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .batch-queue-item__top {
        flex-wrap: wrap;
        gap: 8px 10px;
    }

    .batch-queue-item__mid {
        flex-direction: column;
        align-items: stretch;
    }

    .batch-queue-item__mid-right {
        flex: 1 1 auto;
        max-width: none;
    }

    .batch-queue-item__pct {
        text-align: left;
    }

    .batch-queue-card-row {
        flex-direction: column;
    }

    .batch-queue-side {
        flex-basis: auto;
        width: 100%;
        align-items: stretch;
    }

    .batch-queue-delete-btn {
        align-self: flex-end;
    }

    .batch-queue-progress-stack {
        min-width: 0;
    }

    .batch-queue-progress {
        width: 100%;
    }

    .batch-queue-stats {
        flex-direction: column;
        gap: 8px;
    }

    .batch-queue-stats--pills {
        justify-content: flex-start;
    }
    
    .batch-task-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
/* 漏洞管理页面样式 */
.page-header-actions .btn-secondary.btn-delete {
    color: var(--error-color, #dc3545);
}
.page-header-actions .btn-secondary.btn-delete:hover {
    color: #c82333;
    border-color: rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.06);
}
@media (max-width: 1200px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 640px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-card-total {
        grid-column: 1 / -1;
    }
}
.stat-card.is-clickable:hover:not(.is-active) {
    border-color: rgba(59, 130, 246, 0.35);
}
/* 选中态：浅底 + 外发光 ring，避免深色描边过硬 */
.stat-card.is-clickable.is-active {
    transform: none;
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: var(--shadow-sm), 0 0 0 2px rgba(59, 130, 246, 0.14);
    background: rgba(59, 130, 246, 0.06);
}
.stat-card.stat-card-total.is-active {
    border-color: rgba(148, 163, 184, 0.5);
    box-shadow: var(--shadow-sm), 0 0 0 2px rgba(148, 163, 184, 0.18);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}
.stat-card.stat-card-total.is-active .stat-label {
    color: #475569;
    font-weight: 600;
}
.stat-card.stat-critical.is-active {
    border-color: rgba(220, 38, 38, 0.35);
    box-shadow: var(--shadow-sm), 0 0 0 2px rgba(220, 38, 38, 0.12);
    background: rgba(254, 242, 242, 0.65);
}
.stat-card.stat-high.is-active {
    border-color: rgba(234, 88, 12, 0.35);
    box-shadow: var(--shadow-sm), 0 0 0 2px rgba(234, 88, 12, 0.12);
    background: rgba(255, 247, 237, 0.75);
}
.stat-card.stat-medium.is-active {
    border-color: rgba(202, 138, 4, 0.4);
    box-shadow: var(--shadow-sm), 0 0 0 2px rgba(202, 138, 4, 0.12);
    background: rgba(254, 252, 232, 0.75);
}
.stat-card.stat-low.is-active {
    border-color: rgba(15, 118, 110, 0.35);
    box-shadow: var(--shadow-sm), 0 0 0 2px rgba(15, 118, 110, 0.12);
    background: rgba(240, 253, 250, 0.75);
}
.stat-card.stat-info.is-active {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: var(--shadow-sm), 0 0 0 2px rgba(37, 99, 235, 0.12);
    background: rgba(239, 246, 255, 0.75);
}
.webshell-resize-handle.active {
    background: var(--accent-color);
}
.webshell-item.active {
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.08) 0%, rgba(0, 102, 255, 0.04) 100%);
    border-color: var(--accent-color);
    box-shadow: 0 2px 12px rgba(0, 102, 255, 0.12);
}
#webshell-modal .webshell-form-select-ui.open .webshell-form-select-trigger {
    border-color: var(--primary-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}
#webshell-modal .webshell-form-select-ui.open .webshell-form-select-caret {
    opacity: .9;
    transform: translateY(2px) rotate(225deg);
}
#webshell-modal .webshell-form-select-ui.open {
    z-index: 5201;
}
#webshell-modal .webshell-form-select-ui.open .webshell-form-select-dropdown {
    display: block;
}
#webshell-modal .webshell-form-select-option.is-selected {
    background: rgba(59, 130, 246, .14);
    color: var(--primary-color, #2563eb);
}
#webshell-modal .webshell-form-select-option.is-selected .webshell-form-select-check {
    visibility: visible;
}
.webshell-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    background: transparent;
}
.webshell-pane.active {
    display: flex;
    width: 100%;
}
.webshell-terminal-session.active {
    background: #0d1117;
    border-color: rgba(88, 166, 255, 0.45);
    color: #e6edf3;
}
#webshell-pane-terminal {
    flex-direction: column;
}
.webshell-tree-row.active {
    background: rgba(0, 102, 255, 0.11);
}
.webshell-tree-row.active .webshell-dir-item {
    color: var(--accent-color);
    font-weight: 600;
}
.webshell-file-toolbar input.form-control {
    min-width: 0;
    flex: 1;
    max-width: 480px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.webshell-file-toolbar .btn-secondary {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
@media (max-width: 1200px) {
    .webshell-file-layout {
        flex-direction: column;
    }

    .webshell-file-sidebar {
        width: 100%;
        min-width: 0;
        max-width: none;
        max-height: 220px;
    }
}
.webshell-file-edit-actions .btn-primary {
    min-width: 72px;
}
/* WebShell AI 助手 Tab：仅在此 pane 激活时显示；左右布局 = 左侧栏 + 右侧主区（与对话页一致） */
#webshell-pane-ai {
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.webshell-ai-conv-item.active {
    background: var(--accent-light, rgba(59, 130, 246, 0.1));
    border-left-color: var(--accent-color);
}
/* RBAC workspace: task-oriented member and role management */
.rbac-workspace-nav {
    display: flex;
    gap: 4px;
    width: fit-content;
    margin-bottom: 12px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
}
.rbac-workspace-tab {
    min-width: 210px;
    padding: 9px 14px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
}
.rbac-workspace-tab span,
.rbac-workspace-tab small { display: block; }
.rbac-workspace-tab span { font-size: 0.875rem; font-weight: 650; }
.rbac-workspace-tab small { margin-top: 2px; color: var(--text-muted); font-size: 0.71875rem; }
.rbac-workspace-tab:hover { color: var(--text-primary); }
.rbac-workspace-tab.is-active {
    color: var(--primary-color, #2563eb);
    background: var(--bg-primary);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.rbac-workspace-view[hidden] { display: none !important; }
#rbac-role-save-btn[hidden] { display: none !important; }
/* display:flex 等会覆盖 [hidden] 默认 display:none，权限控件须强制隐藏 */
[data-require-permission][hidden],
[data-require-permission-any][hidden] {
    display: none !important;
}
.rbac-user-row.is-active { box-shadow: inset 3px 0 0 var(--primary-color, #2563eb); }
.rbac-role-card.is-selected {
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.035);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}
.rbac-pill.is-info { color: #1d4ed8; border-color: rgba(37, 99, 235, 0.24); background: rgba(37, 99, 235, 0.08); }
.rbac-pill.is-warn { color: #9a3412; border-color: rgba(234, 88, 12, 0.24); background: rgba(234, 88, 12, 0.08); }
.rbac-pill.is-custom { color: #6d28d9; border-color: rgba(109, 40, 217, 0.2); background: rgba(109, 40, 217, 0.07); }
.rbac-assignment-help,
.rbac-field-hint {
    margin: 0 0 12px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.5;
}
.rbac-field-hint { margin: 6px 0 0; }
.rbac-role-management {
    min-height: 500px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
}
.rbac-role-management-head,
.rbac-role-management-actions,
.rbac-catalog-card-head,
.rbac-catalog-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.rbac-role-management-head { padding-bottom: 16px; border-bottom: 1px solid var(--border-color); }
.rbac-role-management-head h3,
.rbac-catalog-card h4 { margin: 0; }
.rbac-role-management-actions .form-input { width: min(280px, 32vw); min-height: 36px; }
.rbac-role-catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
    padding-top: 16px;
}
.rbac-catalog-card {
    min-width: 0;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: var(--bg-primary);
}
.rbac-catalog-card-head { align-items: flex-start; }
.rbac-catalog-card-head p { margin: 5px 0 0; color: var(--text-secondary); font-size: 0.8125rem; line-height: 1.45; }
.rbac-catalog-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 12px; }
.rbac-catalog-stats div { min-width: 0; padding: 9px; border-radius: 7px; background: var(--bg-secondary); }
.rbac-catalog-stats strong,
.rbac-catalog-stats span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rbac-catalog-stats strong { color: var(--text-primary); font-size: 0.9375rem; }
.rbac-catalog-stats span { margin-top: 3px; color: var(--text-secondary); font-size: 0.6875rem; }
.rbac-module-tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.rbac-module-tags span {
    padding: 3px 7px;
    border-radius: 5px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.6875rem;
}
.rbac-catalog-card-foot { align-items: flex-end; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-color); }
.rbac-catalog-card-foot > span { color: var(--text-secondary); font-size: 0.75rem; }
.rbac-catalog-card-foot > div { display: flex; flex-shrink: 0; gap: 6px; }
.rbac-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 160px;
    padding: 24px;
    color: var(--text-secondary);
    text-align: center;
}
.rbac-empty strong { color: var(--text-primary); font-size: 0.875rem; }
.rbac-empty span { font-size: 0.75rem; }
.rbac-role-option-text,
.rbac-permission-option { min-width: 0; }
.rbac-role-option-text strong,
.rbac-role-option-text small,
.rbac-permission-option strong,
.rbac-permission-option code { display: block; }
.rbac-role-option-text small,
.rbac-permission-option code { margin-top: 3px; color: var(--text-secondary); font-size: 0.6875rem; }
.rbac-permission-option strong { font-size: 0.75rem; font-weight: 550; line-height: 1.35; }
.rbac-permission-option code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 980px) {
    .rbac-workspace-nav { width: 100%; }
    .rbac-workspace-tab { flex: 1; min-width: 0; }
    .rbac-role-management-head { align-items: flex-start; flex-direction: column; }
    .rbac-role-management-actions,
    .rbac-role-management-actions .form-input { width: 100%; }
}
.webshell-ai-process-block .process-details-content .progress-timeline.expanded {
    max-height: 2000px;
    overflow-x: hidden;
    overflow-y: auto;
}
/* 展开后才把宽度撑满；未展开时保持折叠按钮“缩回去”的视觉 */
.webshell-ai-process-block.process-details-container:has(.progress-timeline.expanded) {
    width: 100%;
    max-width: 80%;
    align-self: flex-start;
}
.webshell-ai-process-block.process-details-container:has(.progress-timeline.expanded) .webshell-ai-process-toggle {
    width: 100%;
}
.webshell-ai-process-block.process-details-container:has(.progress-timeline.expanded) .process-details-content .progress-timeline {
    width: 100%;
}
.webshell-ai-process-block.process-details-container:has(.progress-timeline.expanded) .webshell-ai-timeline {
    width: 100%;
}
.webshell-ai-input-row .btn-primary {
    flex-shrink: 0;
    height: 36px;
    min-width: 72px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.webshell-db-profile-tab.active {
    border-color: rgba(0, 102, 255, 0.36);
    box-shadow: 0 0 0 1px rgba(0, 102, 255, 0.12);
}
.webshell-db-profile-tab.active .webshell-db-profile-main {
    color: var(--text-primary);
    font-weight: 600;
}
#webshell-db-profile-modal .modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    box-shadow: none;
}
#webshell-db-profile-modal .modal-header h2 {
    font-size: 1.08rem;
    font-weight: 600;
    background: none;
    -webkit-text-fill-color: currentColor;
    color: #0f172a;
}
#webshell-db-profile-modal .modal-body {
    padding: 14px 18px 10px;
}
#webshell-db-profile-modal .modal-footer {
    padding: 10px 18px 14px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
}
#webshell-db-profile-modal .modal-footer .btn-secondary,
#webshell-db-profile-modal .modal-footer .btn-primary {
    min-width: 78px;
    height: 36px;
    border-radius: 8px;
}
.webshell-db-toolbar .form-control {
    height: 34px;
    border-radius: 7px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: #fff;
    font-size: 0.88rem;
    padding-left: 10px;
    padding-right: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.webshell-db-toolbar .form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
    background: #fff;
}
.webshell-db-toolbar select.form-control {
    appearance: auto;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    padding-right: 8px;
    background-image: none;
}
#webshell-db-sqlite-row {
    grid-column: 1 / -1;
}
.webshell-db-actions .btn-primary {
    min-width: 96px;
    height: 34px;
    border-radius: 8px;
}
@media (max-width: 700px) {
#webshell-db-profile-modal .modal-content {
        width: calc(100% - 24px);
        margin: 32px auto;
    }
#webshell-db-profile-modal .modal-header,
#webshell-db-profile-modal .modal-body,
#webshell-db-profile-modal .modal-footer {
        padding-left: 14px;
        padding-right: 14px;
    }
}
.dashboard-page .page-header {
    flex-shrink: 0;
    padding: 12px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    background: #ffffff;
    box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
}
.dashboard-page .page-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}
@media (max-width: 1200px) {
    .dashboard-kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .dashboard-kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .dashboard-kpi-row { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .dashboard-access-strip { grid-template-columns: 1fr; }
    .dashboard-access-strip--webshell { grid-template-columns: 1fr; }
}
.dashboard-kpi-sub-text.is-success { color: #15803d; }
.dashboard-kpi-sub-text.is-danger { color: #dc2626; }
.dashboard-alert-banner.is-danger {
    --dashboard-alert-accent: #ef4444;
    --dashboard-alert-accent-soft: rgba(239, 68, 68, 0.07);
    --dashboard-alert-accent-border: rgba(239, 68, 68, 0.18);
}
.dashboard-resource-health.is-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}
@media (max-width: 720px) {
    .dashboard-alert-banner {
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 14px;
    }
    .dashboard-alert-actions {
        width: 100%;
        padding-left: 52px;
    }
    .dashboard-alert-close {
        position: absolute;
        top: 10px;
        right: 10px;
    }
    .dashboard-alert-content {
        padding-right: 28px;
    }
    .dashboard-recommend-list {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
.dashboard-severity-status-filter-option.is-active {
    background: rgba(0, 102, 255, 0.075);
    color: #1d4ed8;
}
.dashboard-severity-status-filter-option.is-active::before {
    opacity: 1;
}
@media (max-width: 640px) {
    .dashboard-section-actions {
        width: 100%;
        justify-content: space-between;
    }
    .dashboard-section-header--severity {
        flex-wrap: wrap;
    }
    .dashboard-severity-status-filter-btn {
        min-width: 124px;
    }
    .dashboard-severity-status-filter-menu {
        left: auto;
        right: 0;
    }
}
.dashboard-feed-tab.is-active {
    color: #0066ff;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
@media (max-width: 900px) {
    .dashboard-recent-fact-item {
        grid-template-columns: 20px 64px minmax(0, 1fr) minmax(0, 0.8fr) 72px 8.25rem;
    }
    .dashboard-recent-fact-conf { display: none; }
}
@media (max-width: 720px) {
    .dashboard-recent-fact-item {
        grid-template-columns: 20px 64px minmax(0, 1fr) 72px auto;
    }
    .dashboard-recent-fact-key { display: none; }
}
@media (max-width: 480px) {
    .dashboard-recent-fact-item {
        grid-template-columns: 20px 72px minmax(0, 1fr) auto;
    }
    .dashboard-recent-fact-cat { display: none; }
    .dashboard-recent-fact-time { display: none; }
}
@media (max-width: 720px) {
    .dashboard-recent-vuln-item {
        grid-template-columns: 56px minmax(0, 1fr) auto 8.25rem;
    }
    .dashboard-recent-vuln-target { display: none; }
}
@media (max-width: 480px) {
    .dashboard-recent-vuln-item {
        grid-template-columns: 56px minmax(0, 1fr) auto;
    }
    .dashboard-recent-vuln-time { display: none; }
}
/* 响应式优化 */
@media (max-width: 768px) {
    .dashboard-overview-stats {
        gap: 12px;
    }
    
    .dashboard-overview-value-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .dashboard-overview-value-separator {
        display: none;
    }
}
@media (max-width: 1100px) {
    .dashboard-severity-wrap {
        grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
        gap: 24px;
    }
    .dashboard-severity-insights {
        grid-column: 1 / -1;
        flex-direction: row;
        gap: 16px;
    }
    .dashboard-severity-insights > * {
        flex: 1 1 0;
        min-width: 0;
    }
}
@media (max-width: 820px) {
    .dashboard-severity-wrap {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }
    .dashboard-severity-insights {
        flex-direction: column;
        gap: 12px;
    }
}
.dashboard-severity-donut .donut-segment-gloss.is-active {
    opacity: 0.72;
}
.dashboard-severity-donut .donut-segment.is-active {
    /* 不用 scale / stroke-width，防止命中区抖动 */
    z-index: 1;
}
.dashboard-severity-donut[data-hover-severity="critical"] .donut-segment.is-active {
    filter: url(#donut-segment-soften) drop-shadow(0 0 28px rgba(239, 68, 68, 0.55)) drop-shadow(0 10px 26px rgba(239, 68, 68, 0.28));
}
.dashboard-severity-donut[data-hover-severity="high"] .donut-segment.is-active {
    filter: url(#donut-segment-soften) drop-shadow(0 0 26px rgba(249, 115, 22, 0.52)) drop-shadow(0 10px 24px rgba(249, 115, 22, 0.26));
}
.dashboard-severity-donut[data-hover-severity="medium"] .donut-segment.is-active {
    filter: url(#donut-segment-soften) drop-shadow(0 0 26px rgba(234, 179, 8, 0.48)) drop-shadow(0 10px 22px rgba(202, 138, 4, 0.22));
}
.dashboard-severity-donut[data-hover-severity="low"] .donut-segment.is-active {
    filter: url(#donut-segment-soften) drop-shadow(0 0 26px rgba(45, 212, 191, 0.48)) drop-shadow(0 10px 22px rgba(13, 148, 136, 0.22));
}
.dashboard-severity-donut[data-hover-severity="info"] .donut-segment.is-active {
    filter: url(#donut-segment-soften) drop-shadow(0 0 26px rgba(59, 130, 246, 0.48)) drop-shadow(0 10px 22px rgba(37, 99, 235, 0.22));
}
.dashboard-severity-donut .donut-leader.is-active {
    stroke: rgba(71, 85, 105, 0.95);
    stroke-width: 2;
}
.dashboard-severity-donut .donut-label-text.is-active {
    font-weight: 800;
    transform: translateY(-2px);
}
@media (prefers-reduced-motion: reduce) {
    .dashboard-severity-chart::before {
        animation: none;
    }
    .dashboard-severity-donut.donut-ready .donut-segment,
    .dashboard-severity-donut.donut-ready .donut-leader,
    .dashboard-severity-donut.donut-ready .donut-label-text {
        animation: none !important;
    }
    .dashboard-severity-center.is-hovering {
        transform: translateX(-50%);
    }
}
@media (max-width: 720px) {
    .dashboard-severity-center-value { font-size: 2.1rem; }
    .dashboard-severity-center-label { font-size: 0.6875rem; }
}
.dashboard-severity-legend-item.is-active {
    background: rgba(0, 102, 255, 0.06);
    border-radius: 8px;
}
.dashboard-severity-legend-item.is-active {
    box-shadow: inset 3px 0 0 var(--accent-color, #0066ff);
}
@media (max-width: 900px) {
    .dashboard-severity-status {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
}
@media (max-width: 1180px) {
    .dashboard-severity-status-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px;
    }
}
@media (max-width: 480px) {
    .dashboard-severity-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 1180px) {
    .dashboard-severity-status-cell {
        min-height: 58px;
        padding: 12px 6px 8px;
    }

    .dashboard-severity-status-label {
        font-size: 0.71875rem;
    }

    .dashboard-severity-status-value {
        font-size: 1.125rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .dashboard-severity-status-cell { transition: none; }
    .dashboard-severity-progress-fixed,
    .dashboard-severity-progress-confirmed { transition: none; }
}
@media (max-width: 1000px) {
    .dashboard-quick-links:not(.dashboard-quick-links-row) {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .dashboard-quick-links:not(.dashboard-quick-links-row) {
        grid-template-columns: 1fr;
    }
}
/* 尊重用户“减少动效”偏好（无障碍最佳实践） */
@media (prefers-reduced-motion: reduce) {
    .dashboard-kpi-card,
    .dashboard-overview-item,
    .dashboard-quick-link,
    .dashboard-cta-btn {
        transition: none;
    }
    .dashboard-kpi-card:hover,
    .dashboard-overview-item:hover {
        transform: none;
    }
    .dashboard-quick-link:hover {
        transform: none;
    }
    .dashboard-cta-btn:hover {
        transform: none;
    }
    .dashboard-cta-btn:hover .dashboard-cta-btn-arrow {
        transform: none;
    }
    .dashboard-cta-btn-arrow {
        transition: none;
    }
    .dashboard-tools-bar-fill {
        animation: none;
    }
    .dashboard-severity-donut .donut-segment {
        transition: none;
    }
}
.vulnerability-more-filters-btn.is-active {
    border-color: #3b82f6;
    color: #2563eb;
    background: rgba(59, 130, 246, 0.06);
}
@media (max-width: 520px) {
    .vulnerability-more-filters-popover-body {
        grid-template-columns: 1fr;
    }

    .vulnerability-more-filters-popover {
        right: auto;
        left: 0;
    }
}
.vuln-filter-select.open .vuln-filter-select-trigger {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.vuln-filter-select.open {
    z-index: 120;
}
.vuln-filter-select.open .vuln-filter-select-caret {
    transform: rotate(180deg);
}
.vuln-filter-select.open .vuln-filter-select-dropdown {
    display: block;
}
.vuln-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}
.vuln-filter-select-option.is-selected .vuln-filter-select-check {
    opacity: 1;
}
.vuln-filter-select.is-disabled .vuln-filter-select-trigger {
    opacity: 0.55;
    cursor: not-allowed;
}
@media (max-width: 768px) {
    .vulnerability-filter-primary {
        flex-direction: column;
        align-items: stretch;
    }

    .vulnerability-filter-field--grow,
    .vulnerability-filter-field--status {
        flex: 1 1 100%;
    }

    .vulnerability-filter-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .vulnerability-filter-clear-btn {
        margin-left: auto;
    }
}
.vuln-detail-select-ui.open .vuln-detail-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.vuln-detail-select-ui.open {
    z-index: 120;
}
.vuln-detail-select-ui.open .vuln-detail-select-caret {
    transform: rotate(180deg);
}
.vuln-detail-select-ui.open .vuln-detail-select-dropdown {
    display: block;
}
.vuln-detail-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}
.vuln-detail-select-option.is-selected .vuln-detail-select-check {
    opacity: 1;
}
.vuln-detail-select-ui.is-disabled .vuln-detail-select-trigger {
    opacity: 0.55;
    cursor: not-allowed;
}
.vuln-status-picker.open {
    z-index: 120;
}
.vuln-status-picker.open .vuln-status-picker-caret {
    transform: rotate(180deg);
}
.vuln-status-picker.open .vuln-status-picker-trigger {
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.12);
}
.vuln-status-picker.is-disabled .vuln-status-picker-trigger {
    opacity: 0.65;
    cursor: wait;
    pointer-events: none;
}
.vuln-status-picker-option.is-selected {
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-color);
    font-weight: 500;
}
.vuln-status-picker-option.is-selected .vuln-status-picker-check {
    opacity: 1;
}
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 5000px;
    }
}
@media (max-width: 768px) {
    .vulnerability-details {
        grid-template-columns: 1fr;
    }

    .vulnerability-details .vuln-detail-field:last-child:nth-child(odd) {
        grid-column: auto;
    }
}
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
    font-size: 1rem;
}
/* ==================== 攻击链可视化响应式样式 ==================== */
@media (max-width: 1200px) {
    .attack-chain-modal-content {
        width: 98vw;
        height: 92vh;
        max-height: 92vh;
    }
    
    .attack-chain-sidebar {
        width: 240px;
    }
    
    .attack-chain-toolbar {
        padding: 10px 12px;
        gap: 12px;
    }
    
    .attack-chain-filters {
        gap: 6px;
    }
    
    .attack-chain-filters input[type="text"] {
        min-width: 150px;
        max-width: 250px;
    }
    
    .attack-chain-container {
        margin: 10px;
    }
}
@media (max-width: 768px) {
    .attack-chain-modal-content {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .attack-chain-main-layout {
        flex-direction: column;
    }
    
    .attack-chain-sidebar {
        width: 100%;
        max-height: 200px;
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        order: 2;
    }
    
    .attack-chain-visualization-area {
        order: 1;
    }
    
    .attack-chain-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px 12px;
    }
    
    .attack-chain-info {
        text-align: center;
        width: 100%;
    }
    
    .attack-chain-filters {
        flex-direction: column;
        width: 100%;
    }
    
    .attack-chain-filters input[type="text"],
    .attack-chain-filters select,
    .attack-chain-filters button {
        width: 100%;
        min-width: auto;
        max-width: none;
    }
    
    .attack-chain-legend {
        flex-direction: row;
        gap: 16px;
        padding: 12px;
        overflow-x: auto;
    }
    
    .legend-section {
        min-width: 160px;
        flex-shrink: 0;
    }
    
    .attack-chain-details {
        min-width: 200px;
        flex-shrink: 0;
    }
    
    .attack-chain-details-content {
        max-height: 400px;
    }
    
    .attack-chain-container {
        margin: 8px;
        border-radius: 10px;
    }
    
    .attack-chain-details {
        margin: 0 8px 8px 8px;
        border-radius: 10px;
        padding: 12px 16px;
    }
    
    .modal-header {
        padding: 12px 16px !important;
    }
    
    .modal-header h2 {
        font-size: 1.125rem !important;
    }
    
    .modal-header-actions {
        flex-direction: column;
        width: 100%;
        gap: 6px;
    }

    /* 批量队列详情弹窗：即使在窄屏也保持按钮不“变形” */
    #batch-queue-detail-modal .modal-header-actions {
        flex-direction: row;
        width: auto;
        gap: 8px;
    }
    
    .attack-chain-action-btn {
        width: 100%;
        justify-content: center;
        padding: 7px 14px !important;
        font-size: 0.8125rem !important;
    }
}
.role-selector-btn.active {
    background: #f0f2f5;
    border-color: rgba(0, 102, 255, 0.4);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.12);
}
.role-selector-btn.active .role-selector-arrow {
    transform: rotate(180deg);
    color: rgba(0, 102, 255, 0.8);
}
.agent-mode-option.selected .agent-mode-check {
    display: flex !important;
}
.role-selection-item-main.selected {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.12) 0%, rgba(138, 43, 226, 0.06) 100%);
    border-color: rgba(138, 43, 226, 0.4);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.15), 0 0 0 1px rgba(138, 43, 226, 0.1);
}
.role-selection-item-main.selected .role-selection-item-icon-main {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.2) 0%, rgba(138, 43, 226, 0.12) 100%);
    border-color: rgba(138, 43, 226, 0.3);
    box-shadow: 0 2px 6px rgba(138, 43, 226, 0.2);
}
.role-selection-item-main.selected .role-selection-item-icon-main.agent-mode-logo {
    width: 28px;
    height: 28px;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}
.role-selection-item-main.selected .role-selection-item-name-main {
    color: #6a1bb2;
    font-weight: 600;
}
.role-selection-item-main.selected .role-selection-item-content-main {
    padding-right: 24px;
}
.role-selection-item-main.selected .role-selection-item-description-main {
    color: #8a5ab8;
}
.role-select-item.selected {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.1) 0%, rgba(138, 43, 226, 0.05) 100%);
    border-color: #8a2be2;
    box-shadow: 0 4px 16px rgba(138, 43, 226, 0.2), 0 2px 8px rgba(138, 43, 226, 0.15);
    transform: translateY(-2px);
}
.role-select-item.selected::before {
    opacity: 1;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.08) 0%, rgba(138, 43, 226, 0.03) 100%);
}
.role-select-item.selected::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 14px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8a2be2 0%, #6a1bb2 100%);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(138, 43, 226, 0.4);
}
.role-select-item.selected .role-select-item-icon {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.15) 0%, rgba(138, 43, 226, 0.08) 100%);
    border-color: rgba(138, 43, 226, 0.2);
    transform: scale(1.05);
}
.role-select-item.selected .role-select-item-name {
    color: #8a2be2;
}
.btn-small {
    padding: 6px 12px;
    font-size: 0.8125rem;
}
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}
.role-tools-pagination .pagination-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.role-tools-pagination .pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}
.role-tools-pagination .pagination-page {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 0 8px;
}
/* 角色选择面板响应式样式 */
@media (max-width: 768px) {
    .role-selection-panel,
    .agent-mode-panel {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        left: -8px;
        padding: 10px;
        border-radius: 14px;
        max-height: 60vh;
    }

    .role-selection-panel-header {
        margin-bottom: 10px;
        padding: 8px 4px 10px 4px;
    }

    .role-selection-panel-title {
        font-size: 0.875rem;
    }

    .role-selection-list-main {
        /* 在移动设备上限制显示8个角色，每个约60px，总计约480px */
        max-height: 480px;
        gap: 5px;
    }

    .role-selection-item-main {
        padding: 10px;
        gap: 10px;
    }

    .role-selection-item-icon-main {
        width: 32px;
        height: 32px;
        font-size: 1.125rem;
    }

    .role-selection-item-name-main {
        font-size: 0.8125rem;
    }

    .role-selection-item-description-main {
        font-size: 0.71875rem;
    }

    .agent-mode-option::before,
    .agent-mode-option::after {
        display: none;
    }

    .agent-mode-option:hover .role-selection-item-description-main,
    .agent-mode-option:focus-visible .role-selection-item-description-main {
        opacity: 1;
    }

    .agent-mode-option .role-selection-item-description-main {
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .selection-detail-tooltip {
        display: none;
    }
}
@media (max-width: 480px) {
    .role-selection-panel,
    .agent-mode-panel {
        width: calc(100vw - 8px);
        max-width: calc(100vw - 8px);
        left: -4px;
        padding: 8px;
        border-radius: 12px;
        max-height: 50vh;
    }

    .role-selection-list-main {
        /* 在小屏幕上限制显示8个角色，每个约55px，总计约450px */
        max-height: 450px;
        gap: 5px;
    }

    .role-selection-item-main {
        padding: 10px;
        gap: 10px;
        border-radius: 10px;
    }

    .role-selection-item-icon-main {
        width: 30px;
        height: 30px;
        font-size: 1.0625rem;
    }

    .role-selection-checkmark-main {
        width: 18px;
        height: 18px;
        font-size: 0.625rem;
        top: 8px;
        right: 8px;
    }
}
#agent-md-modal .form-select {
    width: 100%;
    max-width: 100%;
    padding: 8px 12px;
    font-size: 0.9375rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
}
/* 技能列表响应式布局优化 */
@media (max-width: 768px) {
    .skill-card {
        padding: 14px;
        gap: 12px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .skill-card-header {
        width: 100%;
    }
    
    .skill-card-actions {
        width: 100%;
        justify-content: flex-start;
    }
}
.skills-management-page .page-content {
    padding: 18px 22px 0;
    gap: 14px;
}
.skills-management-page .skill-card-actions .btn-secondary {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.66);
}
html[data-theme="dark"] .skills-management-page .skill-card-actions .btn-secondary {
    background: rgba(15, 23, 42, 0.72);
}
@media (max-width: 1100px) {
    .skills-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 768px) {
    .skills-management-page .page-content {
        padding: 14px 14px 0;
    }

    .skills-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .skills-overview-card {
        min-height: 68px;
        padding: 12px;
    }

    .skills-overview-card strong {
        font-size: 1.25rem;
    }

    .skills-management-page .skill-card {
        min-height: auto;
        align-items: flex-start;
    }

    .skill-card-body {
        grid-template-columns: 1fr;
    }

    .skills-management-page .skill-card-actions {
        grid-column: 1;
        grid-row: auto;
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}
@media (max-width: 520px) {
    .skills-overview {
        grid-template-columns: 1fr;
    }

    .skills-management-page .skill-card {
        grid-template-columns: 1fr;
    }

    .skill-card-title-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .skill-card-mark {
        width: 40px;
        height: 40px;
    }
}
/* Skills 管理：复用全局页面与列表规范，移除该页独有的渐变/悬浮视觉。 */
.skills-management-page .page-content {
    padding: 16px 20px 0;
    gap: 12px;
}
.skills-management-page .skill-card-actions .btn-secondary {
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--bg-primary);
}
html[data-theme="dark"] .skills-management-page .skill-card-actions .btn-secondary {
    background: var(--bg-primary);
    border-color: var(--border-color);
    box-shadow: none;
}
@media (max-width: 768px) {
    .skills-management-page .page-content {
        padding: 14px 14px 0;
    }

    .skills-management-page .skills-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .skills-management-page .skill-card-body {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .skills-management-page .skill-card-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}
@media (max-width: 520px) {
    .skills-management-page .skills-overview {
        grid-template-columns: 1fr;
    }
}
.skills-monitor-page .monitor-stat-value.is-success,
.skills-monitor-page .skills-table-number.is-success {
    color: var(--success-color);
}
.skills-monitor-page .monitor-stat-value.is-danger,
.skills-monitor-page .skills-table-number.is-danger {
    color: var(--error-color);
}
.info-collect-form .form-group {
    margin-bottom: 0;
}
/* 覆盖全局 .form-group textarea(min-height:200px) 的默认大留白 */
.form-group textarea.info-collect-query-input {
    min-height: 42px;
    max-height: 96px;
    overflow: hidden; /* 配合 JS 自动增高 */
    resize: none;
    padding: 11px 12px;
}
#page-info-collect input[type="text"],
#page-info-collect input[type="number"],
#page-info-collect select,
#page-info-collect textarea {
    border-radius: 8px;
}
#page-info-collect input:focus,
#page-info-collect textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
@media (max-width: 980px) {
    .info-collect-panel {
        padding: 14px;
    }
    .info-collect-form-top {
        grid-template-columns: 1fr;
    }
    .info-collect-form-row {
        grid-template-columns: 1fr;
    }
    .info-collect-nl-row,
    .info-collect-query-row {
        flex-direction: column;
        align-items: stretch;
    }
    .syntax-guide-header {
        flex-direction: column;
        gap: 6px;
    }
    .info-collect-col-actions {
        width: 140px;
    }
}
.info-collect-form-row .form-group {
    min-width: 0;
}
.info-collect-form-row #info-collect-full-option .checkbox-label {
    min-height: 40px;
    margin-top: -1px;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
}
@media (max-width: 640px) {
    .info-collect-cell-modal {
        align-items: flex-end;
        padding: 16px;
    }

    .info-collect-cell-modal-content {
        width: 100%;
        max-height: 82vh;
    }

    .info-collect-cell-modal-header {
        padding: 16px;
    }

    .info-collect-cell-modal-body {
        padding: 16px;
    }

    .info-collect-cell-modal-footer {
        padding: 12px 16px 16px;
    }
}

.info-collect-panel,
.info-collect-provider-card,
.info-collect-query-card,
.info-collect-options-card,
.info-collect-fields-card,
.info-collect-step-title,
.info-collect-step-title span,
.info-collect-inner-label,
.info-collect-provider-select .settings-custom-select-trigger,
.info-collect-provider-select .settings-custom-select-menu,
.info-collect-provider-select .settings-custom-select-option,
.info-collect-form-row #info-collect-full-option .checkbox-label,
.info-collect-results,
.info-collect-results-header,
.info-collect-selected,
.info-collect-results-title,
.info-collect-results-meta,
.info-collect-results-table-wrap,
.info-collect-table,
.info-collect-table th,
.info-collect-table td,
.info-collect-table .muted,
.info-collect-actions .btn-icon,
.info-collect-query-input,
.preset-chip,
.info-collect-link,
.info-collect-cell-text,
.info-collect-columns-panel,
.info-collect-columns-title,
.info-collect-col-item,
.info-collect-cell-modal,
.info-collect-cell-modal-content,
.info-collect-cell-modal-header,
.info-collect-cell-modal-title,
.info-collect-cell-modal-subtitle,
.info-collect-cell-modal-pre,
.info-collect-cell-modal-footer,
.info-collect-parse-warnings,
#page-info-collect input[type="text"],
#page-info-collect input[type="number"],
#page-info-collect select,
#page-info-collect textarea,
#page-info-collect .form-hint {
    transition:
        background 0.22s ease,
        background-color 0.22s ease,
        border-color 0.22s ease,
        color 0.22s ease,
        box-shadow 0.22s ease;
}
@media (prefers-reduced-motion: reduce) {
    .info-collect-panel,
    .info-collect-provider-card,
    .info-collect-query-card,
    .info-collect-options-card,
    .info-collect-fields-card,
    .info-collect-step-title,
    .info-collect-step-title span,
    .info-collect-inner-label,
    .info-collect-provider-select .settings-custom-select-trigger,
    .info-collect-provider-select .settings-custom-select-menu,
    .info-collect-provider-select .settings-custom-select-option,
    .info-collect-form-row #info-collect-full-option .checkbox-label,
    .info-collect-results,
    .info-collect-results-header,
    .info-collect-selected,
    .info-collect-results-title,
    .info-collect-results-meta,
    .info-collect-results-table-wrap,
    .info-collect-table,
    .info-collect-table th,
    .info-collect-table td,
    .info-collect-table .muted,
    .info-collect-actions .btn-icon,
    .info-collect-query-input,
    .preset-chip,
    .info-collect-link,
    .info-collect-cell-text,
    .info-collect-columns-panel,
    .info-collect-columns-title,
    .info-collect-col-item,
    .info-collect-cell-modal,
    .info-collect-cell-modal-content,
    .info-collect-cell-modal-header,
    .info-collect-cell-modal-title,
    .info-collect-cell-modal-subtitle,
    .info-collect-cell-modal-pre,
    .info-collect-cell-modal-footer,
    .info-collect-parse-warnings,
    .info-collect-parse-explanation,
    #page-info-collect input[type="text"],
    #page-info-collect input[type="number"],
    #page-info-collect select,
    #page-info-collect textarea,
    #page-info-collect .form-hint {
        transition: none;
    }
}
@media (max-width: 980px) {
    .info-collect-columns-list {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}
/* 对话附件文件管理 */
.chat-files-intro {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
    line-height: 1.5;
}
.chat-files-filter-select-ui.open .chat-files-filter-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}
.chat-files-filter-select-ui.open {
    z-index: 120;
}
.chat-files-filter-select-ui.is-disabled .chat-files-filter-select-trigger {
    opacity: 0.6;
    cursor: not-allowed;
}
.chat-files-filter-select-ui.open .chat-files-filter-select-caret {
    transform: rotate(180deg);
}
.chat-files-filter-select-ui.open .chat-files-filter-select-dropdown {
    display: block;
}
.chat-files-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}
.chat-files-filter-select-option.is-selected .chat-files-filter-select-check {
    visibility: visible;
}
.chat-files-table-wrap.drag-over {
    background: rgba(0, 102, 255, 0.06);
    outline: 2px dashed rgba(0, 102, 255, 0.35);
    outline-offset: -2px;
}
.chat-files-dropdown-item.is-danger {
    color: #dc3545;
}
.chat-files-dropdown-item.is-danger:hover:not(:disabled) {
    background: rgba(220, 53, 69, 0.08);
}
.chat-files-dropdown-item.is-disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
    font-size: 0.8125rem;
}
/* 文件管理：重命名 / 新建文件夹 — 紧凑表单弹窗，无全局紫色标题条 */
/* display 由 .modal（默认 none）与 openAppModal 内联 flex 控制，勿在此写 display:flex */
.modal.chat-files-form-modal {
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
/* 全局 Toast 须高于模态遮罩 (10050) */
#toast-notification-container {
    z-index: 10100 !important;
}
/* 对话附件读取 / 文件管理上传 进度条 */
/* [hidden] 默认会被本类的 display:flex 覆盖，须显式隐藏否则空闲时仍露出灰条 */
.chat-upload-progress-row[hidden] {
    display: none !important;
}
.chat-upload-progress-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0 4px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--bg-secondary, rgba(0, 0, 0, 0.04));
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
}
.chat-upload-progress-track {
    height: 6px;
    border-radius: 4px;
    background: var(--border-color, rgba(0, 0, 0, 0.1));
    overflow: hidden;
}
.chat-upload-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: var(--accent-primary, #2563eb);
    transition: width 0.12s ease-out;
}
.chat-upload-progress-label {
    font-size: 0.8rem;
    color: var(--text-secondary, #666);
    line-height: 1.35;
    word-break: break-all;
}
.robot-wechat-action-row .btn-primary {
    min-width: 160px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
}
.robot-wechat-card.is-bound .robot-wechat-action-row .btn-primary {
    background: var(--bg-primary);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    box-shadow: none;
}
.robot-wechat-card.is-bound .robot-wechat-action-row .btn-primary:hover {
    background: rgba(0, 102, 255, 0.06);
}
.robot-wechat-step.is-active {
    color: var(--accent-color);
    font-weight: 600;
}
.robot-wechat-qr-status.is-success {
    color: var(--accent-color);
    font-weight: 500;
}
.robot-wechat-qr-status.is-error {
    color: var(--error-color);
}
/* 项目管理 */
#page-projects.page {
    background: #f8fafc;
}
#page-projects .page-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}
#page-projects .page-content.projects-page-layout {
    display: flex;
    align-items: stretch;
    gap: 12px;
    min-height: calc(100vh - 128px);
    padding: 16px clamp(12px, 1.4vw, 20px) 24px;
    background: transparent;
}
.projects-sidebar-search .form-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.8125rem;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.projects-sidebar-search .form-input:focus {
    background: #fff;
    border-color: #0066ff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}
.sidebar-list-pagination .pagination-info {
    text-align: center;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-list-pagination-inner--compact .pagination-info {
    text-align: left;
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
}
.sidebar-list-pagination .pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}
.sidebar-list-pagination .pagination-page {
    min-width: 2.25rem;
    text-align: center;
    font-weight: 500;
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
}
.sidebar-list-pagination .pagination-page-size {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    white-space: nowrap;
    font-size: 0.6875rem;
    flex-shrink: 0;
}
.sidebar-list-pagination .pagination-page-size select {
    font-size: 0.6875rem;
    padding: 1px 2px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #fff;
    width: 2.75rem;
    min-width: 0;
}
.conversation-sidebar.collapsed .conversation-sidebar-pagination {
    display: none;
}
.projects-list-item.is-active {
    background: #eff6ff;
    border-color: #bfdbfe;
}
.projects-list-item.is-active::before {
    background: #0066ff;
}
.projects-list-item.is-active .projects-list-item-menu {
    opacity: 0.75;
}
.projects-list-item.is-active .projects-list-item-menu:hover,
.projects-list-item.is-active .projects-list-item-menu:focus-visible {
    background: #dbeafe;
}
.projects-tab.is-active {
    color: #0066ff;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    font-weight: 600;
}
.projects-filter-select-ui.open .projects-filter-select-trigger {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.projects-filter-select-ui.open {
    z-index: 120;
}
.projects-filter-select-ui.is-disabled .projects-filter-select-trigger {
    opacity: 0.6;
    cursor: not-allowed;
}
.projects-filter-select-ui.open .projects-filter-select-caret {
    transform: rotate(180deg);
}
.projects-filter-select-ui.open .projects-filter-select-dropdown {
    display: block;
}
.projects-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}
.projects-filter-select-option.is-selected .projects-filter-select-check {
    visibility: visible;
}
.sidebar-list-pagination .pagination-page-size .projects-filter-select-ui--compact {
    vertical-align: middle;
}
.sidebar-list-pagination .pagination-page-size .projects-filter-select-trigger {
    height: 28px;
    padding: 0 8px;
    font-size: 0.75rem;
    border-radius: 6px;
}
#project-panel-facts,
#project-panel-assets,
#project-panel-conversations,
#project-panel-vulns {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.project-fact-graph-container .loading-spinner {
    position: relative;
    z-index: 2;
}
.project-fact-graph-edge-item.is-selected {
    border-color: #818cf8;
    background: #eef2ff;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.25);
}
@media (max-width: 1400px) {
    .projects-detail-header {
        padding: 16px 18px 14px;
        gap: 14px;
    }
    .projects-tabs {
        padding: 10px 18px;
        flex-wrap: wrap;
    }
    .projects-panel {
        padding: 14px 18px 18px;
    }
    .projects-action-btn {
        padding: 4px 9px;
    }
}
.projects-settings-danger-actions .btn-small {
    min-height: 34px;
    padding: 7px 14px;
}
.projects-settings-footer .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 102, 255, 0.2), 0 4px 12px rgba(0, 102, 255, 0.15);
}
.projects-settings-footer .btn-primary svg {
    flex-shrink: 0;
}
@media (max-width: 960px) {
.projects-settings-footer .btn-primary {
        justify-content: center;
        width: 100%;
    }
}
.projects-form-field .form-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.projects-form-field .form-input:focus {
    outline: none;
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}
.projects-modal-body .form-input {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
#project-modal-name {
    overflow: hidden;
    text-overflow: ellipsis;
}
.projects-modal-body .form-input:focus {
    outline: none;
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
}
.projects-modal-footer .btn-primary {
    min-width: 100px;
}
.projects-form-label-actions .btn-link {
    font-size: 0.75rem;
    padding: 0;
    border: none;
    background: none;
    color: #2563eb;
    cursor: pointer;
    text-decoration: underline;
}
@media (max-width: 900px) {
#page-projects .page-content.projects-page-layout {
        flex-direction: column;
    }
}

/* ============================================================================
   Dark theme compatibility layer
   ============================================================================ */

html[data-theme="dark"] .container,
html[data-theme="dark"] .content-area,
html[data-theme="dark"] .page,
html[data-theme="dark"] .page-content,
html[data-theme="dark"] .chat-page-layout,
html[data-theme="dark"] .chat-container,
html[data-theme="dark"] .conversation-content,
html[data-theme="dark"] .chat-messages,
html[data-theme="dark"] .conversation-sidebar,
html[data-theme="dark"] .sidebar-content,
html[data-theme="dark"] .conversation-header,
html[data-theme="dark"] .chat-input-container,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .settings-modal-content,
html[data-theme="dark"] .monitor-modal-content,
html[data-theme="dark"] .attack-chain-modal-content,
html[data-theme="dark"] .batch-manage-modal-content,
html[data-theme="dark"] .projects-modal-dialog,
html[data-theme="dark"] .chat-files-form-modal-content,
html[data-theme="dark"] .info-collect-cell-modal-content,
html[data-theme="dark"] .lang-dropdown,
html[data-theme="dark"] .user-menu-dropdown {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

html[data-theme="dark"] .page-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .projects-modal-header,
html[data-theme="dark"] .projects-modal-footer,
html[data-theme="dark"] .modal-header {
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%) !important;
    border-bottom-color: var(--border-color) !important;
    box-shadow: none !important;
}
html[data-theme="dark"] .modal-header::after {
    background: linear-gradient(90deg, transparent 0%, rgba(96, 165, 250, 0.20) 50%, transparent 100%) !important;
}
html[data-theme="dark"] .modal-header h2 {
    background: linear-gradient(135deg, #e5e7eb 0%, #93c5fd 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}
html[data-theme="dark"] .modal-footer {
    background: var(--bg-primary) !important;
    border-top-color: var(--border-color) !important;
}

html[data-theme="dark"] .nav-item-content:hover,
html[data-theme="dark"] .nav-item.expanded > .nav-item-content,
html[data-theme="dark"] .lang-option:hover,
html[data-theme="dark"] .user-menu-item:hover,
html[data-theme="dark"] .notification-item:hover,
html[data-theme="dark"] .conversation-sort-option:hover,
html[data-theme="dark"] .role-selection-item-main:hover,
html[data-theme="dark"] .role-select-item:hover,
html[data-theme="dark"] .custom-select-option:hover,
html[data-theme="dark"] .audit-custom-select-option:hover,
html[data-theme="dark"] .vuln-filter-select-option:hover,
html[data-theme="dark"] .vuln-detail-select-option:hover,
html[data-theme="dark"] .hitl-filter-select-option:hover,
html[data-theme="dark"] .tasks-filter-select-option:hover,

html[data-theme="dark"] .nav-item.active > .nav-item-content,
html[data-theme="dark"] .role-selection-item-main.selected,
html[data-theme="dark"] .role-select-item.selected,
html[data-theme="dark"] .custom-select-option.selected,
html[data-theme="dark"] .audit-custom-select-option.is-selected,
html[data-theme="dark"] .vuln-filter-select-option.is-selected,
html[data-theme="dark"] .vuln-detail-select-option.is-selected,
html[data-theme="dark"] .hitl-filter-select-option.is-selected,
html[data-theme="dark"] .tasks-filter-select-option.is-selected,
html[data-theme="dark"] .workflow-form-select-option.is-selected,
html[data-theme="dark"] .projects-filter-select-option.is-selected,
html[data-theme="dark"] .chat-files-filter-select-option.is-selected,
html[data-theme="dark"] #role-modal .role-form-select-option.is-selected,
html[data-theme="dark"] .monitor-filter-select-option.is-selected,
html[data-theme="dark"] .batch-form-select-option.is-selected {
    background: rgba(96, 165, 250, 0.18);
    color: var(--accent-hover);
}

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .form-input,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .model-pick-input,
html[data-theme="dark"] .custom-select-trigger,
html[data-theme="dark"] .audit-custom-select-trigger,
html[data-theme="dark"] .vuln-filter-select-trigger,
html[data-theme="dark"] .hitl-filter-select-trigger,
html[data-theme="dark"] .tasks-filter-select-trigger,
html[data-theme="dark"] .workflow-form-select-trigger,
html[data-theme="dark"] .workflow-tool-select-trigger,
html[data-theme="dark"] .projects-filter-select-trigger,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted);
}

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] .form-input:focus,
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .model-pick-input:focus,
html[data-theme="dark"] .custom-select.open .custom-select-trigger,
html[data-theme="dark"] .audit-custom-select.open .audit-custom-select-trigger,
html[data-theme="dark"] .vuln-filter-select.open .vuln-filter-select-trigger,
html[data-theme="dark"] .vuln-detail-select-ui.open .vuln-detail-select-trigger,
html[data-theme="dark"] .hitl-filter-select-ui.open .hitl-filter-select-trigger,
html[data-theme="dark"] .tasks-filter-select-ui.open .tasks-filter-select-trigger,
html[data-theme="dark"] .workflow-form-select-ui.open .workflow-form-select-trigger,
html[data-theme="dark"] .projects-filter-select-ui.open .projects-filter-select-trigger,
html[data-theme="dark"] .chat-files-filter-select-ui.open .chat-files-filter-select-trigger,
html[data-theme="dark"] #role-modal .role-form-select-ui.open .role-form-select-trigger,
html[data-theme="dark"] .batch-form-select-ui.open .batch-form-select-trigger,
html[data-theme="dark"] .monitor-filter-select-ui.open .monitor-filter-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

html[data-theme="dark"] .dashboard-kpi-card,
html[data-theme="dark"] .monitor-stat-card,
html[data-theme="dark"] .knowledge-item-card,
html[data-theme="dark"] .retrieval-log-card,
html[data-theme="dark"] .vulnerability-card,
html[data-theme="dark"] .role-card,
html[data-theme="dark"] .skill-card,
html[data-theme="dark"] .projects-sidebar-card,
html[data-theme="dark"] .projects-settings-card,
html[data-theme="dark"] .robot-wechat-card,
html[data-theme="dark"] .batch-queue-item,
html[data-theme="dark"] .hitl-sidebar-card,
html[data-theme="dark"] .conversation-reasoning-card,
html[data-theme="dark"] .hitl-page-reviewer-bar,
html[data-theme="dark"] .audit-filter-card {
    background: #111827;
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .session-settings-select-option.is-selected {
    background: rgba(59, 130, 246, 0.22);
    color: #93c5fd;
}
html[data-theme="dark"] .conversation-reasoning-card .hitl-reviewer-toggle-btn.is-active {
    background: #1e293b;
}

html[data-theme="dark"] table,
html[data-theme="dark"] .data-table,
html[data-theme="dark"] .monitor-table,
html[data-theme="dark"] .audit-log-table {
    color: var(--text-primary);
    background: var(--bg-primary);
}

html[data-theme="dark"] th,
html[data-theme="dark"] .data-table thead th,
html[data-theme="dark"] .monitor-table th,
html[data-theme="dark"] .audit-log-table thead {
    background: #172033;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

html[data-theme="dark"] td,
html[data-theme="dark"] .data-table tbody td,
html[data-theme="dark"] .monitor-table td,
html[data-theme="dark"] .audit-log-table td {
    border-color: var(--border-color);
}
html[data-theme="dark"] tr:hover td {
    background: rgba(96, 165, 250, 0.08);
}

html[data-theme="dark"] code,
html[data-theme="dark"] pre,
html[data-theme="dark"] .code-block,
html[data-theme="dark"] .detail-code-card .code-block,
html[data-theme="dark"] .audit-detail-pre,
html[data-theme="dark"] .metadata-pre,
html[data-theme="dark"] #skill-view-body {
    background: #0b1120 !important;
    color: #dbeafe;
    border-color: #263244;
}
html[data-theme="dark"] #mcp-detail-modal {
    background: rgba(2, 6, 23, 0.62);
}
html[data-theme="dark"] #mcp-detail-modal .modal-header {
    background: #111827 !important;
    border-bottom-color: rgba(148, 163, 184, 0.14) !important;
}
html[data-theme="dark"] #mcp-detail-modal .modal-header h2 {
    background: none !important;
    color: #e5e7eb !important;
    -webkit-text-fill-color: currentColor !important;
}
html[data-theme="dark"] #mcp-detail-modal .modal-body {
    background: #0f172a;
}
html[data-theme="dark"] #mcp-detail-modal .detail-result-tab.active {
    background: #1f2937;
    color: #e5e7eb;
    box-shadow: none;
}
html[data-theme="dark"] .chat-turn-rail-marker.is-active::before {
    background: #f4f7fb;
}
html[data-theme="dark"] .loading-spinner,
html[data-theme="dark"] .empty-state {
    color: var(--text-secondary);
}
html[data-theme="dark"] .modal {
    background: rgba(2, 6, 23, 0.72);
}
html[data-theme="dark"] .btn-secondary {
    background: #111827;
    color: var(--text-primary);
    border-color: #2b374b;
}
html[data-theme="dark"] .btn-secondary:hover {
    background: #1f2937;
    color: var(--accent-hover);
    border-color: var(--accent-color);
}
html[data-theme="dark"] *:hover {
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}
html[data-theme="dark"] :not(:hover)::-webkit-scrollbar-thumb {
    background: transparent !important;
}
html[data-theme="dark"] *:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
}
html[data-theme="dark"] *:hover::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.42);
}
/* Dashboard has a late {
    background:
        radial-gradient(circle at 18% 8%, rgba(37, 99, 235, 0.14), transparent 28rem),
        linear-gradient(180deg, #0b1120 0%, #111827 50%, #0b1120 100%) !important;
}
html[data-theme="dark"] .dashboard-page .page-header {
    margin-top: 0 !important;
    background: #111827 !important;
    border-top: 0 !important;
    border-bottom-color: var(--border-color);
    box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
}
html[data-theme="dark"] .content-area:has(.dashboard-page.active) {
    background: #111827 !important;
}
html[data-theme="dark"] #page-dashboard,
html[data-theme="dark"] #page-dashboard.active {
    margin-top: 0 !important;
    background: #111827 !important;
}

html[data-theme="dark"] .dashboard-grid .dashboard-section,
html[data-theme="dark"] .dashboard-section,
html[data-theme="dark"] .dashboard-recommend-item,
html[data-theme="dark"] .dashboard-event-item,
html[data-theme="dark"] .dashboard-batch-side-stat,
html[data-theme="dark"] .dashboard-recent-facts-empty,
html[data-theme="dark"] .dashboard-recent-vulns-empty,
html[data-theme="dark"] .dashboard-resource-item,

html[data-theme="dark"] .dashboard-grid .dashboard-section:hover,
html[data-theme="dark"] .dashboard-severity-status-filter-option.is-active {
    background: rgba(96, 165, 250, 0.10);
    color: #bfdbfe;
}
html[data-theme="dark"] .dashboard-feed-tab.is-active {
    background: #172033 !important;
    color: var(--accent-hover);
    box-shadow: none;
}
html[data-theme="dark"] .dashboard-severity-legend-item.is-active {
    background: rgba(96, 165, 250, 0.10);
}

html[data-theme="dark"] .dashboard-recent-fact-project,
html[data-theme="dark"] .dashboard-recent-fact-cat,
html[data-theme="dark"] .dashboard-recent-fact-conf,
html[data-theme="dark"] .dashboard-alert-banner.is-danger {
    --dashboard-alert-accent: #f87171;
    --dashboard-alert-accent-soft: rgba(248, 113, 113, 0.075);
    --dashboard-alert-accent-border: rgba(248, 113, 113, 0.18);
}
/* Chat controls are defined after the generic dark layer,
html[data-theme="dark"] .role-selector-btn.active {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
    box-shadow: none;
}
html[data-theme="dark"] .role-selection-item-main.selected,
html[data-theme="dark"] .agent-mode-option.selected {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.20) 0%, rgba(124, 58, 237, 0.18) 100%) !important;
    border-color: rgba(96, 165, 250, 0.62) !important;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.16), 0 12px 28px rgba(0, 0, 0, 0.28) !important;
}
html[data-theme="dark"] .role-selection-item-main.selected .role-selection-item-name-main,
html[data-theme="dark"] .agent-mode-option.selected .role-selection-item-name-main {
    color: #c4b5fd !important;
}
html[data-theme="dark"] .sidebar-list-pagination .pagination-info,
html[data-theme="dark"] .sidebar-list-pagination .pagination-page,
html[data-theme="dark"] .pagination-fixed .pagination-info,
html[data-theme="dark"] .pagination-fixed .pagination-info span {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] .sidebar-list-pagination .pagination-page-size select,
html[data-theme="dark"] .pagination-fixed .pagination-info .pagination-page-size select,
html[data-theme="dark"] .pagination-fixed .pagination-controls .btn-secondary {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}
html[data-theme="dark"] .pagination-fixed .pagination-controls .btn-secondary:disabled {
    color: #475569 !important;
    background: #0b1120 !important;
    border-color: #1f2937 !important;
}
html[data-theme="dark"] .chat-input-container.drag-over {
    background: rgba(96, 165, 250, 0.08) !important;
    outline-color: rgba(96, 165, 250, 0.35);
}

/* Final dark-mode hardening for page-specific blocks defined late in the file. */
html[data-theme="dark"] .hitl-page-reviewer-bar,
html[data-theme="dark"] .hitl-page-whitelist-bar,
html[data-theme="dark"] .hitl-page-strategy-bar,
html[data-theme="dark"] .hitl-sidebar-config,
html[data-theme="dark"] .hitl-pending-item,
html[data-theme="dark"] .hitl-pending-payload,
html[data-theme="dark"] .hitl-context-text,
html[data-theme="dark"] .hitl-logs-table-wrap,
html[data-theme="dark"] .hitl-log-modal-content,
html[data-theme="dark"] .projects-sidebar-card,
html[data-theme="dark"] .projects-detail-placeholder,
html[data-theme="dark"] .projects-detail-inner,
html[data-theme="dark"] .projects-detail-header,
html[data-theme="dark"] .projects-panel,
html[data-theme="dark"] .projects-fact-toolbar,
html[data-theme="dark"] .projects-table-wrap,
html[data-theme="dark"] .projects-settings-card,
html[data-theme="dark"] .projects-settings-footer,
html[data-theme="dark"] .projects-modal-dialog,
html[data-theme="dark"] .projects-modal-header,
html[data-theme="dark"] .projects-modal-footer,
html[data-theme="dark"] .project-fact-graph-container,
html[data-theme="dark"] .project-fact-graph-sidebar,
html[data-theme="dark"] .project-fact-graph-edge-item,
html[data-theme="dark"] .project-fact-graph-footer,
html[data-theme="dark"] .webshell-db-profile-tab,
html[data-theme="dark"] .webshell-db-sidebar,
html[data-theme="dark"] .webshell-db-group,
html[data-theme="dark"] .webshell-db-profile-modal-content,
html[data-theme="dark"] #webshell-db-profile-modal .modal-header,
html[data-theme="dark"] #webshell-db-profile-modal .modal-footer,
html[data-theme="dark"] .webshell-db-toolbar label,
html[data-theme="dark"] .webshell-db-output-wrap,
html[data-theme="dark"] .info-collect-provider-card,
html[data-theme="dark"] .info-collect-query-card,
html[data-theme="dark"] .info-collect-options-card,
html[data-theme="dark"] .info-collect-provider-select .settings-custom-select-option.is-selected {
    background: rgba(59, 130, 246, 0.18) !important;
    color: #93c5fd !important;
}

html[data-theme="dark"] .hitl-reviewer-toggle,
html[data-theme="dark"] .projects-tabs,
html[data-theme="dark"] .projects-sidebar-head,
html[data-theme="dark"] .projects-sidebar-search,

html[data-theme="dark"] .hitl-reviewer-toggle-btn,
html[data-theme="dark"] .hitl-strategy-subtab,
html[data-theme="dark"] .projects-tab,
html[data-theme="dark"] .projects-action-btn,

html[data-theme="dark"] .hitl-reviewer-toggle-btn:hover,
html[data-theme="dark"] .hitl-strategy-subtab:hover,
html[data-theme="dark"] .projects-tab:hover,
html[data-theme="dark"] .hitl-reviewer-toggle-btn.is-active,
html[data-theme="dark"] .projects-tab.is-active,
html[data-theme="dark"] .webshell-db-profile-tab.active {
    background: rgba(96, 165, 250, 0.16) !important;
    color: var(--accent-hover) !important;
    border-color: rgba(96, 165, 250, 0.44) !important;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.12) inset !important;
}

html[data-theme="dark"] .hitl-page-reviewer-label,
html[data-theme="dark"] .hitl-page-whitelist-label,
html[data-theme="dark"] .hitl-page-strategy-label,
html[data-theme="dark"] .hitl-log-detail-row dd,
html[data-theme="dark"] .projects-sidebar-title,
html[data-theme="dark"] .projects-list-item-name,
html[data-theme="dark"] .projects-detail-placeholder h3,
html[data-theme="dark"] .projects-detail-title,
html[data-theme="dark"] .projects-settings-intro-title,
html[data-theme="dark"] .projects-settings-card-title,
html[data-theme="dark"] .projects-settings-card-head .projects-settings-card-title,
html[data-theme="dark"] .projects-modal-header h3,
html[data-theme="dark"] .project-fact-graph-empty-title,
html[data-theme="dark"] .project-fact-graph-sidebar-header h4,
html[data-theme="dark"] .projects-graph-stat-badge strong,
html[data-theme="dark"] .webshell-db-sidebar-head span,
html[data-theme="dark"] #webshell-db-profile-modal .modal-header h2 {
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

html[data-theme="dark"] .hitl-page-reviewer-hint,
html[data-theme="dark"] .hitl-page-whitelist-hint,
html[data-theme="dark"] .hitl-page-strategy-hint,
html[data-theme="dark"] .hitl-config-hint,
html[data-theme="dark"] .hitl-input-help,
html[data-theme="dark"] .hitl-logs-summary,
html[data-theme="dark"] .hitl-logs-retention-hint,
html[data-theme="dark"] .hitl-logs-empty-hint,
html[data-theme="dark"] .projects-detail-placeholder p,
html[data-theme="dark"] .projects-detail-meta,
html[data-theme="dark"] .projects-detail-desc,
html[data-theme="dark"] .projects-panel-hint,
html[data-theme="dark"] .projects-fact-toolbar-hint,
html[data-theme="dark"] .projects-settings-intro-hint,
html[data-theme="dark"] .projects-settings-card-hint,
html[data-theme="dark"] .projects-settings-card-head .projects-settings-card-hint,
html[data-theme="dark"] .projects-settings-footer-hint,
html[data-theme="dark"] .projects-modal-subtitle,
html[data-theme="dark"] .project-fact-graph-empty-hint,
html[data-theme="dark"] .project-fact-graph-node-meta,
html[data-theme="dark"] .project-fact-graph-node-summary,
html[data-theme="dark"] .project-fact-graph-edges-hint,

html[data-theme="dark"] .hitl-config-select,
html[data-theme="dark"] .hitl-config-input,
html[data-theme="dark"] .hitl-config-textarea,
html[data-theme="dark"] .hitl-edit-args,
html[data-theme="dark"] .hitl-page-whitelist-textarea,
html[data-theme="dark"] .hitl-strategy-textarea,
html[data-theme="dark"] .hitl-filter-input,
html[data-theme="dark"] .hitl-filter-select,
html[data-theme="dark"] .projects-sidebar-search .form-input,
html[data-theme="dark"] .projects-description-textarea,
html[data-theme="dark"] .projects-fact-filter-field input,
html[data-theme="dark"] .projects-form-field .form-input,
html[data-theme="dark"] .projects-modal-body .form-input,
html[data-theme="dark"] .webshell-db-toolbar .form-control {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}
html[data-theme="dark"] #page-info-collect input[type="text"],
html[data-theme="dark"] #page-info-collect input[type="number"],
html[data-theme="dark"] #page-info-collect .info-collect-form-row #info-collect-full-option .checkbox-label {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}

html[data-theme="dark"] .hitl-config-select:focus,
html[data-theme="dark"] .hitl-config-input:focus,
html[data-theme="dark"] .hitl-config-textarea:focus,
html[data-theme="dark"] .hitl-edit-args:focus,
html[data-theme="dark"] .hitl-page-whitelist-textarea:focus,
html[data-theme="dark"] .hitl-strategy-textarea:focus,
html[data-theme="dark"] .hitl-filter-input:focus,
html[data-theme="dark"] .hitl-filter-select:focus,
html[data-theme="dark"] .projects-sidebar-search .form-input:focus,
html[data-theme="dark"] .projects-form-field .form-input:focus,
html[data-theme="dark"] .projects-modal-body .form-input:focus,
html[data-theme="dark"] .webshell-db-toolbar .form-control:focus {
    background: #111827 !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16) !important;
}
html[data-theme="dark"] #page-info-collect .form-hint,
html[data-theme="dark"] #fofa-parse-modal .form-hint {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .hitl-decision-tag,
html[data-theme="dark"] .projects-category,
html[data-theme="dark"] .projects-confidence,

/* Sidebar submenu colors only; keep the original spacing/collapse behavior. */
html[data-theme="dark"] .main-sidebar .nav-submenu {
    background: rgba(15, 23, 42, 0.72) !important;
}
html[data-theme="dark"] .main-sidebar .nav-submenu-item {
    color: #94a3b8;
}
html[data-theme="dark"] .main-sidebar .nav-submenu-item:hover {
    background: rgba(96, 165, 250, 0.12) !important;
    color: #dbeafe !important;
}
html[data-theme="dark"] .main-sidebar .nav-submenu-item.active {
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.18) 0%, rgba(96, 165, 250, 0.08) 100%) !important;
    color: var(--accent-hover) !important;
}
html[data-theme="dark"] .main-sidebar .nav-item.expanded > .nav-item-content {
    background: rgba(96, 165, 250, 0.14);
    color: var(--text-primary);
}
html[data-theme="dark"] .conversation-item.active {
    background: rgba(96, 165, 250, 0.16) !important;
    border-color: rgba(96, 165, 250, 0.34) !important;
}
html[data-theme="dark"] .attack-chain-modal-content .modal-header {
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%) !important;
    border-bottom-color: #263244 !important;
}
html[data-theme="dark"] .attack-chain-modal-content .modal-header h2 {
    background: none !important;
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}
html[data-theme="dark"] .attack-chain-filters button.btn-secondary,
html[data-theme="dark"] .attack-chain-action-btn.btn-secondary {
    background-color: #0f172a !important;
    background-image: none !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
    box-shadow: none !important;
}
html[data-theme="dark"] .attack-chain-filters button.btn-secondary:hover,
html[data-theme="dark"] .attack-chain-action-btn.btn-secondary:hover {
    background: #172033 !important;
    color: var(--accent-hover) !important;
    border-color: rgba(96, 165, 250, 0.48) !important;
}
html[data-theme="dark"] .attack-chain-container .loading-spinner {
    color: var(--text-secondary) !important;
}
/* Projects page has ID-scoped light styles; keep its frame dark. */
html[data-theme="dark"] #page-projects {
    background: #0b1120 !important;
}
html[data-theme="dark"] #page-projects .page-header {
    background: #111827 !important;
    border-bottom-color: #263244 !important;
    box-shadow: none !important;
}
html[data-theme="dark"] #page-projects .page-header h2 {
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}
html[data-theme="dark"] #page-projects .page-content.projects-page-layout {
    background: #0b1120 !important;
}

html[data-theme="dark"] #page-projects .projects-list-item.is-active {
    background: rgba(96, 165, 250, 0.16) !important;
    border-color: rgba(96, 165, 250, 0.34) !important;
}
html[data-theme="dark"] #page-projects .projects-list-item.is-active .projects-list-item-menu {
    opacity: 0.9;
}
html[data-theme="dark"] #page-projects .projects-list-item.is-active .projects-list-item-menu:hover,
html[data-theme="dark"] #page-projects .projects-list-item.is-active .projects-list-item-menu:focus-visible {
    background: rgba(96, 165, 250, 0.20) !important;
    color: #dbeafe !important;
}
/* WebShell page light gradients are page-specific; keep the empty state dark. */
html[data-theme="dark"] #page-webshell {
    background: #0b1120 !important;
}
html[data-theme="dark"] #page-webshell .webshell-resize-handle.active {
    background: var(--accent-color) !important;
}
html[data-theme="dark"] #page-webshell .webshell-item.active {
    background: rgba(96, 165, 250, 0.16) !important;
    border-color: rgba(96, 165, 250, 0.42) !important;
}
/* WebShell add-connection modal dark theme */
html[data-theme="dark"] #webshell-modal .modal-content,
html[data-theme="dark"] #webshell-modal .modal-header,
html[data-theme="dark"] #webshell-modal .modal-body,
html[data-theme="dark"] #webshell-modal .modal-footer {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}
html[data-theme="dark"] #webshell-modal .modal-header h2 {
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    background: none !important;
}
html[data-theme="dark"] #webshell-modal .form-group label {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] #webshell-modal .form-hint {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] #webshell-modal input:not([type="checkbox"]):not([type="radio"]) {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}
html[data-theme="dark"] #webshell-modal input::placeholder {
    color: var(--text-muted) !important;
}
html[data-theme="dark"] #webshell-modal select {
    background-color: #0f172a !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a7b0c0' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}
html[data-theme="dark"] #webshell-modal select option {
    background: #0f172a;
    color: var(--text-primary);
}
html[data-theme="dark"] #webshell-modal .webshell-form-select-ui.open .webshell-form-select-trigger {
    border-color: rgba(96, 165, 250, 0.62) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16) !important;
}
html[data-theme="dark"] #webshell-modal .webshell-form-select-option.is-selected {
    background: rgba(59, 130, 246, 0.22) !important;
    color: #bfdbfe !important;
}
/* External MCP modal dark theme */
html[data-theme="dark"] #external-mcp-modal .modal-content,
html[data-theme="dark"] #external-mcp-modal .modal-header,
html[data-theme="dark"] #external-mcp-modal .modal-body,
html[data-theme="dark"] #external-mcp-modal .modal-footer {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}
html[data-theme="dark"] #external-mcp-modal .modal-header {
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%) !important;
    border-bottom-color: #263244 !important;
    box-shadow: none !important;
}
html[data-theme="dark"] #external-mcp-modal .modal-header::after {
    background: linear-gradient(90deg, transparent 0%, rgba(96, 165, 250, 0.28) 50%, transparent 100%);
}
html[data-theme="dark"] #external-mcp-modal .modal-header h2 {
    background: none !important;
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}
html[data-theme="dark"] #external-mcp-modal .form-group label {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] #external-mcp-modal textarea,
html[data-theme="dark"] #external-mcp-modal input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] #external-mcp-modal select {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}
html[data-theme="dark"] #external-mcp-modal textarea::placeholder,
html[data-theme="dark"] #external-mcp-modal input::placeholder {
    color: var(--text-muted) !important;
}
html[data-theme="dark"] #external-mcp-modal textarea:focus,
html[data-theme="dark"] #external-mcp-modal input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] #external-mcp-modal select:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16) !important;
}
/* HITL audit log modal dark theme */
html[data-theme="dark"] #hitl-log-modal .modal-content,
html[data-theme="dark"] #hitl-log-modal .modal-header,
html[data-theme="dark"] #hitl-log-modal .modal-body,
html[data-theme="dark"] #hitl-log-modal .modal-footer {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}
html[data-theme="dark"] #hitl-log-modal .modal-header {
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%) !important;
    border-bottom-color: #263244 !important;
    box-shadow: none !important;
}
html[data-theme="dark"] #hitl-log-modal .modal-header::after {
    background: linear-gradient(90deg, transparent 0%, rgba(96, 165, 250, 0.28) 50%, transparent 100%);
}
html[data-theme="dark"] #hitl-log-modal .modal-header h3,
html[data-theme="dark"] #hitl-log-modal-title {
    background: none !important;
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

/* Knowledge / Skill / Agent modal dark theme — panel surfaces */
html[data-theme="dark"] #knowledge-item-modal .modal-content,
html[data-theme="dark"] #knowledge-item-modal .modal-header,
html[data-theme="dark"] #knowledge-item-modal .modal-body,
html[data-theme="dark"] #knowledge-item-modal .modal-footer,
html[data-theme="dark"] #skill-modal .modal-content,
html[data-theme="dark"] #skill-modal .modal-header,
html[data-theme="dark"] #skill-modal .modal-body,
html[data-theme="dark"] #skill-modal .modal-footer,
html[data-theme="dark"] #skill-view-modal .modal-content,
html[data-theme="dark"] #skill-view-modal .modal-header,
html[data-theme="dark"] #skill-view-modal .modal-body,
html[data-theme="dark"] #skill-view-modal .modal-footer,
html[data-theme="dark"] #agent-md-modal .modal-content,
html[data-theme="dark"] #agent-md-modal .modal-header,
html[data-theme="dark"] #agent-md-modal .modal-body,
html[data-theme="dark"] #agent-md-modal .modal-footer {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}
#role-modal .role-form-select-ui.open .role-form-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
#role-modal .role-form-select-ui.open {
    z-index: 120;
}
#role-modal .role-form-select-ui.is-disabled .role-form-select-trigger {
    opacity: 0.6;
    cursor: not-allowed;
}
#role-modal .role-form-select-ui.open .role-form-select-caret {
    transform: rotate(180deg);
}
#role-modal .role-form-select-ui.open .role-form-select-dropdown {
    display: block;
}
#role-modal .role-form-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}
#role-modal .role-form-select-option.is-selected .role-form-select-check {
    visibility: visible;
}
.batch-form-select-ui.open .batch-form-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.batch-form-select-ui.open {
    z-index: 120;
}
.batch-form-select-ui.is-disabled .batch-form-select-trigger {
    opacity: 0.6;
    cursor: not-allowed;
}
.batch-form-select-ui.open .batch-form-select-caret {
    transform: rotate(180deg);
}
.batch-form-select-ui.open .batch-form-select-dropdown {
    display: block;
}
.batch-form-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}
.batch-form-select-option.is-selected .batch-form-select-check {
    visibility: visible;
}
#batch-import-modal .modal-content:has(.batch-form-select-ui.open),
#batch-import-modal .modal-body:has(.batch-form-select-ui.open),
#batch-queue-detail-modal .modal-content:has(.batch-form-select-ui.open),
#batch-queue-detail-modal .modal-body:has(.batch-form-select-ui.open) {
    overflow: visible;
}
html[data-theme="dark"] #role-modal .modal-content,
html[data-theme="dark"] #role-modal .modal-header,
html[data-theme="dark"] #role-modal .modal-body,
html[data-theme="dark"] #role-modal .modal-footer {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}
html[data-theme="dark"] #knowledge-item-modal .modal-header,
html[data-theme="dark"] #skill-modal .modal-header,
html[data-theme="dark"] #skill-view-modal .modal-header,
html[data-theme="dark"] #agent-md-modal .modal-header,
html[data-theme="dark"] #role-modal .modal-header {
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%) !important;
    border-bottom-color: #263244 !important;
    box-shadow: none !important;
}
html[data-theme="dark"] #knowledge-item-modal .modal-header::after,
html[data-theme="dark"] #skill-modal .modal-header::after,
html[data-theme="dark"] #skill-view-modal .modal-header::after,
html[data-theme="dark"] #agent-md-modal .modal-header::after,
html[data-theme="dark"] #role-modal .modal-header::after {
    background: linear-gradient(90deg, transparent 0%, rgba(96, 165, 250, 0.28) 50%, transparent 100%);
}
html[data-theme="dark"] #knowledge-item-modal .modal-header h2,
html[data-theme="dark"] #skill-modal .modal-header h2,
html[data-theme="dark"] #skill-view-modal .modal-header h2,
html[data-theme="dark"] #agent-md-modal .modal-header h2,
html[data-theme="dark"] #role-modal .modal-header h2 {
    background: none !important;
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}
html[data-theme="dark"] #knowledge-item-modal .form-group label,
html[data-theme="dark"] #skill-modal .form-group label,
html[data-theme="dark"] #skill-view-modal .form-group label,
html[data-theme="dark"] #agent-md-modal .form-group label,
html[data-theme="dark"] #role-modal .form-group label {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] #knowledge-item-modal textarea,
html[data-theme="dark"] #knowledge-item-modal input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] #knowledge-item-modal select,
html[data-theme="dark"] #skill-modal textarea,
html[data-theme="dark"] #skill-modal input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] #skill-modal select,
html[data-theme="dark"] #agent-md-modal textarea,
html[data-theme="dark"] #agent-md-modal input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] #agent-md-modal select,
html[data-theme="dark"] #role-modal textarea,
html[data-theme="dark"] #role-modal input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] #role-modal select {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}

html[data-theme="dark"] #knowledge-item-modal textarea::placeholder,
html[data-theme="dark"] #knowledge-item-modal input::placeholder,
html[data-theme="dark"] #skill-modal textarea::placeholder,
html[data-theme="dark"] #skill-modal input::placeholder,
html[data-theme="dark"] #agent-md-modal textarea::placeholder,
html[data-theme="dark"] #agent-md-modal input::placeholder,
html[data-theme="dark"] #role-modal textarea::placeholder,
html[data-theme="dark"] #role-modal input::placeholder {
    color: var(--text-muted) !important;
}

html[data-theme="dark"] #knowledge-item-modal textarea:focus,
html[data-theme="dark"] #knowledge-item-modal input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] #knowledge-item-modal select:focus,
html[data-theme="dark"] #skill-modal textarea:focus,
html[data-theme="dark"] #skill-modal input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] #skill-modal select:focus,
html[data-theme="dark"] #agent-md-modal textarea:focus,
html[data-theme="dark"] #agent-md-modal input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] #agent-md-modal select:focus,
html[data-theme="dark"] #role-modal textarea:focus,
html[data-theme="dark"] #role-modal input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] #role-modal select:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16) !important;
}
html[data-theme="dark"] #knowledge-item-modal .form-hint,
html[data-theme="dark"] #skill-modal .form-hint,
html[data-theme="dark"] #agent-md-modal .form-hint,
html[data-theme="dark"] #role-modal .form-hint {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] #skill-modal #skill-package-tree {
    background: #0f172a !important;
    border-color: #2b374b !important;
}
html[data-theme="dark"] #skill-modal .skill-tree-file.is-selected {
    background: rgba(96, 165, 250, 0.18) !important;
    color: var(--accent-hover) !important;
}
html[data-theme="dark"] #skill-view-modal .modal-body strong {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] #skill-view-modal #skill-view-body {
    background: #0b1120 !important;
    color: #dbeafe !important;
    border: 1px solid #2b374b !important;
}
html[data-theme="dark"] #agent-md-modal .form-select,
html[data-theme="dark"] #agent-md-modal select {
    background-color: #0f172a !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a7b0c0' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
}
html[data-theme="dark"] #agent-md-modal select option,
html[data-theme="dark"] #role-modal select option {
    background: #0f172a;
    color: var(--text-primary);
}
html[data-theme="dark"] #role-modal .tools-status-filter .btn-filter {
    background: #0f172a !important;
    color: var(--text-secondary) !important;
    border-color: #2b374b !important;
}
html[data-theme="dark"] #role-modal .tools-status-filter .btn-filter:hover {
    background: #172033 !important;
    color: var(--text-primary) !important;
}
html[data-theme="dark"] #role-modal .tools-status-filter .btn-filter.active {
    background: var(--accent-color) !important;
    color: #fff !important;
}
/* MCP monitor page has its own analytics panels with light backgrounds. */
html[data-theme="dark"] #page-mcp-monitor,
html[data-theme="dark"] #page-mcp-monitor .page-content {
    background: #0b1120 !important;
}
html[data-theme="dark"] .content-area:has(#page-mcp-monitor.active) {
    background: #0b1120 !important;
}
html[data-theme="dark"] #page-mcp-monitor .page-header {
    background: #111827 !important;
    border-bottom-color: #263244 !important;
    box-shadow: none !important;
}
html[data-theme="dark"] #page-mcp-monitor .page-header h2 {
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

html[data-theme="dark"] #page-mcp-monitor .mcp-stats-kpi__label,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-kpi__meta,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-combined__meta,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-timeline__range.is-active {
    background: rgba(96, 165, 250, 0.18) !important;
    color: var(--accent-hover) !important;
    box-shadow: none !important;
}
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tool-item.is-active,
html[data-theme="dark"] #page-mcp-monitor tr.mcp-stats-tool-row[data-tool-name].is-active {
    background: rgba(96, 165, 250, 0.16) !important;
}

/* Settings page contains inline-styled selects; force dark form controls. */
html[data-theme="dark"] #page-settings select,
html[data-theme="dark"] #page-settings input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] #page-settings textarea,
html[data-theme="dark"] #page-settings .form-select,
html[data-theme="dark"] #page-settings .form-input {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-settings select:focus,
html[data-theme="dark"] #page-settings input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] #page-settings textarea:focus,
html[data-theme="dark"] #page-settings .form-select:focus,
html[data-theme="dark"] #page-settings .form-input:focus {
    background: #111827 !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16) !important;
}
html[data-theme="dark"] #page-settings select option {
    background: #0f172a;
    color: var(--text-primary);
}
html[data-theme="dark"] #page-settings .audit-custom-select-trigger {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
    box-shadow: none !important;
}
html[data-theme="dark"] #page-settings .audit-custom-select-trigger:hover:not(:disabled) {
    border-color: rgba(96, 165, 250, 0.75) !important;
}
html[data-theme="dark"] #page-settings .settings-custom-select.open .settings-custom-select-trigger,
html[data-theme="dark"] #page-settings .audit-custom-select.open .audit-custom-select-trigger {
    background: #111827 !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16) !important;
}
html[data-theme="dark"] #page-settings .audit-custom-select-dropdown {
    background: #0f172a !important;
    border-color: #2b374b !important;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42) !important;
}
html[data-theme="dark"] #page-settings .audit-custom-select-option {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] #page-settings .audit-custom-select-option:hover {
    background: rgba(96, 165, 250, 0.12) !important;
}
html[data-theme="dark"] #page-settings .settings-custom-select-option.is-selected,
html[data-theme="dark"] #page-settings .audit-custom-select-option.is-selected {
    background: rgba(96, 165, 250, 0.16) !important;
    color: #60a5fa !important;
}
html[data-theme="dark"] .mention-item.active {
    background: rgba(96, 165, 250, 0.16) !important;
    border-color: rgba(96, 165, 250, 0.36) !important;
    border-left-color: rgba(96, 165, 250, 0.72) !important;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.12) inset !important;
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .mention-item.active .mention-item-name {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .mention-item.active .mention-item-desc,
html[data-theme="dark"] .mention-item.active .mention-item-meta {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] .mention-item.active .mention-status.enabled {
    background: rgba(34, 197, 94, 0.16) !important;
    color: #86efac !important;
    border: 1px solid rgba(34, 197, 94, 0.30) !important;
}
html[data-theme="dark"] .mention-item.active .mention-status.disabled {
    background: rgba(248, 113, 113, 0.14) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(248, 113, 113, 0.28) !important;
}
/* Vulnerability stat cards dark theme. */
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-card-total.is-active {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96) 0%, rgba(15, 23, 42, 0.96) 100%) !important;
    border-color: rgba(148, 163, 184, 0.34) !important;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.14) !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-card-total.is-active .stat-label {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-card-total.is-active .stat-value,
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-card-total.is-active .stat-pct {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.is-clickable.is-active {
    transform: none;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.is-clickable.is-active .stat-label {
    color: var(--text-secondary) !important;
    font-weight: 600;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-critical.is-active {
    background: linear-gradient(180deg, rgba(127, 29, 29, 0.34) 0%, rgba(17, 24, 39, 0.98) 100%) !important;
    border-color: rgba(248, 113, 113, 0.38) !important;
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.16) !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-high.is-active {
    background: linear-gradient(180deg, rgba(124, 45, 18, 0.32) 0%, rgba(17, 24, 39, 0.98) 100%) !important;
    border-color: rgba(251, 146, 60, 0.38) !important;
    box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.16) !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-medium.is-active {
    background: linear-gradient(180deg, rgba(113, 63, 18, 0.30) 0%, rgba(17, 24, 39, 0.98) 100%) !important;
    border-color: rgba(251, 191, 36, 0.36) !important;
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.14) !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-low.is-active {
    background: linear-gradient(180deg, rgba(6, 78, 59, 0.30) 0%, rgba(17, 24, 39, 0.98) 100%) !important;
    border-color: rgba(52, 211, 153, 0.34) !important;
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.14) !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-info.is-active {
    background: linear-gradient(180deg, rgba(30, 58, 138, 0.26) 0%, rgba(17, 24, 39, 0.98) 100%) !important;
    border-color: rgba(148, 163, 184, 0.34) !important;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.12) !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-critical.is-active .stat-value:not(.is-zero) {
    color: #fca5a5 !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-high.is-active .stat-value:not(.is-zero) {
    color: #fdba74 !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-medium.is-active .stat-value:not(.is-zero) {
    color: #fde68a !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-low.is-active .stat-value:not(.is-zero) {
    color: #6ee7b7 !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.stat-info.is-active .stat-value:not(.is-zero) {
    color: #93c5fd !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.is-clickable.is-active .stat-pct {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] #page-vulnerabilities .stat-card.is-clickable:hover:not(.is-active) {
    border-color: rgba(96, 165, 250, 0.28);
    box-shadow: var(--shadow-sm);
}
/* Batch queue detail modal dark theme */
html[data-theme="dark"] #batch-queue-detail-modal .modal-content,
html[data-theme="dark"] #batch-queue-detail-modal .modal-header,
html[data-theme="dark"] #batch-queue-detail-modal .modal-body {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}
html[data-theme="dark"] #batch-queue-detail-modal .modal-header {
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%) !important;
    border-bottom-color: #263244 !important;
    box-shadow: none !important;
}
html[data-theme="dark"] #batch-queue-detail-modal .modal-header::after {
    background: linear-gradient(90deg, transparent 0%, rgba(96, 165, 250, 0.28) 50%, transparent 100%);
}
html[data-theme="dark"] #batch-queue-detail-modal .modal-header h2,
html[data-theme="dark"] #batch-queue-detail-title {
    background: none !important;
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}
/* Vulnerability edit modal dark theme */
html[data-theme="dark"] #vulnerability-modal .modal-content,
html[data-theme="dark"] #vulnerability-modal .modal-header,
html[data-theme="dark"] #vulnerability-modal .modal-body,
html[data-theme="dark"] #vulnerability-modal .modal-footer {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}
html[data-theme="dark"] #vulnerability-modal .modal-header {
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%) !important;
    border-bottom-color: #263244 !important;
    box-shadow: none !important;
}
html[data-theme="dark"] #vulnerability-modal .modal-header::after {
    background: linear-gradient(90deg, transparent 0%, rgba(96, 165, 250, 0.28) 50%, transparent 100%);
}
html[data-theme="dark"] #vulnerability-modal .modal-header h2,
html[data-theme="dark"] #vulnerability-modal-title {
    background: none !important;
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}
html[data-theme="dark"] #vulnerability-modal .form-group label {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] #vulnerability-modal .form-hint {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] #vulnerability-modal input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] #vulnerability-modal textarea,
html[data-theme="dark"] #vulnerability-modal select {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}
html[data-theme="dark"] #vulnerability-modal input::placeholder,
html[data-theme="dark"] #vulnerability-modal textarea::placeholder {
    color: var(--text-muted) !important;
}
html[data-theme="dark"] #vulnerability-modal input:focus,
html[data-theme="dark"] #vulnerability-modal textarea:focus,
html[data-theme="dark"] #vulnerability-modal select:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16) !important;
}

/* Task creation modal and project fact action column dark theme. */
html[data-theme="dark"] #batch-import-modal .modal-content,
html[data-theme="dark"] #batch-import-modal .modal-header,
html[data-theme="dark"] #batch-import-modal .modal-body,
html[data-theme="dark"] #batch-import-modal .modal-footer,
html[data-theme="dark"] #add-batch-task-modal .modal-content,
html[data-theme="dark"] #add-batch-task-modal .modal-header,
html[data-theme="dark"] #add-batch-task-modal .modal-body,
html[data-theme="dark"] #add-batch-task-modal .modal-footer {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}
html[data-theme="dark"] #batch-import-modal .modal-header h2,
html[data-theme="dark"] #add-batch-task-modal .modal-header h2 {
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    background: none !important;
}
html[data-theme="dark"] #batch-import-modal .form-group label,
html[data-theme="dark"] #add-batch-task-modal .form-group label {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] #batch-import-modal .form-hint,
html[data-theme="dark"] #add-batch-task-modal .form-hint {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #batch-import-modal input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] #batch-import-modal textarea,
html[data-theme="dark"] #batch-import-modal select,
html[data-theme="dark"] #add-batch-task-modal input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] #add-batch-task-modal textarea,
html[data-theme="dark"] #add-batch-task-modal select {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}
html[data-theme="dark"] #batch-import-modal input::placeholder,
html[data-theme="dark"] #batch-import-modal textarea::placeholder,
html[data-theme="dark"] #add-batch-task-modal input::placeholder,
html[data-theme="dark"] #add-batch-task-modal textarea::placeholder {
    color: var(--text-muted) !important;
}

/* Project detail tabs dark-mode final pass. */
/* Restore select chevron after dark-mode background shorthand resets repeat/position */
html[data-theme="dark"] .form-group select {
    background-color: #0f172a !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a7b0c0' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
}
.workflow-list-item.is-active {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.08);
    box-shadow: inset 3px 0 0 var(--accent-color);
}
.workflow-status-toggle.is-enabled {
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.22);
    background: rgba(34, 197, 94, 0.09);
}
.workflow-status-toggle.is-disabled {
    color: var(--text-secondary);
    border-color: var(--border-color);
    background: var(--bg-secondary);
}
.workflow-status-toggle.is-enabled .workflow-status-dot {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.14);
}
html[data-theme="dark"] .workflow-status-toggle.is-enabled {
    color: #86efac;
    border-color: rgba(74, 222, 128, 0.20);
    background: rgba(34, 197, 94, 0.10);
}
html[data-theme="dark"] .workflow-status-toggle.is-disabled {
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.16);
    background: rgba(148, 163, 184, 0.07);
}
.workflow-canvas-title.is-disabled {
    opacity: 0.7;
}
.workflow-meta-modal-content .modal-header.workflow-meta-modal-header {
    padding: 8px 12px !important;
    min-height: 0;
    box-shadow: none;
}
.workflow-meta-modal-content .modal-header.workflow-meta-modal-header h2 {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}
.workflow-meta-modal-content .modal-body.workflow-meta-modal-body {
    display: grid;
    gap: 6px;
    padding: 8px 12px !important;
    flex: 0 0 auto !important;
    overflow: visible;
}
.workflow-meta-modal-content .modal-footer.workflow-meta-modal-footer {
    padding: 6px 12px !important;
    gap: 6px;
    flex-shrink: 0;
}
.workflow-meta-modal-content .workflow-meta-field.form-group {
    gap: 2px;
    margin: 0 !important;
}
.workflow-meta-modal-content .workflow-meta-field .form-input {
    padding: 5px 8px;
    font-size: 13px;
    line-height: 1.3;
    min-height: 0;
    height: 30px;
    box-sizing: border-box;
}
.workflow-dry-run-modal-field.form-group {
    gap: 7px;
    margin: 0;
}
.workflow-dry-run-modal-field .form-input {
    height: 38px;
    box-sizing: border-box;
}
.workflow-dry-run-modal-field .form-hint {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}
.workflow-ai-progress .is-active {
    border-color: color-mix(in srgb, var(--accent-color) 45%, var(--border-color));
    color: var(--text-primary);
}
.workflow-ai-progress .is-active b {
    background: var(--accent-color);
    color: white;
}
@media (max-width: 640px) {
    .workflow-ai-progress {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workflow-ai-result-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.workflow-toolbar .btn-small {
    min-height: 30px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
}
.workflow-toolbar .active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}
@media (max-width: 1100px) {
    .workflow-toolbar-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .workflow-toolbar .btn-small,
    .workflow-more-actions-trigger {
        width: 32px;
        min-width: 32px;
        padding-inline: 0;
    }

    .workflow-save-button {
        width: auto !important;
        min-width: 38px !important;
        padding-inline: 11px !important;
    }
}
#workflow-canvas {
    width: 100%;
    height: 100%;
    min-height: 520px;
    background:
        radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.22) 1px, transparent 0);
    background-size: 22px 22px;
}
.workflow-form-select-ui.open .workflow-form-select-trigger {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.workflow-form-select-ui.open {
    z-index: 120;
}
.workflow-form-select-ui.is-disabled .workflow-form-select-trigger {
    opacity: 0.6;
    cursor: not-allowed;
}
.workflow-form-select-ui.open .workflow-form-select-caret {
    transform: rotate(180deg);
}
.workflow-form-select-ui.open .workflow-form-select-dropdown {
    display: block;
}
.workflow-form-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}
.workflow-form-select-option.is-selected .workflow-form-select-check {
    visibility: visible;
}
.workflow-tool-select.open .workflow-tool-select-caret {
    transform: rotate(180deg);
}
.workflow-tool-select.open .workflow-tool-select-trigger {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}
.workflow-tool-select.is-disabled .workflow-tool-select-trigger {
    cursor: not-allowed;
    opacity: 0.56;
    background: var(--bg-secondary, #f5f6f8);
}
.workflow-tool-select.open .workflow-tool-select-dropdown {
    display: flex;
}
.workflow-tool-select-option.is-selected {
    color: var(--accent-color);
    font-weight: 600;
    background: rgba(0, 102, 255, 0.08);
}
.workflow-tool-select-option.is-selected .workflow-tool-select-check {
    opacity: 1;
}
@media (max-width: 1400px) {
    .workflow-page-content {
        grid-template-columns: clamp(180px, 14vw, 220px) minmax(0, 1fr);
    }

    .workflow-properties {
        grid-column: 1 / -1;
        grid-row: 2;
        max-height: min(42vh, 420px);
    }

    .workflow-sidebar {
        grid-row: 1;
    }

    .workflow-main {
        grid-row: 1;
    }
}
@media (max-width: 900px) {
    .workflow-page-content {
        grid-template-columns: minmax(0, 1fr);
    }

    .workflow-sidebar {
        grid-column: 1 / -1;
    }

    .workflow-main {
        grid-column: 1 / -1;
    }
}
/* Platform RBAC */
.platform-rbac-page .page-content {
    overflow: hidden;
}
.platform-rbac-page .page-header { align-items: center; }
.rbac-overview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.rbac-metric {
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
}
.rbac-metric span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.2;
}
.rbac-metric strong {
    display: block;
    margin-top: 6px;
    color: var(--text-primary);
    font-size: 1.375rem;
    line-height: 1;
}
.rbac-layout {
    display: grid;
    grid-template-columns: minmax(280px, 328px) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.rbac-panel {
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}
.rbac-panel-head,
.rbac-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}
.rbac-panel-head h3,
.rbac-detail-head h3 {
    margin: 0;
    font-size: 1rem;
}
.rbac-muted {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}
.rbac-count,
.rbac-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.2;
    white-space: nowrap;
}
.rbac-pill.is-ok {
    color: #166534;
    border-color: rgba(22, 101, 52, 0.24);
    background: rgba(22, 101, 52, 0.08);
}
.rbac-pill.is-muted {
    color: var(--text-muted);
}
.rbac-list,
.rbac-tab-panel {
    min-height: 0;
    overflow: auto;
    padding: 12px;
}
.rbac-search {
    padding: 12px 14px 0;
}
.rbac-search .form-input {
    width: 100%;
    min-height: 36px;
    border-radius: 8px;
}
.rbac-user-row.is-active {
    border-color: rgba(37, 99, 235, 0.28);
    background: rgba(37, 99, 235, 0.05);
}
.rbac-detail-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.rbac-selected-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.rbac-selected-summary:empty {
    display: none;
}
.rbac-selected-summary div {
    min-width: 0;
}
.rbac-selected-summary span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.71875rem;
}
.rbac-selected-summary strong {
    display: block;
    margin-top: 3px;
    color: var(--text-primary);
    font-size: 0.9375rem;
}
.rbac-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 12px 0;
}
.rbac-tab {
    border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 8px 12px;
    cursor: pointer;
}
.rbac-tab.is-active {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-bottom-color: var(--bg-primary);
}
.rbac-section-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.rbac-section-toolbar strong {
    display: block;
    font-size: 0.9375rem;
}
.rbac-role-save-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}
.rbac-unsaved-indicator {
    color: #9a3412;
    font-size: 0.75rem;
}
.rbac-unsaved-indicator[hidden] { display: none !important; }
.rbac-role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.rbac-role-card-head,
.rbac-role-card-foot,
.rbac-assignment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.rbac-role-card-foot {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}
.rbac-assignment-toolbar .btn-primary {
    align-self: end;
}
.rbac-assignments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rbac-resource-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
    max-height: 260px;
    margin-bottom: 12px;
    overflow: auto;
}
.rbac-resource-option-main {
    flex: 1;
    min-width: 0;
}
.rbac-resource-option-main strong,
.rbac-resource-option-main small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-resource-option-main strong {
    color: var(--text-primary);
    font-size: 0.8125rem;
}
.rbac-resource-option-main small,
.rbac-resource-option-detail {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 0.6875rem;
}
.rbac-resource-option-detail {
    flex-shrink: 0;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-picker-status {
    grid-column: 1 / -1;
    padding: 28px 16px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    text-align: center;
}
.rbac-picker-status.is-error { color: var(--danger-color, #dc2626); }
.rbac-assignment-row {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--bg-primary);
}
.rbac-metric-context {
    display: inline-flex;
    flex: 1 1 160px;
    align-items: center;
    gap: 7px;
    min-width: 0;
    max-width: min(25%, 360px);
    min-height: 36px;
    margin: 0;
    padding: 5px 7px 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
}
.rbac-metric-context[hidden] {
    display: none !important;
}
.rbac-context-label {
    flex: 0 0 auto;
    color: var(--text-muted);
}
.rbac-context-member {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.8125rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-context-stat {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: baseline;
    gap: 3px;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--bg-secondary);
}
.rbac-context-stat b {
    color: var(--accent-color);
    font-size: 0.8125rem;
}
.rbac-metric-enabled[hidden] {
    display: none !important;
}
.rbac-summary-permissions {
    position: relative;
}
.rbac-summary-count {
    display: block;
    margin-top: 3px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.2;
}
.rbac-summary-count--interactive {
    display: inline-flex;
    align-items: center;
    margin-top: 3px;
    padding: 0 0 1px;
    border: none;
    border-bottom: 1px dashed color-mix(in srgb, var(--text-secondary) 55%, transparent);
    border-radius: 0;
    background: none;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.rbac-summary-count--interactive:hover {
    color: var(--text-primary);
    border-bottom-color: color-mix(in srgb, var(--text-secondary) 80%, transparent);
}
.rbac-summary-count--interactive[aria-expanded="true"] {
    color: var(--text-primary);
    border-bottom-color: var(--text-secondary);
    border-bottom-style: solid;
}
.rbac-summary-count--interactive:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--text-secondary) 35%, transparent);
    outline-offset: 3px;
}
.rbac-permissions-popover {
    position: fixed;
    z-index: 220;
    width: min(380px, calc(100vw - 32px));
}
.rbac-permissions-popover[hidden] {
    display: none !important;
}
.rbac-permissions-popover-inner {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-md, 0 8px 24px rgba(15, 23, 42, 0.12));
}
.rbac-permissions-popover-inner::before {
    content: '';
    position: absolute;
    top: -5px;
    left: var(--rbac-popover-arrow-left, 18px);
    width: 10px;
    height: 10px;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    transform: rotate(45deg);
}
.rbac-permissions-popover-count {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}
.rbac-permissions-popover .rbac-effective-permissions-body {
    max-height: min(320px, calc(100vh - 180px));
}
.rbac-effective-permissions-head,
.rbac-effective-module h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.rbac-effective-permissions-head {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}
.rbac-effective-permissions-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 240px;
    padding: 10px 12px 12px;
    overflow-y: auto;
}
.rbac-effective-module h4 {
    margin: 0 0 6px;
    font-size: 0.8125rem;
}
.rbac-effective-module h4 span {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}
.rbac-effective-permission-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.rbac-effective-permission-tags span {
    padding: 3px 8px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.6875rem;
}
.rbac-audit-list {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: contain;
}
.rbac-panel-detail #rbac-tab-audit.rbac-tab-panel:not([hidden]) {
    container-name: rbac-audit;
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
#rbac-tab-audit .rbac-audit-toolbar,
#rbac-tab-audit .rbac-pagination {
    flex: 0 0 auto;
}
.rbac-audit-table {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: 0;
}
.rbac-audit-table-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--text-muted) 60%, transparent) transparent;
}
.rbac-audit-table-body::-webkit-scrollbar {
    width: 6px;
}
.rbac-audit-table-body::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-muted) 52%, transparent);
}
.rbac-audit-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: end;
    gap: 20px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-secondary) 72%, var(--bg-primary));
}
.rbac-audit-heading {
    min-width: 0;
    padding-bottom: 2px;
}
.rbac-audit-heading strong {
    display: block;
}
.rbac-audit-heading .rbac-muted {
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-audit-filterbar {
    display: grid;
    grid-template-columns: 200px 220px;
    justify-content: end;
    gap: 10px;
    min-width: 0;
}
.rbac-audit-filter {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.rbac-audit-filter > span {
    flex: none;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.71875rem;
    font-weight: 600;
}
.rbac-audit-filter .settings-custom-select,
.rbac-audit-filter .form-select,
.rbac-audit-filter .form-input {
    width: 100%;
    min-width: 0;
}
.rbac-audit-filter .settings-custom-select-trigger,
.rbac-audit-filter .form-select,
.rbac-audit-filter .form-input {
    min-height: 38px;
    height: 38px;
}
.rbac-audit-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 54px;
    margin: 10px 0 0;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.rbac-audit-pagination-meta,
.rbac-audit-pagination-nav,
.rbac-audit-page-size-control {
    display: flex;
    align-items: center;
}
.rbac-audit-pagination-meta {
    gap: 16px;
    min-width: 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
}
.rbac-audit-page-size-control {
    gap: 8px;
    white-space: nowrap;
}
.rbac-audit-page-size-control .settings-custom-select,
.rbac-audit-page-size-control .form-select {
    width: 82px;
    min-width: 82px;
}
.rbac-audit-page-size-control .settings-custom-select-trigger,
.rbac-audit-page-size-control .form-select {
    min-height: 34px;
    height: 34px;
}
.rbac-audit-page-size-control .settings-custom-select-menu {
    top: auto;
    bottom: calc(100% + 6px);
}
.rbac-audit-pagination-nav {
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 8px;
}
.rbac-audit-pagination-nav > span {
    min-width: 76px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-align: center;
    white-space: nowrap;
}
@container rbac-page (max-width: 900px) {
    .rbac-audit-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .rbac-audit-pagination-meta,
    .rbac-audit-pagination-nav {
        justify-content: space-between;
    }
}
.rbac-audit-table-head,
.rbac-audit-row {
    display: grid;
    grid-template-columns:
        minmax(130px, 0.85fr)
        minmax(90px, 0.55fr)
        minmax(80px, 0.5fr)
        minmax(320px, 2.1fr)
        minmax(180px, max-content);
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.rbac-audit-table-head {
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
}
.rbac-audit-row {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-bottom: 0;
    border-radius: 0;
    background: var(--bg-primary);
    font-size: 0.8125rem;
    line-height: 1.4;
}
.rbac-audit-row:last-child {
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
}
.rbac-audit-action {
    flex: 0 0 auto;
    font-weight: 600;
}
.rbac-audit-actor {
    justify-self: start;
}
.rbac-audit-cell-value {
    min-width: 0;
}
.rbac-audit-detail {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.75rem;
}
.rbac-audit-resource-id {
    overflow: visible;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    text-overflow: clip;
}
.rbac-audit-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
}
@container rbac-audit (max-width: 1000px) {
    .rbac-audit-table-head,
    .rbac-audit-row {
        grid-template-columns:
            minmax(110px, 0.82fr)
            minmax(72px, 0.5fr)
            minmax(62px, 0.42fr)
            minmax(230px, 1.9fr)
            minmax(145px, 0.95fr);
        gap: 8px;
        padding-right: 10px;
        padding-left: 10px;
    }

    .rbac-audit-resource-id {
        overflow-wrap: anywhere;
        white-space: normal;
    }
}
@container rbac-audit (max-width: 740px) {
    .rbac-audit-table-head {
        display: none;
    }

    .rbac-audit-table-body {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .rbac-audit-row,
    .rbac-audit-row:last-child {
        flex: 0 0 auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 16px;
        padding: 12px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
    }

    .rbac-audit-row > [role="cell"] {
        display: grid;
        grid-template-columns: 68px minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        min-width: 0;
        overflow: visible;
        white-space: normal;
    }

    .rbac-audit-row > [role="cell"]::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-family: inherit;
        font-size: 0.6875rem;
        font-weight: 500;
        line-height: 1.2;
    }

    .rbac-audit-row .rbac-audit-actor {
        justify-self: stretch;
    }

    .rbac-audit-row .rbac-audit-resource-id {
        grid-column: 1 / -1;
        overflow-wrap: anywhere;
    }

    .rbac-audit-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .rbac-audit-pagination-meta,
    .rbac-audit-pagination-nav {
        justify-content: space-between;
    }
}
@container rbac-audit (max-width: 620px) {
    .rbac-audit-toolbar {
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
        gap: 10px;
    }

    .rbac-audit-filterbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
        width: 100%;
    }
}
@container rbac-audit (max-width: 520px) {
    .rbac-audit-filterbar {
        grid-template-columns: minmax(0, 1fr);
    }

    .rbac-audit-row,
    .rbac-audit-row:last-child {
        grid-template-columns: minmax(0, 1fr);
    }

    .rbac-audit-row .rbac-audit-resource-id {
        grid-column: auto;
    }

    .rbac-audit-pagination-meta,
    .rbac-audit-pagination-nav {
        flex-wrap: wrap;
        gap: 8px;
    }
}
.rbac-user-roles-readonly {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}
.rbac-readonly-role {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}
.rbac-empty.is-compact {
    min-height: auto;
    padding: 12px;
}
.rbac-assignment-row code {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}
.rbac-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}
.rbac-checkbox-item {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
}
.rbac-permission-groups {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 48vh;
    overflow: auto;
    padding-right: 4px;
}
.rbac-permission-tools {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    gap: 8px;
    margin-bottom: 12px;
}
.rbac-permission-tools .form-input {
    min-height: 36px;
}
.rbac-permission-group {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}
.rbac-permission-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.rbac-permission-group-head h4 {
    margin: 0;
    font-size: 0.875rem;
}
.rbac-permission-group-head h4 small {
    margin-left: 8px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.6875rem;
    font-weight: 500;
}
.rbac-permission-group-head span {
    color: var(--text-secondary);
    font-size: 0.75rem;
}
@media (max-width: 980px) {
    .rbac-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rbac-layout {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
    }

    .rbac-selected-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rbac-permission-tools {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* RBAC adaptive polish: one scroll surface, predictable controls and dense admin layouts. */
.platform-rbac-page,
.platform-rbac-page *,
#rbac-user-modal,
#rbac-user-modal *,
#rbac-role-modal,
#rbac-role-modal * {
    box-sizing: border-box;
}
.platform-rbac-page > .page-content {
    container-name: rbac-page;
    container-type: inline-size;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 20px 24px;
}
.platform-rbac-page > .page-header {
    position: relative;
    z-index: 2;
    gap: 16px;
    padding: 14px 20px;
}
.platform-rbac-page > .page-header > div:first-child {
    min-width: 0;
}
.platform-rbac-page .page-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}
.platform-rbac-page :is(input.form-input, select.form-select),
#rbac-user-modal .form-input,
#rbac-role-modal :is(.form-input, .form-select) {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 8px 11px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.8125rem;
    line-height: 1.25;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.platform-rbac-page select.form-select,
#rbac-role-modal select.form-select {
    padding-right: 32px;
}
.platform-rbac-page :is(input.form-input, select.form-select):hover,
#rbac-user-modal .form-input:hover,
#rbac-role-modal :is(.form-input, .form-select):hover {
    border-color: color-mix(in srgb, var(--accent-color) 38%, var(--border-color));
}
.platform-rbac-page :is(input.form-input, select.form-select):focus,
#rbac-user-modal .form-input:focus,
#rbac-role-modal :is(.form-input, .form-select):focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
}
.platform-rbac-page input.form-input::placeholder,
#rbac-user-modal .form-input::placeholder,
#rbac-role-modal .form-input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}
.platform-rbac-page input[type="search"]::-webkit-search-cancel-button {
    cursor: pointer;
}
.platform-rbac-page :is(.btn-primary, .btn-secondary):disabled,
#rbac-user-modal :is(.btn-primary, .btn-secondary):disabled,
#rbac-role-modal :is(.btn-primary, .btn-secondary):disabled {
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.48;
}
.rbac-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}
.rbac-overview {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
    margin-bottom: 0;
}
.rbac-metric {
    --rbac-metric-accent: var(--primary-color, #2563eb);
    --rbac-metric-bg: rgba(37, 99, 235, 0.09);
    --rbac-metric-border: rgba(37, 99, 235, 0.34);
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    width: fit-content;
    min-width: 0;
    padding: 7px 11px;
    border-color: var(--rbac-metric-border);
    border-radius: 999px;
    background: var(--rbac-metric-bg);
}
.rbac-metric strong {
    order: -1;
    margin-top: 0;
    color: var(--rbac-metric-accent);
    font-size: 0.9375rem;
    font-weight: 800;
    line-height: 1;
}
.rbac-metric span {
    color: var(--rbac-metric-accent);
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
.rbac-metric-users,
.rbac-metric-enabled {
    --rbac-metric-accent: #2563eb;
    --rbac-metric-bg: rgba(37, 99, 235, 0.09);
    --rbac-metric-border: rgba(37, 99, 235, 0.34);
}
.rbac-metric-roles {
    --rbac-metric-accent: #7c3aed;
    --rbac-metric-bg: rgba(124, 58, 237, 0.1);
    --rbac-metric-border: rgba(124, 58, 237, 0.34);
}
.rbac-metric-assignments {
    --rbac-metric-accent: #ea580c;
    --rbac-metric-bg: rgba(234, 88, 12, 0.1);
    --rbac-metric-border: rgba(234, 88, 12, 0.34);
}
.rbac-workspace-nav {
    flex: 0 0 auto;
    width: auto;
    margin-bottom: 0;
    align-self: center;
    border-radius: 999px;
}
.rbac-workspace-tab {
    flex: 0 0 auto;
    min-width: 0;
    padding: 7px 12px;
    border-radius: 999px;
    text-align: center;
    white-space: nowrap;
}
.rbac-workspace-tab span {
    font-size: 0.8125rem;
}
.rbac-workspace-tab small {
    display: none;
}
.rbac-layout {
    grid-template-columns: minmax(280px, 328px) minmax(0, 1fr);
    align-items: stretch;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.rbac-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-radius: 10px;
}
.rbac-panel-users {
    position: static;
    height: auto;
    max-height: none;
}
.rbac-panel-users .rbac-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 8px 12px;
}
.rbac-panel-detail {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}
.rbac-panel-detail .rbac-detail-head,
.rbac-panel-detail .rbac-selected-summary,
.rbac-panel-detail .rbac-tabs {
    flex: 0 0 auto;
}
.rbac-panel-detail .rbac-tab-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 14px;
}
.rbac-panel-detail #rbac-tab-roles.rbac-tab-panel:not([hidden]) {
    overflow-y: auto;
    overscroll-behavior: contain;
}
.rbac-panel-detail #rbac-tab-assignments.rbac-tab-panel:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.rbac-panel-detail .rbac-selected-summary {
    padding: 0;
}
.rbac-panel-detail .rbac-selected-summary > div {
    padding: 9px 12px;
}
.rbac-panel-detail .rbac-selected-summary span {
    font-size: 0.6875rem;
}
.rbac-panel-detail .rbac-selected-summary strong {
    margin-top: 2px;
    font-size: 0.875rem;
}
.rbac-panel-detail .rbac-selected-summary .rbac-summary-count--interactive {
    margin-top: 2px;
    font-size: 0.875rem;
}
.rbac-panel-detail .rbac-detail-head {
    min-height: 0;
    padding: 8px 14px;
}
.rbac-panel-detail .rbac-detail-head h3 {
    display: flex;
    min-width: 0;
    align-items: baseline;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0;
    overflow: hidden;
    font-size: 0.9375rem;
    line-height: 1.3;
}
.rbac-detail-name {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-detail-meta {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-panel-detail .rbac-detail-head .rbac-muted[hidden] {
    display: none !important;
}
.rbac-panel-detail .rbac-tabs {
    gap: 12px;
    padding: 0 12px;
}
.rbac-panel-head,
.rbac-detail-head {
    min-height: 0;
    padding: 8px 14px;
}
.rbac-detail-head > div:first-child,
.rbac-panel-head > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}
.rbac-detail-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
}
.rbac-search {
    padding: 12px;
}
.rbac-search .form-input {
    min-height: 40px;
    border-radius: 8px;
}
.rbac-selected-summary {
    gap: 0;
    padding: 0;
}
.rbac-selected-summary > div {
    padding: 12px 15px;
    border-right: 1px solid var(--border-color);
}
.rbac-selected-summary > div:last-child {
    border-right: 0;
}
.rbac-tabs {
    gap: 18px;
    padding: 0 15px;
    border-bottom: 1px solid var(--border-color);
}
.rbac-tab {
    margin-bottom: -1px;
    padding: 11px 1px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    font-size: 0.8125rem;
}
.rbac-tab.is-active {
    border-bottom-color: var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    font-weight: 600;
}
.rbac-section-toolbar {
    align-items: center;
    flex-wrap: wrap;
    row-gap: 10px;
    padding-bottom: 2px;
}
.rbac-section-toolbar > div:first-child {
    flex: 1 1 280px;
    min-width: 0;
}
.rbac-role-save-actions {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.rbac-role-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    align-items: stretch;
    gap: 10px;
}
.rbac-role-card-head {
    align-items: flex-start;
}
.rbac-role-card-head .checkbox-label {
    min-width: 0;
}
.rbac-role-card-foot {
    align-content: flex-start;
    justify-content: flex-start;
    gap: 6px 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
}
/* Assignment and permission choices are selections,
not on/off switches. */
:is(.rbac-role-card, .rbac-resource-option, .rbac-checkbox-item) .checkbox-custom {
    width: 18px;
    height: 18px;
    border-width: 1px;
    border-radius: 5px;
    box-shadow: none;
}
:is(.rbac-role-card, .rbac-resource-option, .rbac-checkbox-item) .checkbox-custom::before {
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 0;
    transform: rotate(45deg);
}
:is(.rbac-role-card, .rbac-resource-option, .rbac-checkbox-item) .modern-checkbox:checked + .checkbox-custom {
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.10);
}
:is(.rbac-role-card, .rbac-resource-option, .rbac-checkbox-item) .modern-checkbox:checked + .checkbox-custom::before {
    opacity: 1;
    transform: rotate(45deg);
}
.rbac-assignment-toolbar .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 142px;
}
.platform-rbac-page :is(.rbac-detail-actions, .rbac-role-save-actions, .rbac-assignment-toolbar, .rbac-role-management-actions) .btn-primary {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: #fff;
}
.platform-rbac-page :is(.rbac-detail-actions, .rbac-role-save-actions, .rbac-assignment-toolbar, .rbac-role-management-actions) .btn-primary:hover:not(:disabled) {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
}
.rbac-assignment-help {
    padding: 0 2px;
}
.rbac-resource-picker {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.rbac-resource-picker .rbac-resource-option {
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr) minmax(90px, 0.75fr) minmax(60px, 0.55fr) max-content;
    gap: 10px;
    height: 58px;
    min-height: 58px;
    padding: 8px 2px;
    box-sizing: border-box;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent);
    border-radius: 0;
    background: transparent;
}
.rbac-resource-picker .rbac-resource-option:last-child {
    border-bottom: 0;
}
.rbac-resource-picker .rbac-resource-option:hover:not(.is-assigned) {
    background: color-mix(in srgb, var(--accent-color) 3%, var(--bg-primary));
}
.rbac-resource-picker .rbac-resource-option:has(input:checked) {
    background: color-mix(in srgb, var(--accent-color) 6%, var(--bg-primary));
}
.rbac-resource-picker .rbac-resource-option.is-assigned {
    opacity: 1;
}
.rbac-resource-picker .rbac-resource-option.is-assigned .rbac-resource-option-main {
    opacity: 0.72;
}
.rbac-resource-option-id {
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-resource-copy {
    min-height: 28px;
    padding: 3px 6px;
    font-size: 0.75rem;
}
.rbac-assignments-list {
    flex: 1 1 auto;
    gap: 0;
    min-height: 0;
    max-height: none;
    padding: 0 12px;
}
.rbac-assignments-list .rbac-assignment-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.25fr) minmax(100px, 0.8fr) minmax(80px, 0.7fr) max-content;
    align-items: center;
    gap: 12px;
    height: 58px;
    min-height: 58px;
    padding: 8px 10px;
    box-sizing: border-box;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent);
    border-radius: 0;
    background: transparent;
}
.rbac-assignments-list .rbac-assignment-row:last-child {
    border-bottom: 0;
}
.rbac-assignments-list .rbac-assignment-row:hover {
    background: color-mix(in srgb, var(--accent-color) 3%, var(--bg-primary));
}
.rbac-assignment-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.rbac-assignment-identity strong {
    overflow: hidden;
    font-size: 0.8125rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-assignments-list .rbac-assignment-id {
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-assignment-detail {
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rbac-assignment-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.rbac-assignment-actions .btn-link {
    min-height: 28px;
    padding: 3px 6px;
    font-size: 0.75rem;
}
.rbac-assignment-actions .btn-link.is-danger {
    color: var(--danger-color, #dc2626);
}
@container rbac-page (max-width: 720px) {
    .rbac-resource-picker .rbac-resource-option {
        grid-template-columns: auto minmax(0, 1fr) max-content;
        height: auto;
        min-height: 72px;
    }

    .rbac-resource-option-id,
    .rbac-resource-option-detail {
        grid-column: 2;
    }

    .rbac-resource-copy {
        grid-column: 3;
        grid-row: 1 / span 3;
    }

    .rbac-assignments-list .rbac-assignment-row {
        grid-template-columns: minmax(0, 1fr) max-content;
        height: auto;
        min-height: 72px;
    }

    .rbac-assignment-id,
    .rbac-assignment-detail {
        grid-column: 1;
    }

    .rbac-assignment-actions {
        grid-column: 2;
        grid-row: 1 / span 3;
    }
}
.rbac-picker-status {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rbac-role-management {
    min-height: 0;
    padding: 18px;
    border-radius: 10px;
}
.rbac-role-management-head {
    align-items: flex-end;
    flex-wrap: wrap;
    row-gap: 12px;
}
.rbac-role-management-head > div:first-child {
    flex: 1 1 320px;
    min-width: 0;
}
.rbac-role-management-actions {
    display: grid;
    grid-template-columns: minmax(240px, 340px) max-content;
    align-items: end;
    flex: 0 1 auto;
    gap: 10px;
    min-width: 0;
}
.rbac-toolbar-search {
    min-width: 0;
}
.rbac-toolbar-search label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
}
.rbac-role-management-actions .form-input {
    width: 100%;
    min-height: 40px;
}
.rbac-role-management-actions .btn-primary {
    min-height: 40px;
}
.rbac-role-catalog {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
    align-items: stretch;
}
.rbac-catalog-card {
    display: flex;
    flex-direction: column;
}
.rbac-module-tags {
    align-content: flex-start;
}
.rbac-catalog-card-foot {
    margin-top: auto;
}
#rbac-user-modal .modal-content,
#rbac-role-modal .modal-content {
    width: calc(100% - 32px);
    max-height: calc(100vh - 40px);
}
#rbac-user-modal .modal-body,
#rbac-role-modal .modal-body {
    min-height: 0;
    overflow-y: auto;
}
#rbac-user-modal .rbac-checkbox-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}
#rbac-role-modal .rbac-permission-tools {
    grid-template-columns: minmax(220px, 1fr) max-content max-content;
    align-items: center;
}
#rbac-role-modal .rbac-permission-groups {
    max-height: min(48vh, 520px);
}
@container rbac-page (max-width: 1050px) {
    .rbac-layout {
        grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
        gap: 12px;
    }

    .rbac-role-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .rbac-assignment-toolbar-main {
        grid-template-columns: minmax(120px, 155px) minmax(220px, 1fr);
    }

    .rbac-assignment-toolbar-main .btn-primary {
        grid-column: 1 / -1;
        width: 100%;
    }
}
@container rbac-page (max-width: 760px) {
    .rbac-topbar {
        flex-direction: column;
    }

    .rbac-workspace-nav {
        flex-basis: auto;
        width: min(100%, 540px);
    }

    .rbac-resource-filterbar {
        grid-template-columns: minmax(0, 1fr);
    }

    .rbac-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rbac-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .rbac-panel-users {
        position: static;
        height: min(420px, 60vh);
        max-height: min(420px, 60vh);
    }

    .rbac-selected-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rbac-selected-summary > div:nth-child(2) {
        border-right: 0;
    }

    .rbac-selected-summary > div:nth-child(-n+2) {
        border-bottom: 1px solid var(--border-color);
    }

    .rbac-role-management-actions {
        width: 100%;
        grid-template-columns: minmax(0, 1fr) max-content;
    }

    .rbac-assignment-toolbar-main {
        grid-template-columns: minmax(120px, 160px) minmax(0, 1fr);
    }

}
@container rbac-page (max-width: 560px) {
    .rbac-workspace-nav {
        flex-direction: column;
        width: 100%;
    }

    .rbac-detail-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .rbac-detail-actions,
    .rbac-detail-actions > button {
        width: 100%;
    }

    .rbac-assignment-toolbar-main,
    .rbac-role-management-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .rbac-assignment-toolbar-main .btn-primary,
    .rbac-role-management-actions .btn-primary {
        grid-column: auto;
        width: 100%;
    }

    #rbac-role-modal .rbac-permission-tools {
        grid-template-columns: minmax(0, 1fr);
    }
}
@media (max-width: 720px) {
    #rbac-user-modal .modal-content,
    #rbac-role-modal .modal-content {
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
    }

    #rbac-role-modal .rbac-permission-tools {
        grid-template-columns: minmax(0, 1fr);
    }
}
.asset-period-switch button.active { background: rgba(59,130,246,.12); color: #2563eb; font-weight: 650; }
.asset-custom-select.open .settings-custom-select-caret { transform: rotate(180deg); }
.asset-custom-select .settings-custom-select-option.is-selected { background: rgba(59,130,246,.12); color: var(--accent-color,#2563eb); }
.asset-row-actions .btn-link { margin-right: 8px; }
.asset-import-preview-section .form-hint { margin: 9px 0 0; color: var(--text-secondary, #64748b); font-size: 12px; }
#asset-project-modal { align-items: center; justify-content: center; box-sizing: border-box; padding: 24px; }
.asset-project-content .modal-header { padding: 24px 28px 18px; }
.asset-project-content .modal-body { padding: 18px 28px 24px; overflow: visible; }
.asset-project-content .modal-footer { padding: 16px 28px 22px; }
.asset-project-content .form-hint { margin: 12px 0 0; color: var(--text-secondary, #64748b); font-size: 13px; line-height: 1.6; }
.asset-project-content .settings-custom-select-option.is-disabled { display: none; }
.asset-scan-modal .form-hint { display: block; margin: 8px 0 14px; color: var(--text-secondary, #64748b); }
.asset-editor-content .modal-header { padding: 20px 24px; }
.asset-editor-content .modal-header > div { min-width: 0; }
.asset-editor-content .modal-header h2 { font-size: 20px; }
.asset-editor-content .modal-footer { position: relative; background: var(--bg-primary, #fff); box-shadow: 0 -8px 24px rgba(15,23,42,.04); }
#asset-edit-protocol { appearance: none; -webkit-appearance: none; }
#asset-edit-protocol::-webkit-calendar-picker-indicator { display: none !important; opacity: 0; pointer-events: none; }
.asset-detail-modal .modal-header {
    align-items: flex-start;
    padding: 20px 24px 16px;
    border-radius: 16px 0 0 0;
    background: var(--bg-primary, #fff);
    box-shadow: none;
}
.asset-detail-modal .modal-header h2 { font-size: 19px; letter-spacing: 0; }
.asset-detail-modal .modal-header .asset-page-subtitle { max-width: 520px; margin-top: 6px; font-size: 13px; color: var(--text-secondary, #64748b); overflow-wrap: anywhere; }
.asset-detail-modal .modal-close { margin-top: -2px; }
.asset-detail-modal .modal-body {
    padding: 18px 24px 22px;
    background: transparent;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.asset-detail-modal .modal-footer {
    flex-shrink: 0;
    padding: 14px 24px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-primary, #fff);
    box-shadow: 0 -6px 18px rgba(15,23,42,.04);
}

/* Asset management dark theme */
html[data-theme="dark"] .asset-stat-card,
html[data-theme="dark"] .asset-total-card,
html[data-theme="dark"] .asset-recent-card,
html[data-theme="dark"] .asset-panel,
html[data-theme="dark"] .asset-toolbar,
html[data-theme="dark"] .asset-list-card,
html[data-theme="dark"] .asset-period-switch button.active {
    background: rgba(96,165,250,.16);
    color: #93c5fd;
}
html[data-theme="dark"] .asset-row-actions .btn-link {
    color: #60a5fa;
}

html[data-theme="dark"] .asset-custom-select .settings-custom-select-option.is-selected { background: rgba(59,130,246,.18); color: #93c5fd; }
html[data-theme="dark"] .asset-detail-modal .modal-header {
    background: var(--bg-primary);
    box-shadow: none;
}
html[data-theme="dark"] .asset-detail-modal .modal-footer {
    border-color: var(--border-color);
    background: var(--bg-primary);
    box-shadow: 0 -6px 18px rgba(0,0,0,.16);
}
html[data-theme="dark"] .asset-editor-content .modal-footer { background: var(--bg-primary); box-shadow: 0 -8px 24px rgba(0,0,0,.12); }
@media (max-width: 1100px) { .asset-advanced-filters { grid-template-columns: repeat(3,minmax(140px,1fr)); } }
@media (max-width: 760px) {
.asset-detail-modal .modal-header {
        padding: 18px 18px 15px;
        border-radius: 0;
    }
.asset-detail-modal .modal-body {
        padding: 16px 18px 20px;
    }
.asset-detail-modal .modal-footer {
        padding: 14px 18px;
    }
}
@media (max-width: 640px) { .asset-editor-grid,.asset-detail-grid { grid-template-columns: 1fr; } .asset-total-card,.asset-recent-card,.asset-panel { padding: 18px; } .asset-type-grid,.asset-coverage-metrics { grid-template-columns: 1fr; } .asset-type-item + .asset-type-item { border-top: 1px solid var(--border-color,#e5e7eb); border-left: 0; } .asset-trend-header { grid-template-columns: 1fr auto; grid-template-areas: "heading summary"; column-gap: 12px; } .asset-chart-legend { display: none; } .asset-chart-summary { justify-content: flex-end; padding: 0; } .asset-chart-summary span { display: none; } .asset-protocol-compact .asset-bar-row,.asset-protocol-compact .asset-protocol-columns { grid-template-columns: 72px 1fr 42px; gap: 8px; padding-right: 4px; padding-left: 4px; } .asset-protocol-compact .asset-bar-row small,.asset-protocol-compact .asset-protocol-columns span:last-child { display: none; } .asset-editor-content,.asset-import-content,.asset-bulk-edit-content { width: 100%; max-height: 100vh; min-height: 100vh; margin: 0; border-radius: 0; } .asset-editor-content .modal-header,.asset-editor-body,.asset-editor-content .modal-footer { padding-left: 16px; padding-right: 16px; } .asset-editor-subtitle { max-width: 270px; } .asset-editor-primary { padding: 14px; } .asset-editor-group-heading { align-items: flex-start; flex-wrap: wrap; gap: 3px 8px; } .asset-editor-group-heading p { width: 100%; } .asset-editor-section-group + .asset-editor-section-group { margin-top: 20px; padding-top: 20px; } .asset-editor-wide,.asset-detail-item--wide { grid-column: auto; } .asset-toolbar-main > input { min-width: 100%; } .asset-advanced-filters { grid-template-columns: 1fr 1fr; } .asset-saved-views { align-items: stretch; flex-direction: column; } .asset-saved-views select { width: 100%; min-width: 0; } .asset-custom-select--saved-view { width: 100%; min-width: 0; flex-basis: auto; } .asset-import-template-actions { align-items: flex-start; flex-direction: column; padding-left: 0; } .asset-import-preview-table th:nth-child(3),.asset-import-preview-table td:nth-child(3),.asset-import-preview-table th:nth-child(4),.asset-import-preview-table td:nth-child(4) { display: none; } .asset-batch-selection { flex-wrap: wrap; } .asset-batch-primary-actions { display: grid; grid-template-columns: 1fr 1fr; } .asset-batch-primary-actions > .btn-primary { grid-column: 1 / -1; grid-row: 1; } .asset-batch-more { width: 100%; } .asset-batch-more > summary { width: 100%; } .asset-batch-menu { right: auto; left: 0; width: min(260px,calc(100vw - 48px)); } }
@media (max-width: 640px) { .asset-coverage-metrics > div + div,.asset-coverage-metrics > div:nth-child(4) { border-top: 1px solid var(--border-color,#e5e7eb); border-left: 0; } }
/* Dark UI polish for project-linked tables and asset library. */
html[data-theme="dark"] #page-projects.page,
html[data-theme="dark"] #page-asset-library.page {
    background: #0b1120 !important;
}
html[data-theme="dark"] #page-projects .page-header,
html[data-theme="dark"] #page-asset-library .page-header {
    background: #0d1526 !important;
    border-bottom-color: #223047 !important;
}
html[data-theme="dark"] #page-projects .projects-list-item.is-active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(96, 165, 250, 0.08)) !important;
    border-color: rgba(96, 165, 250, 0.42) !important;
}
html[data-theme="dark"] #page-projects .projects-tab.is-active {
    background: rgba(96, 165, 250, 0.18) !important;
    border-color: rgba(147, 197, 253, 0.62) !important;
    color: #bfdbfe !important;
    box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.18), 0 0 18px rgba(59, 130, 246, 0.12) !important;
}

@media (max-width: 900px),
(hover: none) {
    .project-folder-preview,
    .project-conversation-preview {
        display: none !important;
    }
}
.project-conversation-item.is-selected {
    background: #eef0f2;
    color: #171b20;
    box-shadow: none;
}
.project-conversation-row:hover .project-conversation-item.is-selected {
    background: #e8eaed;
}
.project-conversation-item.is-selected .project-conversation-title {
    font-weight: 650;
}
.project-task-status--approval.is-expired {
    background: #fee2e2;
    color: #b42318;
}
html[data-theme="dark"] .project-task-status--approval.is-expired {
    background: rgba(248, 113, 113, 0.16);
    color: #fca5a5;
}
html[data-theme="dark"] .project-conversation-item.is-selected {
    background: rgba(148, 163, 184, 0.13);
    color: var(--text-primary);
    box-shadow: none;
}
html[data-theme="dark"] .project-conversation-row:hover .project-conversation-item.is-selected {
    background: rgba(148, 163, 184, 0.19);
}
@media (max-width: 900px) {
    .conversation-sidebar {
        width: 260px;
    }

    .conversation-sidebar.collapsed {
        width: 56px;
    }
}
.chat-composer-context .role-selector-btn.active {
    border: 0;
    background: rgba(15, 23, 42, 0.055);
    box-shadow: none;
}
.chat-composer-surface .chat-upload-progress-row:not([hidden]) {
    margin: 12px 22px 0;
}
#chat-model-shortcut.active .chat-system-model-caret {
    transform: rotate(180deg);
}
.chat-system-model-option.is-selected {
    background: rgba(0, 102, 255, 0.08);
}
html[data-theme="dark"] .chat-composer-context .role-selector-btn.active {
    border: 0 !important;
    background: rgba(148, 163, 184, 0.1) !important;
}
html[data-theme="dark"] .chat-system-model-option.is-selected {
    background: rgba(96, 165, 250, 0.12);
}
@media (max-width: 900px) {
    .chat-input-container {
        padding: 0 12px 12px;
    }

    .chat-composer-context {
        min-height: 54px;
        margin-right: 16px;
        margin-left: 16px;
        padding-right: 8px;
        padding-left: 8px;
    }

    .chat-composer-context .role-selector-btn {
        padding-right: 9px;
        padding-left: 9px;
    }

    .chat-composer-context .project-selector-wrapper .role-selector-text {
        max-width: 86px;
    }

    .chat-composer-context #agent-mode-text {
        max-width: 132px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
@media (max-width: 620px) {
    .chat-composer-context .chat-input-leading > *:not(:last-child) {
        margin-right: 1px;
        padding-right: 2px;
    }

    .chat-composer-context .role-selector-btn {
        gap: 5px;
        padding-right: 7px;
        padding-left: 7px;
    }

    .chat-composer-context .role-selector-text {
        max-width: 82px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .chat-composer-footer {
        gap: 6px;
        padding-right: 10px;
        padding-left: 10px;
    }

    .chat-hitl-shortcut {
        max-width: 142px;
        padding-right: 7px;
        padding-left: 7px;
    }

    .chat-model-shortcut-wrap {
        display: none;
    }

    .chat-session-meta {
        padding-right: 5px;
        padding-left: 5px;
    }
}
@container chat-composer (max-width: 520px) {
    .chat-composer-context {
        margin-right: 8px;
        margin-left: 8px;
        padding-right: 7px;
        padding-left: 7px;
    }

    .chat-composer-context .chat-input-leading {
        width: 100%;
    }

    .chat-composer-context .role-selector-btn {
        gap: 5px;
        padding-right: 7px;
        padding-left: 7px;
    }

    .chat-composer-context #agent-mode-text {
        display: none;
    }

    .chat-composer-footer {
        gap: 4px;
        padding-right: 9px;
        padding-left: 9px;
    }

    .chat-hitl-shortcut {
        max-width: 142px;
        padding-right: 7px;
        padding-left: 7px;
    }

    .chat-model-shortcut-wrap {
        display: none;
    }

    .chat-session-meta {
        padding-right: 5px;
        padding-left: 5px;
    }
}
@container chat-composer (max-width: 350px) {
    .chat-composer-context .project-selector-wrapper .role-selector-text,
    .chat-composer-context #role-selector-text {
        max-width: 62px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .chat-hitl-shortcut {
        max-width: 118px;
    }
}
/* Composer-anchored session settings. The original controls are moved here at runtime
   so AI channel {
    position: absolute;
    z-index: 120;
    left: 16px;
    bottom: 60px;
    width: min(360px, calc(100% - 32px));
    max-height: min(68vh, 620px);
    padding: 14px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.99);
    box-shadow: 0 22px 54px rgba(15, 23, 42, 0.2), 0 4px 12px rgba(15, 23, 42, 0.08);
    box-sizing: border-box;
    transform: translateY(0);
    transform-origin: left bottom;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}
@media (prefers-reduced-motion: reduce) {
    .chat-composer-surface > .chat-session-settings-popover {
        transition: none;
    }
}
/* Codex-style assistant turn: execution narrative first {
    margin-bottom: 32px;
}
.message.assistant-turn-with-process .mcp-tool-list.expanded {
    display: none;
}
.message.assistant-turn-with-process .process-details-content .progress-timeline.expanded {
    max-height: min(64vh, 720px);
    margin-top: 4px;
    padding-top: 8px;
}
.message.progress-message .progress-timeline.expanded {
    max-height: min(64vh, 720px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: auto;
    scrollbar-gutter: stable;
}
@media (max-width: 768px) {
    .message.assistant-turn-with-process .timeline-item-iteration.timeline-iteration-divider,
    .message.progress-message .timeline-item-iteration.timeline-iteration-divider {
        gap: 8px;
        margin-top: 7px;
    }

    .message.assistant-turn-with-process .timeline-item-iteration.timeline-iteration-divider::after,
    .message.progress-message .timeline-item-iteration.timeline-iteration-divider::after {
        flex-basis: 24px;
        min-width: 16px;
    }
}
:is(.hitl-inline-approval, .chat-hitl-approval-dock).hitl-approval-task-closed .hitl-pending-actions :is(button, .btn-primary, .btn-secondary) {
    border-color: #d1d5db !important;
    background: #e5e7eb !important;
    color: #9ca3af !important;
    box-shadow: none !important;
    cursor: not-allowed;
    opacity: 1;
}
html[data-theme="dark"] :is(.hitl-inline-approval, .chat-hitl-approval-dock).hitl-approval-task-closed .hitl-pending-actions :is(button, .btn-primary, .btn-secondary) {
    border-color: #374151 !important;
    background: #273244 !important;
    color: #7f8b9d !important;
}
.hitl-tool-approval-summary .hitl-inline-actions .btn-primary,
.hitl-tool-approval-summary .hitl-inline-actions .btn-secondary {
    min-width: 0;
    min-height: 30px;
    padding: 5px 11px;
    border-radius: 7px;
    font-size: 0.79rem;
}
@media (max-width: 760px) {
    .message.assistant-turn-with-process,
    .message.progress-message {
        gap: 8px;
    }

    .message.assistant-turn-with-process .message-content,
    .message.progress-message .message-content {
        flex-basis: calc(100% - 40px);
        max-width: calc(100% - 40px);
    }

    .message.assistant-turn-with-process .assistant-final-result {
        font-size: 0.93rem;
    }

    .message.assistant-turn-with-process .progress-timeline,
    .message.progress-message .progress-timeline {
        padding-left: 18px;
    }

    .message.assistant-turn-with-process .timeline-item,
    .message.progress-message .timeline-item {
        padding-left: 9px !important;
    }

    .message.assistant-turn-with-process .timeline-item.tool-detail-collapsible .timeline-item-header::after,
    .message.progress-message .timeline-item.tool-detail-collapsible .timeline-item-header::after {
        content: "›";
        font-size: 1rem;
    }

    .hitl-codex-explainer,
    .hitl-approval-heading,
    .hitl-approval-primary,
    .hitl-approval-countdown,
    .hitl-tool-approval-summary .hitl-inline-body,
    .hitl-tool-approval-summary .hitl-inline-actions,
    .hitl-codex-diff {
        margin-left: 0;
    }

    .hitl-tool-approval-summary .hitl-inline-actions {
        flex-wrap: wrap;
    }

    .chat-hitl-approval-dock {
        padding: 16px 16px 116px;
        border-radius: 18px;
    }

    .chat-hitl-approval-scroll-region {
        max-height: max(76px, calc(min(62vh, 560px) - 134px));
        max-height: max(76px, calc(min(62dvh, 560px) - 134px));
    }

    .chat-hitl-approval-dock .hitl-approval-heading,
    .chat-hitl-approval-dock .hitl-approval-primary,
    .chat-hitl-approval-dock .hitl-approval-countdown,
    .chat-hitl-approval-dock .hitl-inline-body,
    .chat-hitl-approval-dock .hitl-inline-actions {
        margin-left: 0;
    }

    .chat-hitl-approval-dock .hitl-inline-actions {
        right: 16px;
        bottom: 16px;
        left: 16px;
        flex-wrap: wrap;
    }

    .chat-hitl-approval-dock .hitl-inline-status {
        flex-basis: 100%;
        min-height: 0;
    }
}
@media (prefers-reduced-motion: reduce) {
    .project-task-status--running,
    .turn-process-status-dot.is-running,
    .hitl-codex-spinner {
        animation: none;
    }
}
/* A policy block is an intentional refusal before execution,
separate from a tool failure. */
:root { --tool-blocked-color: #a65d08; }
html[data-theme="dark"] { --tool-blocked-color: #f4bc62; }
/* ===== 可访问性补强：状态图标（SVG mask，替代 ✓/✗ 字符）与跳转链接 ===== */
.status-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    background-color: currentColor;
    -webkit-mask: var(--icon-check-mask) center / contain no-repeat;
    mask: var(--icon-check-mask) center / contain no-repeat;
    flex-shrink: 0;
}
.status-icon--check {
    -webkit-mask-image: var(--icon-check-mask);
    mask-image: var(--icon-check-mask);
}
.status-icon--x {
    -webkit-mask-image: var(--icon-x-mask);
    mask-image: var(--icon-x-mask);
}
/* 键盘用户跳过侧边栏导航直达主内容：默认隐藏，获得焦点时浮现 */
.skip-link {
    position: fixed;
    left: 16px;
    top: -64px;
    z-index: 3000;
    padding: 10px 18px;
    border-radius: 8px;
    background: var(--accent-color);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transition: top 0.15s ease;
}
.skip-link:focus-visible,
.skip-link:focus {
    top: 12px;
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
/* 主内容锚点被跳转聚焦时不显示默认轮廓 */
#main-content:focus {
    outline: none;
}

/* ===== 恢复被清理误删的规则（模板串动态类名盲区） ===== */
.rbac-user-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    align-items: start;
    gap: 3px 10px;
    width: 100%;
    min-height: 0;
    margin-bottom: 4px;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.rbac-user-row .rbac-pill {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    min-height: 20px;
    padding: 1px 7px;
    font-size: 0.6875rem;
}

.rbac-resource-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 7px 10px;
}

.rbac-resource-option-main {
    min-width: 0;
}

.rbac-resource-option-main strong,

.rbac-resource-option-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rbac-resource-option-detail {
    max-width: 120px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.rbac-resource-option-main small {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rbac-user-row.is-active { box-shadow: inset 3px 0 0 var(--primary-color, #2563eb); }

.rbac-role-card.is-selected {
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.035);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.rbac-user-row {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.rbac-user-row:hover,

.rbac-user-row.is-active {
    border-color: rgba(37, 99, 235, 0.28);
    background: rgba(37, 99, 235, 0.05);
}

.rbac-role-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    background: var(--bg-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.rbac-role-card:hover {
    border-color: rgba(37, 99, 235, 0.26);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.rbac-role-card-head,

.rbac-role-card-foot,

.rbac-role-card p {
    min-height: 36px;
    margin: 10px 0;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.rbac-role-card-foot {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.rbac-resource-option {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    cursor: pointer;
}

.rbac-resource-option:hover {
    border-color: rgba(37, 99, 235, 0.32);
    background: rgba(37, 99, 235, 0.035);
}

.rbac-resource-option:has(input:checked) {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(37, 99, 235, 0.06);
}

.rbac-resource-option.is-assigned {
    cursor: default;
    opacity: 0.7;
}

.rbac-resource-option-main {
    flex: 1;
    min-width: 0;
}

.rbac-resource-option-main strong,

.rbac-resource-option-main small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rbac-resource-option-main strong {
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.rbac-resource-option-main small,

.rbac-resource-option-detail {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 0.6875rem;
}

.rbac-resource-option-detail {
    flex-shrink: 0;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rbac-user-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    align-items: start;
    gap: 3px 10px;
    min-height: 0;
    margin-bottom: 4px;
    padding: 9px 11px;
}

.rbac-role-card {
    display: grid;
    grid-template-rows: auto minmax(38px, auto) auto;
    min-width: 0;
    min-height: 158px;
    padding: 13px;
}

.rbac-role-card-head {
    align-items: flex-start;
}

.rbac-role-card-head .checkbox-label {
    min-width: 0;
}

.rbac-role-card p {
    min-height: 0;
    margin: 11px 0;
}

.rbac-role-card-foot {
    align-content: flex-start;
    justify-content: flex-start;
    gap: 6px 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
}

:is(.rbac-role-card, .rbac-resource-option, .rbac-checkbox-item) .checkbox-custom {
    width: 18px;
    height: 18px;
    border-width: 1px;
    border-radius: 5px;
    box-shadow: none;
}

:is(.rbac-role-card, .rbac-resource-option, .rbac-checkbox-item) .checkbox-custom::before {
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 0;
    transform: rotate(45deg);
}

:is(.rbac-role-card, .rbac-resource-option, .rbac-checkbox-item) .modern-checkbox:checked + .checkbox-custom {
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.10);
}

:is(.rbac-role-card, .rbac-resource-option, .rbac-checkbox-item) .modern-checkbox:checked + .checkbox-custom::before {
    opacity: 1;
    transform: rotate(45deg);
}

.rbac-resource-picker .rbac-resource-option {
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr) minmax(90px, 0.75fr) minmax(60px, 0.55fr) max-content;
    gap: 10px;
    height: 58px;
    min-height: 58px;
    padding: 8px 2px;
    box-sizing: border-box;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent);
    border-radius: 0;
    background: transparent;
}

.rbac-resource-picker .rbac-resource-option:last-child {
    border-bottom: 0;
}

.rbac-resource-picker .rbac-resource-option:hover:not(.is-assigned) {
    background: color-mix(in srgb, var(--accent-color) 3%, var(--bg-primary));
}

.rbac-resource-picker .rbac-resource-option:has(input:checked) {
    background: color-mix(in srgb, var(--accent-color) 6%, var(--bg-primary));
}

.rbac-resource-picker .rbac-resource-option.is-assigned {
    opacity: 1;
}

.rbac-resource-picker .rbac-resource-option.is-assigned .rbac-resource-option-main {
    opacity: 0.72;
}

.rbac-resource-option-id {
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-group textarea {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
}

/* ===== RBAC 弹窗表单与全站行内布局统一（覆盖上方 40px 控件的 width:100%） ===== */
#rbac-user-modal .form-group > .rbac-field-hint,
#rbac-role-modal .form-group > .rbac-field-hint {
    flex: 0 0 auto;
    width: calc(100% - var(--form-label-w, 7em) - 12px);
    margin-left: calc(var(--form-label-w, 7em) + 12px);
}
#rbac-user-modal .form-group > :is(.form-input, .form-select, input:not([type="checkbox"]):not([type="radio"]), select, textarea),
#rbac-role-modal .form-group > :is(.form-input, .form-select, input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
}
/* 权限选择是大面积内容：label 与搜索/按钮一行，权限卡片组独占下方 */
#rbac-user-modal .form-group:has(.rbac-permission-groups),
#rbac-role-modal .form-group:has(.rbac-permission-groups) {
    flex-wrap: wrap;
}
#rbac-user-modal .form-group:has(.rbac-permission-groups) > .rbac-permission-groups,
#rbac-role-modal .form-group:has(.rbac-permission-groups) > .rbac-permission-groups {
    flex: 1 1 100%;
}
#rbac-user-modal .form-group > .rbac-checkbox-grid {
    flex: 1 1 100%;
}

/* ===== 多行表单 label 右对齐：同表单内控件左缘对齐 ===== */
.form-group > label,
.adv-field > label,
.adv-label-row label,
.adv-field.adv-wide > label,
.audit-field > span,
.rbac-audit-filter > span {
    text-align: right;
}
.form-group > label {
    min-width: 5.5em;
}
.adv-field > label,
.adv-label-row label,
.adv-field.adv-wide > label {
    min-width: 4em;
}
.tasks-filters label {
    min-width: 4.5em;
    justify-content: flex-end;
}
.audit-field > span,
.rbac-audit-filter > span {
    min-width: 4.5em;
}

/* 动作按钮组（标签按钮行等）独占一行 */
.form-group > .pictures-form-actions,
.form-group > .form-actions {
    flex: 1 1 100%;
}
/* 行内表单控件兜底：覆盖散落的 width:100% 规则，防止 flex 换行溢出 */
.form-group > input:not([type="checkbox"]):not([type="radio"]),
.form-group > select,
.form-group > textarea {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
}
/* 上传区豁免组保持 label 左对齐 */
.form-group:has(.picture-upload-area) > label {
    text-align: left;
}

/* ============================================================================
   统一表单布局系统（最终层）
   规范：所有字段 = 定宽 label 列（右对齐）+ 控件（flex 填充），无例外；
   大块内容（提示/按钮组/权限卡片/芯片区/上传区特殊行）独占整行；
   结构属性用 !important 压过历史散落规则，保证全站一致。
   ========================================================================== */
:root { --form-label-w: 7em; }
.pictures-advanced-panel { --form-label-w: 4.5em; }
.audit-filter-card { --form-label-w: 5em; }
.rbac-audit-filterbar { --form-label-w: 5em; }

.form-group,
.adv-field,
.audit-field,
.rbac-audit-filter {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
}

/* 筛选工具条的 label 内嵌控件（复选/开关类），保持行内 */
.tasks-filters label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: left !important;
    white-space: nowrap !important;
}

.form-group > label,
.adv-field > label,
.adv-label-row label,
.adv-field.adv-wide > label,
.audit-field > span,
.rbac-audit-filter > span {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: left !important;
    white-space: normal !important;
    word-break: break-word;
}

.form-group > input:not([type="checkbox"]):not([type="radio"]),
.form-group > select,
.form-group > textarea,
.form-group > .form-control,
.form-group > .form-input,
.form-group > :is(.form-input, .form-select),
.adv-field .form-control {
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 0 !important;
}

/* 复选/单选控件不拉伸 */
.form-group > input[type="checkbox"],
.form-group > input[type="radio"],
.form-group > label.checkbox-label {
    flex: 0 0 auto !important;
    width: auto !important;
}

/* 动作按钮组、权限卡片组、标签芯片区独占整行 */
.form-group > .pictures-form-actions,
.form-group > .form-actions,
.form-group > .rbac-permission-groups,
.adv-wide > .tag-chip-area {
    flex: 0 0 auto !important;
    width: 100% !important;
}
/* 解释文字：独占一行，与输入框左缘对齐 */
.form-group > small,
.form-group > .form-hint,
.form-group > .field-error,
.form-group > .rbac-field-hint {
    flex: 0 0 auto !important;
    width: 100% !important;
    margin-left: 0 !important;
}

/* 上传区：label 在上，上传区占满整行 */
.form-group:has(.picture-upload-area) > .picture-upload-area {
    width: 100% !important;
}

/* 创建时间字段保持跨两列 */
.adv-field:has(.adv-time-inputs) {
    grid-column: span 2;
}
@media (max-width: 900px) {
    .adv-field:has(.adv-time-inputs) { grid-column: 1 / -1; }
}

/* 大模型配置底部按钮居中 */
.llm-config-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 6px;
}

.tasks-filters label.pictures-advanced-toggle {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    text-align: left !important;
}

/* ===== 高级搜索标签筛选行：输入框定宽、提示独占下方 ===== */
.adv-label-row .adv-tag-search {
    flex: 0 0 260px !important;
    width: 260px !important;
    min-width: 0 !important;
}
.adv-label-row .adv-hint {
    flex: 1 1 100% !important;
    margin-left: 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* ===== 全局危险按钮 ===== */
.btn-danger {
    padding: 7px 16px;
    background: var(--danger-color, #dc2626);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ===== 统一确认对话框（showAppConfirm）===== */
.app-confirm-content {
    max-width: 420px;
    width: calc(100vw - 48px);
}
.app-confirm-title {
    margin: 0;
    font-size: 1.05rem;
}
.app-confirm-message {
    margin: 0;
    white-space: pre-line;
    line-height: 1.6;
    color: var(--text-primary);
}

/* ===== 分页页码窗口与跳页（common.js buildPaginationPagesHtml / buildPaginationJumpHtml）===== */
.pagination-page-btn {
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}
.pagination-page-btn:hover:not(:disabled) {
    border-color: var(--accent-color, #0078ff);
    color: var(--accent-color, #0078ff);
}
.pagination-page-btn.active {
    background: var(--accent-color, #0078ff);
    border-color: var(--accent-color, #0078ff);
    color: #fff;
    font-weight: 600;
}
.pagination-ellipsis {
    color: var(--text-secondary);
    padding: 0 2px;
    user-select: none;
}
.pagination-jump {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.pagination-jump-select {
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8rem;
    padding: 0 4px;
    cursor: pointer;
}
.rbac-pagination-pages {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* 标签管理多选列 */
.tag-check-col {
    width: 36px;
    text-align: center;
}

/* 分页条左侧的批量删除按钮（标签管理）：容器 button 规则会盖掉 .btn-danger 底色，这里提回红色 */
.pictures-table-pagination .btn-danger,
.pictures-table-pagination .btn-danger:hover:not(:disabled) {
    color: #fff;
}
.pictures-table-pagination .btn-danger {
    background: var(--danger-color, #dc2626);
    border-color: var(--danger-color, #dc2626);
    font-weight: 500;
    white-space: nowrap;
}
.pictures-table-pagination .btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    border-color: #b91c1c;
}
.pictures-table-pagination .btn-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* ===== 标签分组管理对话框 ===== */
.pictures-manage-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}
#tag-group-manage-list .pictures-table th,
#tag-group-manage-list .pictures-table td {
    white-space: nowrap;
}
#tag-group-manage-list .pictures-table .pictures-table-actions .btn-row-action {
    white-space: nowrap;
}
