* {
    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: #adb5bd;
    --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");
    --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: #6b7280;
    --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 {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-primary);
}

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

.vulnerability-alert-settings {
    margin: 24px 0 4px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.035);
}

.vulnerability-alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--border-color);
}

.vulnerability-alert-copy {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.vulnerability-alert-copy > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.vulnerability-alert-copy strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 650;
    line-height: 1.4;
}

.vulnerability-alert-copy > div > span {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.45;
}

.vulnerability-alert-icon {
    display: flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(0, 102, 255, 0.09);
    color: var(--accent-color);
}

.vulnerability-alert-controls {
    display: flex;
    min-height: 58px;
    align-items: center;
    gap: 22px;
    padding: 10px 20px;
    border-radius: 0 0 10px 10px;
    background: var(--bg-secondary);
}

.vulnerability-alert-binding-row {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px 10px;
    padding-left: 22px;
    border-left: 1px solid var(--border-color);
}

.vulnerability-alert-binding-row > span {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.45;
}

.vulnerability-alert-binding-row > span.is-warning {
    color: #b45309;
}

.vulnerability-alert-bind-button {
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: var(--accent-color);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 650;
    line-height: 1.45;
    cursor: pointer;
}

.vulnerability-alert-bind-button:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.vulnerability-alert-field {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.vulnerability-alert-field .settings-custom-select {
    width: 148px !important;
    min-width: 148px !important;
}

.vulnerability-alert-field .settings-custom-select-trigger {
    min-height: 36px;
    padding: 7px 11px;
    border-radius: 7px;
    font-size: 0.875rem;
    font-weight: 600;
}

.vulnerability-alert-field .settings-custom-select-menu {
    min-width: 148px;
}

.vulnerability-alert-switch {
    position: relative;
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
}

.vulnerability-alert-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.vulnerability-alert-switch-track {
    position: relative;
    width: 38px;
    height: 22px;
    flex: 0 0 38px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.vulnerability-alert-switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
    transition: transform 0.16s ease;
}

.vulnerability-alert-switch input:checked + .vulnerability-alert-switch-track {
    background: var(--accent-color);
}

.vulnerability-alert-switch input:checked + .vulnerability-alert-switch-track::after {
    transform: translateX(16px);
}

.vulnerability-alert-switch input:focus-visible + .vulnerability-alert-switch-track {
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.16);
}

.vulnerability-alert-switch input:disabled ~ span {
    cursor: not-allowed;
    opacity: 0.55;
}

html[data-theme="dark"] .vulnerability-alert-switch-track {
    background: #334155;
    box-shadow: inset 0 0 0 1px #475569;
}

html[data-theme="dark"] .vulnerability-alert-switch-track::after {
    background: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .vulnerability-alert-switch:hover input:not(:checked):not(:disabled) + .vulnerability-alert-switch-track {
    background: #3f4d63;
}

html[data-theme="dark"] .vulnerability-alert-switch input:checked + .vulnerability-alert-switch-track {
    background: var(--accent-color);
    box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.28);
}

html[data-theme="dark"] .vulnerability-alert-switch input:checked + .vulnerability-alert-switch-track::after {
    background: #f8fafc;
}

html[data-theme="dark"] .vulnerability-alert-switch input:disabled + .vulnerability-alert-switch-track {
    background: #253247;
    box-shadow: inset 0 0 0 1px #334155;
}

html[data-theme="dark"] .vulnerability-alert-switch input:disabled + .vulnerability-alert-switch-track::after {
    background: #64748b;
}

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

/* 对话页面布局 */
.chat-page-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    width: 100%;
    height: 100%;
    position: relative;
}

.conversation-sidebar {
    width: 320px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    overflow: hidden;
    position: relative;
    transition: width 0.2s ease;
}

/* 对话页左侧列表折叠（腾出空间给主对话区） */
.conversation-sidebar.collapsed {
    width: 56px;
}

/* 对话列表头部：折叠 + 新对话同一行，不重叠 */
.conversation-sidebar-header {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    flex-shrink: 0;
}

.conversation-sidebar-header .new-chat-btn {
    flex: 1;
    min-width: 0;
    width: auto; /* 覆盖 .new-chat-btn 的 width:100%，让 flex 分配剩余空间 */
}

.conversation-sidebar-collapse-btn {
    /* 不再使用 absolute，避免盖住「新对话」 */
    position: static;
    flex-shrink: 0;
    align-self: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.conversation-sidebar-collapse-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-color);
}

/* 折叠后箭头朝右表示「展开」 */
.conversation-sidebar.collapsed .conversation-sidebar-collapse-btn {
    transform: rotate(180deg);
}

.conversation-sidebar-collapse-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.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-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

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

.openapi-doc-btn {
    display: inline-flex;
    align-items: 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: 400;
    transition: all 0.2s ease;
}

.openapi-doc-btn: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,
html[data-theme="dark"] .openapi-doc-btn {
    background: #111827;
    border-color: #2b374b;
}

html[data-theme="dark"] .header-actions button:hover,
html[data-theme="dark"] .lang-switcher-btn:hover,
html[data-theme="dark"] .openapi-doc-btn:hover {
    background: #1f2937;
    border-color: var(--accent-color);
}

.monitor-btn {
    color: var(--accent-color);
    border-color: var(--border-color);
    background: var(--bg-primary);
}

.monitor-btn:hover {
    background: rgba(0, 102, 255, 0.08);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.attack-chain-btn {
    color: var(--text-secondary);
    border: none;
    background: transparent;
    padding: 6px 10px;
    font-size: 0.8125rem;
    font-weight: 400;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.attack-chain-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.conversation-header .attack-chain-btn {
    background: transparent;
    border: none;
    backdrop-filter: none;
    color: var(--text-secondary);
}

.conversation-header .attack-chain-btn:hover {
    background: rgba(0, 102, 255, 0.06);
    color: var(--accent-color);
    transform: none;
    border: none;
}

.conversation-header .attack-chain-btn:hover svg {
    opacity: 1;
}

.conversation-header .attack-chain-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent;
    color: var(--text-muted);
}

/* 用户菜单样式 */
.user-menu-container {
    position: relative;
}

.notification-menu-container {
    position: relative;
}

.notification-btn {
    position: relative;
    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;
}

.notification-btn:hover,
.notification-btn.active {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.notification-btn svg {
    width: 20px;
    height: 20px;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(32%, -32%);
    min-width: 18px;
    height: 18px;
    border-radius: 9999px;
    padding: 0 4px;
    background: #ef4444;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1;
    text-align: center;
    font-variant-numeric: tabular-nums;
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
    pointer-events: none;
}

.notification-badge-text {
    display: inline-block;
    transform: translateY(1.5px);
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-height: 420px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
    z-index: 1000;
    overflow: hidden;
}

.notification-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    font-weight: 600;
}

.notification-mark-read-btn {
    border: none;
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
}

.notification-list {
    max-height: 360px;
    overflow-y: auto;
    padding: 6px 0;
}

.notification-item {
    display: block;
    padding: 10px 12px;
    border-left: 2px solid transparent;
}

.notification-item + .notification-item {
    border-top: 1px solid var(--border-color);
}

.notification-item.notification-level-p0 {
    border-left-color: #ef4444;
}

.notification-item.notification-level-p1 {
    border-left-color: #f59e0b;
}

.notification-item.notification-level-p2 {
    border-left-color: #3b82f6;
}

.notification-item-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notification-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.notification-item-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.notification-item-action-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 0.6875rem;
    line-height: 1;
    padding: 4px 6px;
    cursor: pointer;
}

.notification-item-action-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.notification-item-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.notification-item-time {
    margin-top: 4px;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.notification-empty {
    padding: 16px 12px;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.8125rem;
}

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

.attack-chain-btn:not(:disabled):hover {
    background: var(--bg-tertiary);
    border: none;
    color: var(--accent-color);
    transform: none;
}

.attack-chain-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border: none;
    background: transparent;
    color: var(--text-muted);
}

.settings-btn {
    padding: 8px;
    min-width: 44px;
}

/* 设置页面样式 */
.settings-actions {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 旧侧边栏样式（保留用于对话页面内的历史对话侧边栏） */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.new-chat-btn {
    width: 100%;
    min-height: 40px;
    padding: 9px 16px;
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
    color: #ffffff;
    border: 1px solid rgba(96, 165, 250, 0.72);
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.18);
}

.new-chat-btn:hover {
    background: linear-gradient(180deg, #74b2fb 0%, #4b8df7 100%);
    border-color: rgba(147, 197, 253, 0.9);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.22);
}

.new-chat-btn:active {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.16);
}

.new-chat-btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(96, 165, 250, 0.22),
        0 6px 14px rgba(37, 99, 235, 0.18);
}

html[data-theme="dark"] .new-chat-btn {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border-color: rgba(96, 165, 250, 0.42);
    box-shadow:
        0 5px 12px rgba(2, 6, 23, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .new-chat-btn:hover {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    border-color: rgba(147, 197, 253, 0.58);
    box-shadow:
        0 7px 14px rgba(2, 6, 23, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .new-chat-btn:active {
    background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
    border-color: rgba(96, 165, 250, 0.36);
    box-shadow:
        0 3px 8px rgba(2, 6, 23, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .new-chat-btn:focus-visible {
    box-shadow:
        0 0 0 3px rgba(96, 165, 250, 0.24),
        0 5px 12px rgba(2, 6, 23, 0.28);
}

.new-chat-btn span {
    line-height: 1;
}

.new-chat-btn span:first-child {
    flex-shrink: 0;
    font-size: 1.125rem;
    font-weight: 700;
    margin-top: -1px;
}

.new-chat-btn span:last-child {
    white-space: nowrap;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.2s ease;
}

/* 对话列表滚动条：默认隐藏，悬停时显示 */
.sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.sidebar-content:hover {
    scrollbar-color: rgba(0, 0, 0, 0.22) transparent;
}

.sidebar-content:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.22);
}

.sidebar-content:hover::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .sidebar-content:hover {
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

html[data-theme="dark"] .sidebar-content:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
}

html[data-theme="dark"] .sidebar-content:hover::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.42);
}

.hitl-sidebar-card {
    border-top: 1px solid var(--border-color);
    background: linear-gradient(165deg, #f8fafc 0%, #f1f5f9 55%, #eef2f7 100%);
    padding: 11px 12px;
    flex-shrink: 0;
}

.hitl-sidebar-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.hitl-sidebar-body {
    overflow: hidden;
    max-height: 500px;
    opacity: 1;
    margin-top: 8px;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin-top 0.3s ease;
}

.hitl-sidebar-collapsed .hitl-sidebar-body {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.hitl-sidebar-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.hitl-sidebar-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: linear-gradient(145deg, rgba(0, 102, 255, 0.12), rgba(0, 102, 255, 0.06));
    color: var(--accent-color);
    border: 1px solid rgba(0, 102, 255, 0.18);
}

.hitl-sidebar-heading-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.hitl-sidebar-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.hitl-sidebar-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.25;
}

.hitl-apply-btn {
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: var(--accent-color);
    color: #fff;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 102, 255, 0.25), 0 2px 8px rgba(0, 102, 255, 0.12);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.hitl-apply-btn:hover {
    filter: brightness(1.05);
    box-shadow: 0 2px 4px rgba(0, 102, 255, 0.3), 0 4px 12px rgba(0, 102, 255, 0.18);
}

.hitl-apply-btn:active {
    transform: translateY(1px);
}

.hitl-apply-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

.hitl-apply-feedback {
    display: none;
    font-size: 12px;
    line-height: 1.4;
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.hitl-apply-feedback.hitl-apply-feedback--error {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.22);
}

/* 仅本机保存、未请求服务端：避免与「已全部同步」同款绿色造成误解 */
.hitl-apply-feedback.hitl-apply-feedback--partial {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.25);
}

.hitl-sidebar-config {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    padding: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
}

.hitl-config-field {
    margin-bottom: 10px;
}

.hitl-config-field:last-child {
    margin-bottom: 0;
}

.hitl-config-field--tools {
    margin-bottom: 0;
}

.hitl-config-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.hitl-config-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    letter-spacing: 0;
}

.hitl-config-hint {
    margin: 6px 0 0;
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.hitl-config-select {
    width: 100%;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    padding: 0 36px 0 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hitl-config-textarea {
    display: block;
    width: 100%;
    height: 148px;
    min-height: 96px;
    max-height: 280px;
    overflow-y: auto;
    resize: vertical;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    padding: 9px 10px;
    font-size: 12px;
    line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.hitl-config-textarea::placeholder {
    color: var(--text-muted);
    font-family: inherit;
}

/* 其它页面内联 HITL 评论框等仍用 input 类名 */
.hitl-config-input {
    width: 100%;
    height: 38px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    padding: 0 12px;
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.hitl-config-input:focus {
    outline: none;
    border-color: var(--accent-color, #0066ff);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.hitl-pending-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hitl-pending-item {
    border: 1px solid #dbeafe;
    border-radius: 10px;
    padding: 16px;
    background: #f8fbff;
    transition: box-shadow 0.2s;
}
.hitl-pending-item:hover {
    box-shadow: 0 2px 12px rgba(0, 102, 255, 0.08);
}

.hitl-pending-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.hitl-pending-item-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hitl-tool-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--accent-color, #0066ff);
    color: #fff;
}

.hitl-mode-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: #e0e7ff;
    color: #4338ca;
}
.hitl-mode-tag--review_edit {
    background: #fef3c7;
    color: #92400e;
}

.hitl-pending-meta {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 8px;
    word-break: break-all;
}

.hitl-pending-payload {
    white-space: pre-wrap;
    word-break: break-all;
    max-height: min(20vh, 180px);
    overflow: auto;
    margin: 0 0 4px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: #334155;
    line-height: 1.5;
}

.hitl-pending-item-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hitl-dismiss-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: var(--text-secondary, #64748b);
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.hitl-dismiss-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.hitl-pending-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.hitl-edit-args {
    width: 100%;
    min-height: 76px;
    margin-top: 8px;
    overflow: hidden;
    resize: none;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2937;
    padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.hitl-edit-args:focus {
    outline: none;
    border-color: var(--accent-color, #0066ff);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.hitl-input-help {
    margin-top: 6px;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--accent-color, #0066ff);
    line-height: 1.4;
}

.hitl-inline-approval {
    position: relative;
    margin-top: 10px;
    padding: 0;
    border: 1px solid #cfe0ff;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.hitl-inline-approval.hitl-inline-done {
    opacity: 0.8;
}

.hitl-inline-approval::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: #f59e0b;
}

.hitl-inline-approval--merged {
    margin-top: 12px;
    padding-top: 12px;
    border: 0;
    border-top: 1px dashed rgba(21, 101, 192, 0.22);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.hitl-inline-approval--merged::before {
    display: none;
}

.hitl-inline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px 10px 16px;
    border-bottom: 1px solid #e8eef8;
    background: linear-gradient(180deg, #fbfdff 0%, #f8fbff 100%);
}

.hitl-inline-approval--merged .hitl-inline-header {
    padding: 0 0 8px 0;
    border-bottom: 0;
    background: transparent;
}

.hitl-inline-title,
.hitl-inline-badges {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.hitl-inline-title {
    gap: 8px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.hitl-inline-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #fff7ed;
    color: #d97706;
    border: 1px solid #fed7aa;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.hitl-inline-badges {
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.hitl-inline-body {
    display: grid;
    gap: 10px;
    padding: 12px 14px 12px 16px;
}

.hitl-inline-approval--merged .hitl-inline-body {
    padding: 0;
}

.hitl-inline-summary {
    margin: 0;
    color: #475569;
}

.hitl-inline-note {
    margin: 0;
    padding: 9px 10px;
    border: 1px solid #e6edf7;
    border-radius: 7px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    line-height: 1.5;
}

.hitl-inline-field {
    display: grid;
    gap: 6px;
}

.hitl-inline-approval .hitl-edit-args {
    min-height: 96px;
    margin-top: 0;
}

.hitl-inline-approval .hitl-config-input {
    height: 36px;
    margin: 0;
}

.hitl-inline-actions {
    align-items: center;
    justify-content: flex-end;
    margin-top: 0;
    padding: 10px 14px 10px 16px;
    border-top: 1px solid #e8eef8;
    background: #fbfdff;
}

.hitl-inline-approval--merged .hitl-inline-actions {
    margin-top: 10px;
    padding: 10px 0 0 0;
    border-top: 0;
    background: transparent;
}

.hitl-inline-actions .btn-primary,
.hitl-inline-actions .btn-secondary {
    min-width: 64px;
}

.hitl-inline-status {
    flex: 1;
    min-width: 120px;
    margin: 0;
    color: #64748b;
}

.hitl-inline-decision {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed rgba(15, 23, 42, 0.12);
    color: #475569;
    font-size: 12px;
}

.hitl-inline-approval--merged .hitl-inline-decision {
    margin-top: 0;
}

.hitl-inline-decision strong {
    color: #0f172a;
    font-size: 13px;
}

.hitl-inline-decision-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #64748b;
}

.hitl-inline-decision--approve .hitl-inline-decision-dot {
    background: #22c55e;
}

.hitl-inline-decision--reject .hitl-inline-decision-dot {
    background: #ef4444;
}

.hitl-inline-decision-comment {
    color: #64748b;
}

.hitl-context-block {
    margin-top: 10px;
}

.hitl-context-label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
}

.hitl-context-text {
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: min(24vh, 210px);
    overflow: auto;
}

.hitl-log-modal-content .hitl-context-text,
.hitl-log-detail-payload .hitl-context-text {
    max-height: min(28vh, 260px);
}

.hitl-log-readonly-section {
    margin-bottom: 12px;
}

.hitl-context-block--execution .hitl-context-text {
    background: #f0fdf4;
    border-color: #bbf7d0;
    max-height: min(20vh, 180px);
}

.hitl-logs-summary {
    font-size: 12px;
    color: #64748b;
    max-width: 140px;
}

.hitl-reviewer-toggle {
    display: inline-flex;
    gap: 0;
    padding: 3px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.hitl-reviewer-toggle-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.hitl-reviewer-toggle-btn:hover {
    color: #0f172a;
}

.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-reviewer-toggle-btn:focus-visible {
    outline: 2px solid var(--accent-color, #0066ff);
    outline-offset: 2px;
}

.hitl-page-reviewer-bar {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.hitl-page-reviewer-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
}

.hitl-page-reviewer-label {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.hitl-page-reviewer-hint {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
}

.hitl-page-whitelist-bar {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    box-sizing: border-box;
}

.hitl-page-whitelist-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 8px;
}

.hitl-page-whitelist-label {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.hitl-page-whitelist-hint {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
}

.hitl-page-whitelist-textarea {
    width: 100%;
    min-height: 140px;
    box-sizing: border-box;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    color: #0f172a;
    background: #f8fafc;
    resize: vertical;
}

.hitl-page-whitelist-textarea:focus {
    outline: none;
    border-color: var(--accent-color, #0066ff);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
    background: #fff;
}

.hitl-page-strategy-bar {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    box-sizing: border-box;
}

.hitl-page-strategy-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 8px;
}

.hitl-page-strategy-label {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.hitl-page-strategy-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hitl-strategy-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 8px;
}

.hitl-strategy-subtab {
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #f8fafc;
    color: #475569;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.hitl-strategy-subtab:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.hitl-strategy-subtab--active {
    background: #e0e7ff;
    border-color: #a5b4fc;
    color: #3730a3;
}

.hitl-page-strategy-hint {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
}

.hitl-strategy-textarea {
    width: 100%;
    min-height: 320px;
    box-sizing: border-box;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    color: #0f172a;
    background: #f8fafc;
    resize: vertical;
}

.hitl-strategy-textarea:focus {
    outline: none;
    border-color: var(--accent-color, #0066ff);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
    background: #fff;
}

.hitl-page-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.hitl-page-tab {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary, #64748b);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 14px;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hitl-page-tab--active {
    color: var(--accent-color, #0066ff);
    border-bottom-color: var(--accent-color, #0066ff);
}

.hitl-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.hitl-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.hitl-filters label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary, #64748b);
}

.hitl-filter-input,
.hitl-filter-select {
    min-width: 220px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    background: #fff;
}

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

.hitl-filters--logs .hitl-filter-select-ui {
    position: relative;
    min-width: 160px;
}

.hitl-filters--logs .hitl-filter-select-ui--decision {
    min-width: 132px;
}

.hitl-filters--logs .hitl-filter-select-ui--decidedby {
    min-width: 168px;
}

.hitl-filter-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    line-height: 1.25;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hitl-filter-select-trigger:hover:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.45);
}

.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-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.hitl-filter-select-caret {
    flex-shrink: 0;
    color: var(--text-secondary, #64748b);
    transition: transform 0.15s ease;
}

.hitl-filter-select-ui.open .hitl-filter-select-caret {
    transform: rotate(180deg);
}

.hitl-filter-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
}

.hitl-filter-select-ui.open .hitl-filter-select-dropdown {
    display: block;
}

.hitl-filter-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.hitl-filter-select-option:hover {
    background: var(--bg-secondary, #f8fafc);
}

.hitl-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}

.hitl-filter-select-check {
    width: 14px;
    flex-shrink: 0;
    visibility: hidden;
    color: #2563eb;
    font-size: 12px;
    line-height: 1;
}

.hitl-filter-select-option.is-selected .hitl-filter-select-check {
    visibility: visible;
}

.hitl-filter-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hitl-filter-select-ui.is-disabled .hitl-filter-select-trigger {
    opacity: 0.6;
    cursor: not-allowed;
}

.hitl-logs-table-wrap {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}

.hitl-logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.hitl-logs-table th,
.hitl-logs-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
    vertical-align: top;
}

.hitl-logs-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
}

.hitl-logs-cell-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    max-width: 180px;
    word-break: break-all;
}

.hitl-logs-actions {
    white-space: nowrap;
}

.hitl-decision-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #f1f5f9;
    color: #334155;
}

.hitl-decision-tag.hitl-decision--approve {
    background: #dcfce7;
    color: #166534;
}

.hitl-decision-tag.hitl-decision--reject {
    background: #fee2e2;
    color: #991b1b;
}

.hitl-logs-pagination,
.hitl-pending-pagination {
    margin-top: 12px;
    padding: 0;
}

.hitl-logs-pagination .monitor-pagination,
.hitl-pending-pagination .monitor-pagination {
    margin-top: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.hitl-log-modal-content {
    max-width: 640px;
    width: calc(100vw - 32px);
}

.hitl-log-detail-meta {
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.hitl-log-detail-row {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 12px;
    align-items: start;
    margin: 0;
}

.hitl-log-detail-row--full {
    grid-template-columns: 1fr;
}

.hitl-log-detail-row--full dt {
    margin-bottom: 4px;
}

.hitl-log-detail-row dt {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.hitl-log-detail-row dd {
    margin: 0;
    font-size: 14px;
    color: #0f172a;
    word-break: break-word;
}

.hitl-log-detail-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
}

.hitl-log-detail-payload {
    margin-top: 14px;
}

.hitl-logs-retention-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: #64748b;
}

.hitl-logs-empty-hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: #64748b;
}

.btn-link {
    appearance: none;
    border: none;
    background: none;
    color: var(--accent-color, #0066ff);
    cursor: pointer;
    font-size: 13px;
    padding: 0 6px 0 0;
}

.btn-link--danger {
    color: #dc2626;
}

.hitl-config-select:focus,
.hitl-config-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.14);
    background: #fff;
}

.sidebar-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding: 0 8px;
}

.conversation-search-box {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.conversation-sidebar .sidebar-content {
    padding: 10px 16px 16px;
}

.conversation-sidebar .conversation-search-box {
    margin-top: 8px;
    margin-bottom: 10px;
}

.conversation-sidebar .conversation-project-filter {
    margin-bottom: 10px;
}

.conversation-sidebar .recent-conversations-section {
    margin-bottom: 12px;
}

.conversation-sidebar .section-header {
    margin-bottom: 8px;
}

.conversation-search-box input {
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.conversation-search-box input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.conversation-search-box input::placeholder {
    color: var(--text-muted);
}

.conversation-search-clear {
    position: absolute;
    right: 8px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: color 0.2s ease;
    border-radius: 50%;
}

.conversation-search-clear:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.conversation-search-clear svg {
    width: 16px;
    height: 16px;
    display: block;
}

.conversation-project-filter {
    margin-bottom: 12px;
    min-width: 0;
}

.conversation-project-filter-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding: 0 2px;
}

.conversation-project-filter-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.conversation-project-filter-ui {
    position: relative;
    width: 100%;
    min-width: 0;
}

.conversation-project-filter-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.25;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.conversation-project-filter-trigger:hover:not(:disabled) {
    border-color: var(--accent-color);
}

.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-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.conversation-project-filter-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
}

.conversation-project-filter-ui.open .conversation-project-filter-caret {
    transform: rotate(180deg);
}

.conversation-project-filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 320px;
    overflow: hidden;
    padding: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    flex-direction: column;
}

.conversation-project-filter-ui.open .conversation-project-filter-dropdown {
    display: flex;
}

.conversation-project-filter-search {
    flex-shrink: 0;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.conversation-project-filter-search-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8125rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.conversation-project-filter-search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.conversation-project-filter-search-input::placeholder {
    color: var(--text-muted);
}

.conversation-project-filter-options {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 4px;
}

.conversation-project-filter-empty {
    padding: 10px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.conversation-project-filter-hint,
.conversation-project-filter-status {
    padding: 8px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.conversation-project-filter-status {
    color: var(--text-secondary);
}

.conversation-project-filter-option[hidden] {
    display: none !important;
}

.conversation-project-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.conversation-project-filter-option:hover {
    background: var(--bg-secondary);
}

.conversation-project-filter-option.is-selected {
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-color);
    font-weight: 500;
}

.conversation-project-filter-check {
    width: 14px;
    flex-shrink: 0;
    opacity: 0;
    font-size: 0.75rem;
    line-height: 1;
    color: var(--accent-color);
}

.conversation-project-filter-option.is-selected .conversation-project-filter-check {
    opacity: 1;
}

.conversation-project-filter-option-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-item-project-badge {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.conversations-list-empty {
    padding: 12px 10px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.conversation-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

.conversation-group:last-child {
    margin-bottom: 0;
}

.conversation-group-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 8px 8px 0;
}

.conversation-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.conversation-item:hover {
    background: var(--bg-tertiary);
}

.conversation-item:hover .conversation-delete-btn {
    opacity: 1;
}

.conversation-item.active {
    background: var(--bg-primary);
    border-color: var(--accent-color);
}

.conversation-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.conversation-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.conversation-delete-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
}

.conversation-delete-btn svg {
    width: 14px;
    height: 14px;
    transition: all 0.2s ease;
}

.conversation-delete-btn:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--error-color);
    opacity: 1;
}

.conversation-delete-btn:hover svg {
    transform: scale(1.1);
}

.conversation-delete-btn:active {
    background: rgba(220, 53, 69, 0.2);
    transform: scale(0.95);
}

.conversation-item.active .conversation-delete-btn {
    opacity: 0.6;
}

.conversation-item.active:hover .conversation-delete-btn {
    opacity: 1;
}

/* 对话界面样式 */
.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    background: #f5f7fa;
    overflow: hidden;
    height: 100%;
    position: relative;
}

/* 带 conversation hash 刷新时，在目标对话数据完成恢复前不展示默认新对话状态。
   该状态在同一事件循环内设置，避免“无项目”与欢迎页短暂闪现。 */
.chat-container.is-conversation-restoring #active-tasks-bar,
.chat-container.is-conversation-restoring #chat-messages,
.chat-container.is-conversation-restoring #chat-turn-rail,
.chat-container.is-conversation-restoring #chat-return-latest,
.chat-container.is-conversation-restoring #agent-plan-progress,
.chat-container.is-conversation-restoring #chat-input-container {
    visibility: hidden;
}

/* 会话顶部栏样式 */
.conversation-header {
    background: transparent;
    padding: 8px 24px;
    flex-shrink: 0;
    border-bottom: none;
}

.conversation-header-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 24px 24px 64px;
    background: #f5f7fa;
    display: flex;
    flex-direction: column;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.chat-messages:hover {
    scrollbar-color: color-mix(in srgb, var(--text-muted) 55%, transparent) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 999px;
}

.chat-messages:hover::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text-muted) 55%, transparent);
}

.chat-messages:hover::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--text-muted) 80%, transparent);
}
.chat-welcome-empty-state {
    flex: 1 0 auto;
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px 96px;
    box-sizing: border-box;
    color: var(--text-primary);
    text-align: center;
}

.chat-welcome-empty-state-title {
    width: min(100%, 900px);
    margin: 0;
    font-size: clamp(1.85rem, 3vw, 3rem);
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

.chat-welcome-project-name {
    display: inline;
    border-bottom: 1px dotted currentColor;
    padding-bottom: 0.08em;
}

.chat-welcome-empty-state-subtitle {
    width: min(100%, 720px);
    margin: 18px 0 0;
    color: var(--text-secondary);
    font-size: clamp(0.95rem, 1.15vw, 1.1rem);
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0;
}

.chat-turn-rail {
    position: absolute;
    left: 18px;
    top: calc((100% - var(--chat-composer-total-height, 170px)) / 2);
    z-index: 20;
    width: 44px;
    transform: translateY(-50%);
    pointer-events: none;
}

.chat-turn-rail[hidden] {
    display: none;
}

.chat-turn-rail-markers {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    max-height: min(48vh, 336px);
    padding: 10px 4px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-width: none;
    pointer-events: auto;
}

.chat-turn-rail-markers::-webkit-scrollbar {
    display: none;
}

.chat-turn-rail-marker {
    display: block;
    position: relative;
    width: 36px;
    height: 11px;
    min-height: 11px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.chat-turn-rail-marker::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 12px;
    height: 3px;
    border-radius: 999px;
    background: #c7cbd1;
    transform: translateY(-50%);
    transform-origin: left center;
    transition: width 0.16s ease, background-color 0.16s ease, opacity 0.16s ease;
}

.chat-turn-rail-marker:hover::before {
    width: 22px;
    background: #7c828b;
}

.chat-turn-rail-marker:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: 3px;
}

.chat-turn-rail-marker.is-active::before {
    width: 12px;
    background: #20242a;
}

.chat-turn-rail-marker.is-active:hover::before {
    width: 22px;
    background: #20242a;
}

.chat-turn-rail-marker.has-pending-new:last-child::before {
    background: var(--primary-color, #2563eb);
    animation: chat-turn-marker-pulse 1.2s ease-in-out infinite;
}

@keyframes chat-turn-marker-pulse {
    0%, 100% { opacity: 0.58; }
    50% { opacity: 1; }
}

.chat-turn-rail-preview {
    position: fixed;
    z-index: 80;
    width: min(520px, calc(100vw - 120px));
    padding: 16px 18px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    color: #20242a;
    box-shadow: 0 14px 38px rgba(15, 23, 42, 0.13);
    backdrop-filter: blur(14px);
    pointer-events: auto;
}

.chat-turn-rail-preview[hidden] {
    display: none;
}

.chat-turn-rail-preview-title {
    overflow: hidden;
    color: #20242a;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-turn-rail-preview-summary {
    display: -webkit-box;
    margin-top: 7px;
    overflow: hidden;
    color: #858a92;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.chat-return-latest {
    position: absolute;
    left: 50%;
    bottom: calc(var(--chat-composer-total-height, 170px) + 10px);
    z-index: 24;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.97);
    color: #646b75;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(12px);
    cursor: pointer;
    transform: translateX(-50%);
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.chat-return-latest[hidden] {
    display: none !important;
}

.chat-return-latest:hover {
    border-color: rgba(15, 23, 42, 0.18);
    background: #ffffff;
    color: #303640;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16), 0 2px 5px rgba(15, 23, 42, 0.08);
    transform: translateX(-50%) translateY(-1px);
}

.chat-return-latest:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.42);
    outline-offset: 3px;
}

.chat-return-latest-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 14px;
}

.chat-return-latest-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.chat-return-latest.is-streaming .chat-return-latest-dot {
    animation: chat-return-latest-dot-bounce 0.9s ease-in-out infinite;
}

.chat-return-latest.is-streaming .chat-return-latest-dot:nth-child(2) {
    animation-delay: 0.12s;
}

.chat-return-latest.is-streaming .chat-return-latest-dot:nth-child(3) {
    animation-delay: 0.24s;
}

@keyframes chat-return-latest-dot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-3px); }
}

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

.message {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 0;
    animation: fadeIn 0.3s ease-in;
    width: 100%;
}

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

.message.user {
    justify-content: flex-end;
}

.message.system {
    justify-content: center;
    margin-bottom: 16px;
}

.message-content {
    flex: 0 1 auto;
    max-width: 70%;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    overflow-x: visible;
    overflow-y: visible;
    width: 100%;
}

.message.user .message-content {
    align-items: flex-end;
    margin-left: auto;
    width: auto;
    max-width: min(78%, 760px);
}

.message.assistant .message-content {
    align-items: flex-start;
    margin-right: auto;
    min-width: 0;
    max-width: min(100%, 920px);
}

.message.system .message-content {
    max-width: 75%;
    align-items: stretch;
    margin: 0;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 8px;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.6;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* Markdown 样式 */
.message-bubble p {
    margin: 0.5em 0;
}

.message-bubble p:first-child {
    margin-top: 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble strong,
.message-bubble b {
    font-weight: 600;
    color: inherit;
}

.message-bubble em,
.message-bubble i {
    font-style: italic;
}

.message-bubble code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.message.user .message-bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.message-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5em 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875em;
    line-height: 1.5;
}

.message.user .message-bubble pre {
    background: rgba(255, 255, 255, 0.15);
}

.message-bubble pre code {
    background: none;
    padding: 0;
}

.message-bubble ul,
.message-bubble ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.message-bubble li {
    margin: 0.25em 0;
}

.message-bubble blockquote {
    border-left: 3px solid var(--border-color);
    padding-left: 1em;
    margin: 0.5em 0;
    color: var(--text-secondary);
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
    margin: 0.8em 0 0.4em 0;
    font-weight: 600;
    line-height: 1.3;
}

.message-bubble h1:first-child,
.message-bubble h2:first-child,
.message-bubble h3:first-child,
.message-bubble h4:first-child,
.message-bubble h5:first-child,
.message-bubble h6:first-child {
    margin-top: 0;
}

.message-bubble h1 {
    font-size: 1.5em;
}

.message-bubble h2 {
    font-size: 1.3em;
}

.message-bubble h3 {
    font-size: 1.1em;
}

.message-bubble hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1em 0;
}

.message-bubble a {
    color: var(--accent-color);
    text-decoration: none;
}

.message-bubble a:hover {
    text-decoration: underline;
}

.message.user .message-bubble a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

/* Markdown 表格样式 */
/* 表格包装容器，为每个表格提供独立的横向滚动 */
.message-bubble .table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    margin: 1em 0;
    -webkit-overflow-scrolling: touch;
    /* 自定义滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.message-bubble .table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.message-bubble .table-wrapper::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.message-bubble .table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.message-bubble .table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* 表格本身，允许根据内容自动扩展宽度 */
.message-bubble table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 0.9em;
    display: table;
    table-layout: auto;
}

/* 确保表格能够超出容器宽度 */
.message-bubble table * {
    box-sizing: border-box;
}

/* 确保表格内容不会被压缩 */
.message-bubble table colgroup,
.message-bubble table col {
    width: auto;
}

.message-bubble table thead {
    background: var(--bg-secondary);
}

.message-bubble table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    min-width: fit-content;
}

.message-bubble table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    width: auto;
    min-width: 120px;
    max-width: none;
    vertical-align: top;
    /* 允许文字换行，避免重叠和溢出 */
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.5;
}

.message-bubble table tbody tr:hover {
    background: var(--bg-secondary);
}

.message-bubble table tbody tr:last-child td {
    border-bottom: none;
}

/* 消息气泡相对定位，用于放置复制按钮 */
.message-bubble {
    position: relative;
}

/* 消息复制按钮 - 与时间戳同一行 */
.message-copy-btn {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary, #888);
    cursor: pointer;
    opacity: 0.72;
    flex-shrink: 0;
    transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.message-copy-btn:hover {
    color: var(--accent-color, #0066ff);
    background: rgba(0, 102, 255, 0.07);
    border-color: rgba(0, 102, 255, 0.14);
    opacity: 1;
}

.message-copy-btn:active {
    background: rgba(0, 102, 255, 0.11);
}

.message-copy-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.message-copy-btn:focus-visible {
    opacity: 1;
    outline: 2px solid var(--accent-color, #0066ff);
    outline-offset: 1px;
}

.message-copy-btn span {
    display: none;
}

/* 时间戳 + 删除本轮（与气泡分离，和「展开详情」同一视觉层级） */
.message-meta-footer {
    display: flex;
    flex-direction: row;
    align-items: center; /* 与时间戳、删除钮统一垂直居中 */
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 28px;
}

.message.user .message-meta-footer {
    justify-content: flex-end;
}

.message.assistant .message-meta-footer {
    justify-content: flex-start;
}

.message-delete-turn-btn {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary, #888);
    cursor: pointer;
    opacity: 0.5;
    flex-shrink: 0;
    transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.message:hover .message-meta-footer .message-delete-turn-btn {
    opacity: 0.85;
}

.message-delete-turn-btn:hover {
    color: #c62828;
    background: rgba(198, 40, 40, 0.07);
    border-color: rgba(198, 40, 40, 0.15);
    opacity: 1;
}

.message-delete-turn-btn:focus-visible {
    opacity: 1;
    outline: 2px solid var(--accent-color, #0066ff);
    outline-offset: 1px;
}

/* 与删除钮同一行时：去掉时间戳默认 margin-top，避免文字偏低、图标显「高」 */
.message-meta-footer .message-time {
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    line-height: 1.3;
}

.message-delete-turn-btn svg {
    display: block;
    flex-shrink: 0;
}

@media (hover: none) {
    .message-delete-turn-btn {
        opacity: 0.65;
    }
}

/* 用户消息中的表格样式 */
.message.user .message-bubble .table-wrapper {
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.message.user .message-bubble .table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
}

.message.user .message-bubble .table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.message.user .message-bubble table {
    color: rgba(255, 255, 255, 0.95);
}

.message.user .message-bubble table thead {
    background: rgba(255, 255, 255, 0.15);
}

.message.user .message-bubble table th {
    color: rgba(255, 255, 255, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

.message.user .message-bubble table td {
    color: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.message.user .message-bubble table tbody tr:hover {
    background: rgba(255, 255, 255, 0.1);
}

.message.user .message-bubble {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid transparent;
    border-radius: 20px;
    box-shadow: none;
}

.message.assistant:not(.progress-message):not(.assistant-turn-with-process) .message-bubble {
    background: transparent;
    color: var(--text-primary);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.message.assistant.assistant-not-finalized .message-bubble {
    border-color: rgba(245, 124, 0, 0.28);
    border-left: 4px solid #f57c00;
    background: linear-gradient(90deg, rgba(245, 124, 0, 0.08), rgba(245, 124, 0, 0.035));
    box-shadow: 0 6px 18px rgba(245, 124, 0, 0.08);
}

.message.assistant.assistant-not-finalized .message-bubble strong:first-child {
    color: #b45309;
}

.message.assistant .message-bubble pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
}

.message.system .message-bubble {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    text-align: left;
    font-size: 0.875rem;
    padding: 10px 16px;
    width: 100%;
}

.message-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 2px;
    font-weight: 400;
}

/* MCP调用区域 */
.mcp-call-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.mcp-call-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.mcp-call-label::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.mcp-call-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.mcp-tool-list {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
}

.mcp-tool-list.expanded {
    display: flex;
}

.mcp-tools-toggle-btn {
    background: rgba(25, 118, 210, 0.1) !important;
    border-color: rgba(25, 118, 210, 0.35) !important;
    color: #1976d2 !important;
}

.mcp-call-toolbar .process-detail-btn,
.mcp-call-toolbar .mcp-tools-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.25;
    box-sizing: border-box;
    white-space: nowrap;
    vertical-align: middle;
}

.mcp-call-toolbar .process-detail-btn span,
.mcp-call-toolbar .mcp-tools-toggle-btn span {
    display: inline-flex;
    align-items: center;
    line-height: 1.25;
}

.mcp-tools-toggle-btn:hover {
    background: rgba(25, 118, 210, 0.18) !important;
    border-color: #1976d2 !important;
    color: #1565c0 !important;
}

.process-detail-btn {
    background: rgba(156, 39, 176, 0.1) !important;
    border-color: rgba(156, 39, 176, 0.3) !important;
    color: #9c27b0 !important;
}

.mcp-call-toolbar .process-detail-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.process-detail-btn:hover {
    background: rgba(156, 39, 176, 0.2) !important;
    border-color: #9c27b0 !important;
    color: #7b1fa2 !important;
}

.process-detail-btn span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.process-details-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.process-details-content {
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.process-details-return-latest-host {
    position: relative;
}

.process-details-content .progress-timeline {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    opacity: 0;
}

.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-return-latest {
    position: absolute;
    right: 18px;
    bottom: 16px;
    z-index: 7;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    color: #5f6875;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14), 0 1px 3px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.process-details-return-latest[hidden] {
    display: none !important;
}

.process-details-return-latest:hover {
    border-color: rgba(37, 99, 235, 0.3);
    background: #ffffff;
    color: var(--accent-color, #0b6cff);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18), 0 2px 5px rgba(15, 23, 42, 0.1);
    transform: translateY(-1px);
}

.process-details-return-latest:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.42);
    outline-offset: 3px;
}

.process-details-return-latest svg {
    width: 18px;
    height: 18px;
}

.process-details-return-latest.has-pending-new::after,
.process-details-return-latest.is-streaming::after {
    content: "";
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border: 2px solid rgba(255, 255, 255, 0.96);
    border-radius: 50%;
    background: var(--accent-color, #0b6cff);
}

.process-details-return-latest.is-streaming svg {
    animation: process-details-return-latest-nudge 1.1s ease-in-out infinite;
}

@keyframes process-details-return-latest-nudge {
    0%, 65%, 100% { transform: translateY(0); }
    35% { transform: translateY(2px); }
}

.process-details-auto-sentinel {
    display: block;
    width: 100%;
    min-height: 34px;
    margin: 6px 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: default;
}

.process-details-auto-sentinel.is-error {
    color: var(--danger-color, #dc2626);
    background: rgba(220, 38, 38, 0.08);
    cursor: pointer;
}

.chat-input-container {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: flex-end;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.chat-input-primary-row {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
    flex: 1;
    min-width: 0;
    width: 100%;
}

.chat-input-leading {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* Eino：模型推理在对话列表侧栏底部，默认折叠 */
.conversation-sidebar .chat-reasoning-wrapper {
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

.conversation-reasoning-card {
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    padding: 10px 12px 12px;
    flex-shrink: 0;
}

.conversation-reasoning-card.conversation-reasoning-collapsed {
    height: 72px;
    min-height: 72px;
    box-sizing: border-box;
    padding: 12px 16px;
}

.conversation-reasoning-card:not(.conversation-reasoning-collapsed) {
    position: absolute;
    z-index: 80;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: min(68vh, 620px);
    padding: 14px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18), 0 3px 10px rgba(15, 23, 42, 0.08);
}

.conversation-reasoning-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
}

.conversation-reasoning-card.conversation-reasoning-collapsed .conversation-reasoning-card-header {
    min-height: 40px;
}

.conversation-reasoning-card-header:hover .conversation-reasoning-title,
.hitl-sidebar-card-header:hover .hitl-sidebar-title {
    color: var(--accent-color);
}

.sidebar-card-chevron {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: transform 0.2s ease, color 0.2s ease;
}

.sidebar-card-chevron svg {
    display: block;
}

.conversation-reasoning-card-header:hover .sidebar-card-chevron,
.hitl-sidebar-card-header:hover .sidebar-card-chevron {
    color: var(--accent-color);
}

.conversation-reasoning-card:not(.conversation-reasoning-collapsed) .conversation-reasoning-chevron,
.hitl-sidebar-card:not(.hitl-sidebar-collapsed) .hitl-sidebar-chevron {
    transform: rotate(90deg);
}

.conversation-reasoning-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.conversation-reasoning-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eaf2ff;
    color: var(--accent-color);
    border: 1px solid rgba(49, 130, 206, 0.18);
}

.conversation-reasoning-card.conversation-reasoning-collapsed .conversation-reasoning-icon {
    width: 32px;
    height: 32px;
}

.conversation-reasoning-icon svg {
    display: block;
}

.conversation-reasoning-heading-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.conversation-reasoning-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.conversation-reasoning-summary {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-reasoning-body {
    overflow: visible;
    max-height: 820px;
    opacity: 1;
    margin-top: 10px;
    padding-bottom: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin-top 0.3s ease;
}

.conversation-reasoning-card:not(.conversation-reasoning-collapsed) .conversation-reasoning-body {
    max-height: calc(min(68vh, 620px) - 64px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 3px;
}

html[data-theme="dark"] .conversation-reasoning-card:not(.conversation-reasoning-collapsed) {
    background: rgba(15, 23, 42, 0.98);
    border-color: #2b374b;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), 0 3px 10px rgba(0, 0, 0, 0.28);
}

.conversation-reasoning-card.conversation-reasoning-collapsed .conversation-reasoning-body {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.conversation-reasoning-body .chat-reasoning-panel-hint {
    margin-top: 0;
    margin-bottom: 10px;
}

.chat-reasoning-panel-hint {
    font-size: 0.75rem;
    color: var(--text-muted, #718096);
    margin: 0;
    line-height: 1.45;
}

.chat-reasoning-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.session-settings-group {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    padding: 10px;
}

.session-settings-group-title {
    margin-bottom: 8px;
    color: var(--text-secondary, #4a5568);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.session-settings-inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.session-hitl-config {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

.ai-channel-manager {
    border: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 88%, transparent);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    overflow: hidden;
}

.ai-channel-manager-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 80%, transparent);
    background: color-mix(in srgb, var(--bg-secondary, #fbfcfe) 74%, var(--card-bg, #fff));
}

.ai-channel-manager-header h4 {
    margin: 0 0 6px;
    font-size: 17px;
    line-height: 1.25;
}

.ai-channel-manager-hint {
    display: block;
    margin: 0;
    color: var(--text-muted, #718096);
    font-size: 13px;
    line-height: 1.45;
}

.ai-channel-manager-hint.is-success {
    color: var(--text-muted, #718096);
}

.ai-channel-manager-hint.is-error {
    color: var(--error-color, #e53e3e);
}

.ai-channel-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}

.ai-channel-save-btn {
    flex-shrink: 0;
    min-width: 92px;
}

.ai-channel-manager-body {
    display: block;
    min-height: 0;
    background: var(--card-bg, #fff);
    overflow: visible;
}

.ai-channel-switcher {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 22px;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 72%, transparent);
    background: color-mix(in srgb, var(--bg-secondary, #f8fafc) 70%, var(--card-bg, #fff));
}

.ai-channel-switcher-field {
    display: grid;
    grid-template-columns: auto minmax(260px, 420px);
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ai-channel-switcher-field label {
    color: var(--text-secondary, #4a5568);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.ai-channel-switch-select {
    width: 100%;
    min-height: 38px;
    padding: 0.45rem 2rem 0.45rem 0.7rem;
    border: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 88%, transparent);
    border-radius: 7px;
    background: color-mix(in srgb, var(--input-bg, var(--card-bg, #fff)) 92%, transparent);
    color: var(--text-primary, #2d3748);
    font-size: 0.875rem;
}

.ai-channel-switch-select:focus {
    border-color: color-mix(in srgb, var(--accent-color, #3182ce) 70%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color, #3182ce) 12%, transparent);
    outline: none;
}

.ai-channel-switcher-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-channel-bulk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 68%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--card-bg, #fff) 38%, transparent);
    color: var(--text-secondary, #4a5568);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ai-channel-bulk-btn:hover {
    border-color: color-mix(in srgb, var(--accent-color, #3182ce) 34%, transparent);
    background: color-mix(in srgb, var(--accent-color, #3182ce) 8%, transparent);
    color: var(--accent-color, #3182ce);
}

.ai-channel-bulk-btn.danger {
    border-color: color-mix(in srgb, var(--error-color, #e53e3e) 28%, transparent);
    color: color-mix(in srgb, var(--error-color, #e53e3e) 82%, var(--text-secondary, #4a5568));
}

.ai-channel-bulk-btn.danger:hover {
    border-color: color-mix(in srgb, var(--error-color, #e53e3e) 44%, transparent);
    background: color-mix(in srgb, var(--error-color, #e53e3e) 7%, transparent);
    color: var(--error-color, #e53e3e);
}

.ai-channel-icon-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    color: var(--accent-color, #3182ce);
    font-size: 18px;
    line-height: 1;
    font-weight: 600;
    cursor: pointer;
}

.ai-channel-icon-btn:hover {
    border-color: var(--accent-color, #3182ce);
    background: color-mix(in srgb, var(--accent-color, #3182ce) 9%, transparent);
}

.ai-channel-native-select {
    display: none;
}

.ai-channel-list {
    display: none;
}

.ai-channel-list::-webkit-scrollbar {
    width: 8px;
}

.ai-channel-list::-webkit-scrollbar-track {
    background: transparent;
}

.ai-channel-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.55);
    border-radius: 999px;
    border: 2px solid var(--bg-secondary, #f8fafc);
}

.ai-channel-list::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.7);
}

.ai-channel-list-item {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    width: 100%;
    min-height: 86px;
    padding: 11px;
    border: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 64%, transparent);
    border-radius: 7px;
    background: color-mix(in srgb, var(--card-bg, #fff) 70%, transparent);
    color: var(--text-color, #2d3748);
    text-align: left;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.ai-channel-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ai-channel-bulk-check {
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
    border: 1px solid color-mix(in srgb, var(--text-muted, #718096) 52%, transparent);
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
    background-color: color-mix(in srgb, var(--card-bg, #fff) 84%, transparent);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 12px 12px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-channel-bulk-check:hover {
    border-color: var(--accent-color, #3182ce);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color, #3182ce) 12%, transparent);
}

.ai-channel-bulk-check:checked {
    border-color: color-mix(in srgb, var(--accent-color, #3182ce) 82%, transparent);
    background-color: var(--accent-color, #3182ce);
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 6.15L5.05 8.15L9 4.1' stroke='white' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    box-shadow: 0 1px 2px color-mix(in srgb, var(--accent-color, #3182ce) 24%, transparent);
}

.ai-channel-list-item.checked {
    border-color: color-mix(in srgb, var(--accent-color, #3182ce) 38%, transparent);
    background: color-mix(in srgb, var(--accent-color, #3182ce) 7%, var(--card-bg, #fff));
}

.ai-channel-list-item:hover {
    background: var(--card-bg, #fff);
    border-color: color-mix(in srgb, var(--accent-color, #3182ce) 24%, transparent);
}

.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-list-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ai-channel-list-main strong,
.ai-channel-list-meta,
.ai-channel-list-foot span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-channel-list-main strong {
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
}

.ai-channel-list-meta {
    color: var(--text-muted, #718096);
    font-size: 12px;
    line-height: 1.25;
}

.ai-channel-list-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-muted, #718096);
    font-size: 11px;
    line-height: 1.25;
}

.ai-channel-list-foot span:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.ai-channel-list-foot span:last-child {
    flex: 0 1 38%;
    max-width: 38%;
    text-align: right;
}

.ai-channel-status-label.ready {
    color: #10b981;
}

.ai-channel-status-label.complete {
    color: #3b82f6;
}

.ai-channel-status-label.testing {
    color: #3b82f6;
}

.ai-channel-status-label.failed {
    color: #ef4444;
}

.ai-channel-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex-shrink: 0;
    background: #cbd5e1;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 10%, transparent);
}

.ai-channel-status-dot.ready {
    background: #10b981;
}

.ai-channel-status-dot.complete {
    background: #3b82f6;
}

.ai-channel-status-dot.draft {
    background: #f59e0b;
}

.ai-channel-status-dot.testing {
    background: #3b82f6;
}

.ai-channel-status-dot.failed {
    background: #ef4444;
}

.ai-channel-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-color, #3182ce);
    background: rgba(49, 130, 206, 0.1);
    border-radius: 999px;
    padding: 2px 6px;
}

.ai-channel-editor {
    min-width: 0;
    min-height: 0;
    overflow-y: visible;
    padding: 20px 28px 28px;
    background: var(--card-bg, #fff);
}

.ai-channel-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 6px;
    padding-bottom: 16px;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 72%, transparent);
}

.ai-channel-editor-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted, #718096);
    font-size: 12px;
    font-weight: 700;
}

.ai-channel-editor-title {
    margin: 0;
    color: var(--text-muted, #718096);
    font-size: 12px;
    line-height: 1.5;
}

.ai-channel-editor-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.ai-channel-editor-chip {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 70%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--card-bg, #fff) 92%, var(--primary-color, #3182ce));
    color: var(--text-muted, #718096);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 7px 10px;
}

.ai-channel-editor-chip.default,
.ai-channel-editor-chip.complete {
    border-color: rgba(49, 130, 206, 0.22);
    background: rgba(49, 130, 206, 0.1);
    color: var(--primary-color, #3182ce);
}

.ai-channel-editor-chip.ready {
    border-color: rgba(16, 185, 129, 0.22);
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.ai-channel-editor-chip.testing {
    border-color: rgba(214, 158, 46, 0.24);
    background: rgba(214, 158, 46, 0.1);
    color: #b7791f;
}

.ai-channel-editor-chip.failed,
.ai-channel-editor-chip.draft {
    border-color: rgba(229, 62, 62, 0.2);
    background: rgba(229, 62, 62, 0.08);
    color: var(--error-color, #e53e3e);
}

.ai-channel-editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 1px;
}

.ai-channel-editor-actions .danger {
    color: var(--error-color, #e53e3e);
}

.ai-channel-editor-form {
    max-width: none;
}

.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 input[type="text"],
.ai-channel-editor-form input[type="password"],
.ai-channel-editor-form input[type="number"],
.ai-channel-editor-form select {
    width: 100%;
    min-height: 42px;
    padding: 0.5rem 0.75rem;
    border-radius: 7px;
    border-color: color-mix(in srgb, var(--border-color, #e2e8f0) 88%, transparent);
    background: color-mix(in srgb, var(--input-bg, var(--card-bg, #fff)) 92%, transparent);
    color: var(--text-color, #2d3748);
    font-size: 0.875rem;
}

.ai-channel-editor-form input:focus,
.ai-channel-editor-form select:focus {
    border-color: color-mix(in srgb, var(--accent-color, #3182ce) 70%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color, #3182ce) 12%, transparent);
    outline: none;
}

.ai-channel-editor-form .form-hint,
.ai-channel-editor-form small {
    display: block;
    margin-top: 5px;
    color: var(--text-muted, #718096);
    font-size: 0.75rem;
    line-height: 1.45;
}

.ai-channel-form-section {
    padding: 18px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 64%, transparent);
}

.ai-channel-form-section:last-of-type {
    border-bottom: 0;
}

.ai-channel-form-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 14px;
}

.ai-channel-form-section-head > div:first-child {
    max-width: 620px;
}

.ai-channel-form-section-head h6 {
    margin: 0;
    color: var(--text-primary, #1f2937);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.ai-channel-form-section-head p {
    margin: 4px 0 0;
    color: var(--text-muted, #718096);
    font-size: 12px;
    line-height: 1.45;
}

.ai-channel-section-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 210px;
}

.ai-channel-section-actions .form-inline-result {
    margin-top: 0;
}

.ai-channel-section-actions .connection-test-result {
    display: none;
    max-width: min(760px, 54vw);
    padding: 8px 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface-color, #ffffff) 86%, var(--bg-secondary, #f7fafc));
    color: var(--text-muted, #718096);
    font-size: 12px;
    line-height: 1.45;
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ai-channel-section-actions .connection-test-result.is-visible {
    display: inline-block;
}

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

.ai-channel-form-grid,
.ai-channel-reasoning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    column-gap: 16px;
    row-gap: 14px;
}

.ai-channel-reasoning-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.ai-channel-editor-form .span-2 {
    grid-column: 1 / -1;
}

.required-mark {
    color: var(--error-color, #e53e3e);
}

.form-inline-result {
    display: block;
    margin-top: 6px;
    color: var(--text-muted, #718096);
    font-size: 0.75rem;
    line-height: 1.45;
}

.ai-channel-reasoning-toggle {
    margin-top: 8px;
}

.ai-channel-advanced-section {
    padding: 10px 0 0;
    border-bottom: 0;
}

.ai-channel-advanced-section summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0;
    color: var(--text-primary, #1f2937);
    cursor: pointer;
    list-style: none;
}

.ai-channel-advanced-section summary::-webkit-details-marker {
    display: none;
}

.ai-channel-advanced-section summary::before {
    content: "";
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-right: 2px solid var(--text-muted, #718096);
    border-bottom: 2px solid var(--text-muted, #718096);
    transform: rotate(-45deg);
    transition: transform 0.16s ease;
}

.ai-channel-advanced-section[open] summary::before {
    transform: rotate(45deg);
}

.ai-channel-advanced-section summary strong {
    display: block;
    font-size: 14px;
    line-height: 1.35;
}

.ai-channel-advanced-section summary small {
    margin-top: 4px;
}

.ai-channel-advanced-section[open] .ai-channel-reasoning-grid {
    margin-top: 14px;
}

html[data-theme="dark"] .ai-channel-manager {
    background: #111827;
    border-color: rgba(71, 85, 105, 0.42);
}

html[data-theme="dark"] .ai-channel-manager-header {
    background: #111827;
    border-bottom-color: rgba(71, 85, 105, 0.34);
}

html[data-theme="dark"] .ai-channel-switcher {
    background: #101827;
    border-bottom-color: rgba(71, 85, 105, 0.34);
}

html[data-theme="dark"] .ai-channel-switcher-field label {
    color: #cbd5e1;
}

html[data-theme="dark"] .ai-channel-switch-select {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(71, 85, 105, 0.44);
    color: #e5e7eb;
}

html[data-theme="dark"] .ai-channel-sidebar {
    background: #101827;
    border-right-color: rgba(71, 85, 105, 0.34);
}

html[data-theme="dark"] .ai-channel-bulk-actions {
    background: transparent;
    border-color: transparent;
}

html[data-theme="dark"] .ai-channel-bulk-btn {
    background: rgba(15, 23, 42, 0.28);
    border-color: rgba(71, 85, 105, 0.36);
    color: #a7b3c7;
}

html[data-theme="dark"] .ai-channel-bulk-btn:hover {
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.36);
    color: #93c5fd;
}

html[data-theme="dark"] .ai-channel-bulk-btn.danger {
    background: rgba(127, 29, 29, 0.08);
    border-color: rgba(248, 113, 113, 0.24);
    color: #fca5a5;
}

html[data-theme="dark"] .ai-channel-bulk-btn.danger:hover {
    background: rgba(127, 29, 29, 0.18);
    border-color: rgba(248, 113, 113, 0.4);
}

html[data-theme="dark"] .ai-channel-bulk-check {
    background-color: rgba(15, 23, 42, 0.86);
    border-color: rgba(148, 163, 184, 0.38);
}

html[data-theme="dark"] .ai-channel-bulk-check:checked {
    background-color: #60a5fa;
    border-color: rgba(147, 197, 253, 0.9);
    box-shadow: 0 1px 3px rgba(96, 165, 250, 0.24);
}

html[data-theme="dark"] .ai-channel-editor {
    background: #111827;
}

html[data-theme="dark"] .ai-channel-editor-head {
    border-bottom-color: rgba(71, 85, 105, 0.34);
}

html[data-theme="dark"] .ai-channel-editor-chip {
    border-color: rgba(71, 85, 105, 0.46);
    background: rgba(15, 23, 42, 0.7);
    color: #94a3b8;
}

html[data-theme="dark"] .ai-channel-editor-chip.default,
html[data-theme="dark"] .ai-channel-editor-chip.complete {
    border-color: rgba(96, 165, 250, 0.34);
    background: rgba(96, 165, 250, 0.12);
    color: #93c5fd;
}

html[data-theme="dark"] .ai-channel-editor-chip.ready {
    border-color: rgba(52, 211, 153, 0.28);
    background: rgba(52, 211, 153, 0.1);
    color: #6ee7b7;
}

html[data-theme="dark"] .ai-channel-editor-chip.testing {
    border-color: rgba(251, 191, 36, 0.28);
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

html[data-theme="dark"] .ai-channel-editor-chip.failed,
html[data-theme="dark"] .ai-channel-editor-chip.draft {
    border-color: rgba(248, 113, 113, 0.28);
    background: rgba(248, 113, 113, 0.1);
    color: #fca5a5;
}

html[data-theme="dark"] .ai-channel-form-section,
html[data-theme="dark"] .ai-channel-advanced-section {
    border-color: rgba(71, 85, 105, 0.34);
}

html[data-theme="dark"] .ai-channel-form-section-head h6 {
    color: #e5e7eb;
}

html[data-theme="dark"] .ai-channel-form-section-head p,
html[data-theme="dark"] .form-inline-result {
    color: #94a3b8;
}

html[data-theme="dark"] .ai-channel-section-actions .connection-test-result {
    border-color: rgba(71, 85, 105, 0.52);
    background: rgba(15, 23, 42, 0.74);
    color: #94a3b8;
}

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-advanced-section summary {
    color: #e5e7eb;
}

html[data-theme="dark"] .ai-channel-icon-btn {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(71, 85, 105, 0.44);
}

html[data-theme="dark"] .ai-channel-icon-btn:hover {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.58);
}

html[data-theme="dark"] .ai-channel-list::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.58);
    border-color: #101827;
}

html[data-theme="dark"] .ai-channel-list-item {
    background: rgba(15, 23, 42, 0.42);
    border-color: rgba(71, 85, 105, 0.28);
    box-shadow: none;
}

html[data-theme="dark"] .ai-channel-list-item.checked {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(96, 165, 250, 0.34);
}

html[data-theme="dark"] .ai-channel-list-item:hover {
    background: rgba(30, 41, 59, 0.42);
    border-color: rgba(96, 165, 250, 0.26);
}

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-badge {
    background: rgba(96, 165, 250, 0.16);
    color: #93c5fd;
}

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

html[data-theme="dark"] .ai-channel-editor-form input[type="text"],
html[data-theme="dark"] .ai-channel-editor-form input[type="password"],
html[data-theme="dark"] .ai-channel-editor-form input[type="number"],
html[data-theme="dark"] .ai-channel-editor-form select {
    background: rgba(15, 23, 42, 0.52);
    border-color: rgba(71, 85, 105, 0.44);
}

.ai-channel-editor-form #openai-provider,
.ai-channel-editor-form #openai-reasoning-mode,
.ai-channel-editor-form #openai-reasoning-effort,
.ai-channel-editor-form #openai-reasoning-profile {
    background: var(--input-bg, var(--card-bg, #fff));
    color: var(--text-primary, #2d3748);
}

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

.chat-reasoning-field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #718096);
    margin-bottom: 5px;
}

.chat-reasoning-select {
    width: 100%;
    box-sizing: border-box;
    height: 36px;
    padding: 0 32px 0 10px;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    color: var(--text-color, #2d3748);
}

.session-settings-native-select {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

.session-settings-select {
    position: relative;
    width: 100%;
}

.session-settings-select-trigger {
    width: 100%;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: #fff;
    color: var(--text-color, #2d3748);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.session-settings-select-trigger:hover {
    border-color: rgba(49, 130, 206, 0.38);
    background: #fbfdff;
}

.session-settings-select-trigger:focus-visible,
.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-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-settings-select-caret {
    flex-shrink: 0;
    color: var(--text-muted, #718096);
    font-size: 17px;
    line-height: 1;
    transform: translateY(-1px);
    transition: transform 0.15s ease, color 0.15s ease;
}

.session-settings-select.open .session-settings-select-caret {
    color: var(--accent-color, #3182ce);
    transform: rotate(180deg) translateY(1px);
}

.session-settings-select-menu {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: none;
    max-height: 220px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}

.session-settings-select.open .session-settings-select-menu {
    display: block;
}

.session-settings-select-option {
    width: 100%;
    min-height: 32px;
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-color, #2d3748);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.session-settings-select-option:hover {
    background: rgba(49, 130, 206, 0.08);
}

.session-settings-select-option.is-selected {
    background: rgba(49, 130, 206, 0.12);
    color: var(--accent-color, #3182ce);
    font-weight: 700;
}

.session-settings-select-option-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-reasoning-card .hitl-reviewer-toggle {
    width: 100%;
    padding: 3px;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.conversation-reasoning-card .hitl-reviewer-toggle-btn {
    min-height: 30px;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.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 .chat-input-with-files,
.chat-input-primary-row .chat-input-with-files {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 6px;
}

.chat-input-container > .chat-input-field,
.chat-input-primary-row .chat-input-field {
    flex: 1;
    display: flex;
    min-width: 0;
}

.chat-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 0;
}

.chat-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(0, 102, 255, 0.08);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-primary);
    max-width: 200px;
}

.chat-file-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-file-chip-remove {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.chat-file-chip-remove:hover {
    background: rgba(0, 0, 0, 0.12);
    color: var(--text-primary);
}

.chat-file-chip--uploading {
    opacity: 0.92;
    border-style: dashed;
}

.chat-file-chip--error {
    border-color: rgba(220, 38, 38, 0.45);
    background: rgba(220, 38, 38, 0.06);
}

.chat-file-input-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.chat-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.chat-upload-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(0, 102, 255, 0.04);
}

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

.chat-input-field {
    flex: 1;
    position: relative;
    display: flex;
}

.chat-input-field textarea {
    width: 100%;
}

.chat-input-container .chat-input-field > #chat-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 0.9375rem;
    outline: none;
    transition: all 0.2s;
    background: #ffffff;
    color: var(--text-primary);
    resize: none;
    height: 40px;
    min-height: 40px;
    max-height: 120px;
    font-family: inherit;
    line-height: 1.4;
    overflow-y: auto;
    box-sizing: border-box;
    vertical-align: middle;
    /* 隐藏滚动条但保留滚动功能 */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: transparent transparent; /* Firefox - 隐藏滚动条 */
}

/* WebKit 浏览器（Chrome, Safari, Edge）的滚动条样式 - 隐藏但保留功能 */
.chat-input-container .chat-input-field > #chat-input::-webkit-scrollbar {
    width: 4px; /* 最窄的滚动条 */
}

.chat-input-container .chat-input-field > #chat-input::-webkit-scrollbar-track {
    background: transparent; /* 隐藏轨道 */
}

.chat-input-container .chat-input-field > #chat-input::-webkit-scrollbar-thumb {
    background: transparent; /* 默认隐藏滑块 */
    border-radius: 2px;
}

/* 鼠标悬停时显示滚动条 */
.chat-input-container .chat-input-field > #chat-input:hover::-webkit-scrollbar-thumb {
    background: var(--text-muted); /* 悬停时显示 */
}

.chat-input-container .chat-input-field > #chat-input:focus::-webkit-scrollbar-thumb {
    background: var(--text-muted); /* 聚焦时显示 */
}

.chat-input-container .chat-input-field > #chat-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.08);
    background: #ffffff;
}

.chat-input-container .chat-input-field > #chat-input::placeholder {
    color: var(--text-muted);
    opacity: 0.85;
}

.chat-input-container .send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 19px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-color) 0%, #0052cc 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 650;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.12s ease;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.2), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 按钮光效动画 */
.chat-input-container .send-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.chat-input-container .send-btn:hover::before {
    left: 100%;
}

.chat-input-container .send-btn:hover {
    background: linear-gradient(135deg, #0052cc 0%, var(--accent-color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.35), 0 2px 6px rgba(0, 0, 0, 0.15);
}

.chat-input-container .send-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 6px rgba(0, 102, 255, 0.25), 0 1px 3px rgba(0, 0, 0, 0.1);
    transition-duration: 0.08s;
}

.chat-input-container .send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

html[data-theme="dark"] .chat-input-container .send-btn {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: 1px solid rgba(96, 165, 250, 0.4);
    box-shadow:
        0 4px 10px rgba(2, 6, 23, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .chat-input-container .send-btn::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

html[data-theme="dark"] .chat-input-container .send-btn:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: rgba(147, 197, 253, 0.56);
    box-shadow:
        0 6px 14px rgba(2, 6, 23, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .chat-input-container .send-btn:active {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    border-color: rgba(96, 165, 250, 0.34);
    box-shadow:
        0 3px 8px rgba(2, 6, 23, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .chat-input-container .send-btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(96, 165, 250, 0.24),
        0 4px 10px rgba(2, 6, 23, 0.3);
}

html[data-theme="dark"] .chat-input-container .send-btn:disabled {
    background: #24324a;
    border-color: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    box-shadow: none;
    opacity: 1;
}

html[data-theme="dark"] .chat-input-container .send-btn:disabled::before {
    display: none;
}

.chat-input-container .send-btn svg {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: transform 0.18s ease;
}

.chat-input-container .send-btn:hover svg {
    transform: translateX(2px);
}

.chat-input-container .send-btn:active svg {
    transform: translateX(3px);
}

.chat-input-container .send-btn span {
    position: relative;
    z-index: 1;
}

@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-suggestions {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
    padding: 0;
    overflow: hidden;
    display: none;
    z-index: 15;
    animation: mentionFadeIn 0.15s ease-out;
    box-sizing: border-box;
}

.mention-suggestions-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 12px;
    box-sizing: border-box;
}

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

.mention-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 18px;
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.05);
    background: #f7f8fa !important;
    cursor: pointer;
    text-align: left;
    font-size: 0.875rem;
    color: rgba(15, 23, 42, 0.9) !important;
    transition: background 0.18s ease, border-left-color 0.18s ease, color 0.15s ease, transform 0.18s ease;
    border-left: 3px solid transparent;
    outline: none;
    border-radius: 12px;
    margin: 0 0 8px 0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    -webkit-appearance: none;
    appearance: none;
}

.mention-item:focus,
.mention-item:focus-visible {
    outline: none;
    box-shadow: none;
}

.mention-item:hover {
    background: #ffffff !important;
    border-left-color: rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

.mention-item.active,
.mention-item:focus,
.mention-item:focus-visible {
    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;
}

.mention-item.disabled {
    opacity: 0.65;
    box-shadow: none;
}

.mention-item-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(15, 23, 42, 0.95);
}

.mention-item-icon {
    font-size: 1rem;
}

.mention-item-text {
    flex: 1;
}

.mention-item-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    word-break: break-word;
}

.mention-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.75rem;
}

.mention-status {
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.mention-status.enabled {
    background: rgba(46, 204, 113, 0.18);
    color: #1e8a4d;
}

.mention-status.disabled {
    background: rgba(231, 76, 60, 0.18);
    color: #b23d2f;
}

.mention-origin {
    color: var(--text-secondary);
}

.mention-item-badge {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
    font-weight: 600;
}

.mention-item-badge.internal {
    background: rgba(108, 117, 125, 0.18);
    color: rgba(33, 37, 41, 0.9);
}

.mention-empty {
    padding: 10px 18px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* MCP调用详情按钮 */
.mcp-detail-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-primary);
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.mcp-detail-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.mcp-detail-btn:active {
    transform: translateY(0);
}

.mcp-detail-btn[data-exec-id] {
    min-height: 32px;
}

.mcp-detail-btn[data-status="completed"] {
    color: var(--text-primary);
    border-color: rgba(40, 167, 69, 0.34);
    background: rgba(40, 167, 69, 0.055);
}

.mcp-detail-btn[data-status="failed"] {
    color: var(--text-primary);
    border-color: rgba(220, 53, 69, 0.36);
    background: rgba(220, 53, 69, 0.06);
}

.mcp-detail-btn[data-status="running"],
.mcp-detail-btn[data-status="pending"] {
    color: var(--text-primary);
    border-color: rgba(0, 102, 255, 0.32);
    background: rgba(0, 102, 255, 0.055);
}

.mcp-detail-btn[data-status="cancelled"] {
    color: var(--text-muted);
    border-color: rgba(148, 163, 184, 0.32);
    background: rgba(148, 163, 184, 0.065);
}

.mcp-detail-btn .mcp-tool-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 登录遮罩 */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(245, 245, 245, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 24px;
    animation: loginOverlayIn 0.3s ease-out;
}

@keyframes loginOverlayIn {
    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-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-submit-arrow {
    transition: transform 0.2s ease;
}

.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,
.projects-modal-close,
.role-selection-panel-close,
.attack-chain-details-close,
.c2-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,
.projects-modal-close svg,
.role-selection-panel-close svg,
.attack-chain-details-close svg,
.c2-modal-close svg {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
}

.modal-close:not(:has(svg))::before,
.projects-modal-close:not(:has(svg))::before,
.c2-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,
.projects-modal-close:hover,
.role-selection-panel-close:hover,
.attack-chain-details-close:hover,
.c2-modal-close:hover {
    background: var(--close-btn-bg-hover);
    color: var(--close-btn-color);
}

.modal-close:active,
.projects-modal-close:active,
.role-selection-panel-close:active,
.attack-chain-details-close:active,
.c2-modal-close:active {
    background: var(--close-btn-bg-active);
    color: var(--close-btn-color);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.detail-section {
    margin-bottom: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section-overview {
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.07), rgba(0, 102, 255, 0.02));
    border-color: rgba(0, 102, 255, 0.2);
}

.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.detail-section h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.detail-info-grid .detail-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.detail-item strong {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.detail-item span {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    word-break: break-word;
}

.mono-text {
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid transparent;
    text-transform: none;
}

.status-chip.status-running {
    background: rgba(0, 102, 255, 0.12);
    color: var(--accent-color);
    border-color: rgba(0, 102, 255, 0.3);
}

.status-chip.status-completed {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
    border-color: rgba(40, 167, 69, 0.3);
}

.status-chip.status-failed {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error-color);
    border-color: rgba(220, 53, 69, 0.3);
}

.status-chip.status-cancelled {
    background: rgba(108, 117, 125, 0.12);
    color: var(--text-secondary, #6c757d);
    border-color: rgba(108, 117, 125, 0.35);
}

.status-chip.status-pending,
.status-chip.status-unknown {
    background: rgba(255, 193, 7, 0.12);
    color: #b8860b;
    border-color: rgba(255, 193, 7, 0.3);
}

.detail-abort-hint {
    font-size: 0.875rem;
    opacity: 0.88;
    margin: 0 0 10px;
    line-height: 1.45;
}

.detail-abort-section .btn-monitor-abort {
    border-color: rgba(253, 126, 20, 0.55);
    color: #fd7e14;
}

.detail-code-card {
    background: var(--bg-secondary);
    border: 1px dashed rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 12px;
}

.detail-code-card .code-block {
    margin: 0;
    max-height: 360px;
}

.detail-error-wrapper {
    border-color: rgba(220, 53, 69, 0.4);
    background: rgba(220, 53, 69, 0.05);
}

.detail-success-wrapper {
    border-color: rgba(40, 167, 69, 0.4);
    background: rgba(40, 167, 69, 0.03);
}

.code-block {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
    color: var(--text-primary);
}

.code-block.error {
    background: #fff5f5;
    border-color: var(--error-color);
    color: var(--error-color);
}

.code-block.success {
    background: rgba(40, 167, 69, 0.05);
    border-color: var(--success-color);
}

#mcp-detail-modal {
    background: rgba(3, 7, 18, 0.58);
    backdrop-filter: blur(4px);
}

#mcp-detail-modal .mcp-detail-content {
    width: min(980px, calc(100vw - 48px));
    max-width: 980px;
    max-height: min(86vh, 880px);
    margin: 6vh auto;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

#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-section {
    margin-bottom: 18px;
    padding: 20px 22px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: none;
}

#mcp-detail-modal .detail-section-overview {
    padding: 14px 16px;
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.22);
}

#mcp-detail-modal .detail-section-header {
    margin-bottom: 14px;
}

#mcp-detail-modal .detail-section-overview .detail-section-header {
    margin-bottom: 10px;
}

#mcp-detail-modal .detail-section h3 {
    font-size: 0.98rem;
    letter-spacing: 0;
}

#mcp-detail-modal .detail-section-header .btn-ghost {
    border-color: rgba(148, 163, 184, 0.24);
    background: rgba(248, 250, 252, 0.72);
    color: var(--text-secondary);
    min-height: 32px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.2;
    box-shadow: none;
}

#mcp-detail-modal .detail-section-header .btn-ghost:hover {
    border-color: rgba(100, 116, 139, 0.34);
    background: #ffffff;
    color: var(--text-primary);
}

#mcp-detail-modal .detail-section-header .btn-ghost:disabled {
    cursor: default;
    opacity: 1;
    border-color: rgba(34, 197, 94, 0.24);
    background: rgba(240, 253, 244, 0.72);
    color: #15803d;
}

#mcp-detail-modal .detail-info-grid {
    grid-template-columns: minmax(180px, 1.2fr) minmax(130px, 0.7fr) minmax(190px, 0.95fr) minmax(260px, 1.35fr);
    gap: 10px;
}

#mcp-detail-modal .detail-info-grid .detail-item {
    min-width: 0;
    min-height: 58px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #ffffff;
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: none;
}

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

#mcp-detail-modal .detail-item strong {
    font-size: 0.72rem;
    letter-spacing: 0;
    text-transform: none;
}

#mcp-detail-modal .detail-item span {
    min-width: 0;
    font-size: 0.9rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

#mcp-detail-modal .mono-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

#mcp-detail-modal .status-chip {
    width: fit-content;
    min-width: 76px;
    padding: 4px 10px;
    font-size: 0.82rem;
}

#mcp-detail-modal .detail-code-card {
    padding: 0;
    overflow: auto;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    box-shadow: none;
}

#mcp-detail-modal .detail-result-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: -2px 0 12px;
    padding: 3px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: #f8fafc;
}

#mcp-detail-modal .detail-result-tab {
    min-height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

#mcp-detail-modal .detail-result-tab.active {
    background: #ffffff;
    color: var(--text-primary);
    box-shadow: none;
}

#mcp-detail-modal .detail-result-tab.disabled,
#mcp-detail-modal .detail-result-tab:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

#mcp-detail-modal .detail-result-panel {
    display: none;
}

#mcp-detail-modal .detail-result-panel.active {
    display: block;
}

#mcp-detail-modal .detail-code-card .code-block,
#mcp-detail-modal .code-block {
    max-height: 360px;
    padding: 18px 20px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #0f172a;
    font-size: 0.84rem;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow: auto;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#mcp-detail-modal .code-block.error {
    color: #991b1b;
}

#mcp-detail-modal .code-block::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

#mcp-detail-modal .code-block::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.36);
    border: 2px solid rgba(248, 250, 252, 0.9);
    border-radius: 999px;
}

#mcp-detail-modal .code-block::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.62);
}

#mcp-detail-modal .detail-success-wrapper {
    border-color: rgba(34, 197, 94, 0.28);
    background: rgba(240, 253, 244, 0.74);
}

#mcp-detail-modal .detail-error-wrapper {
    border-color: rgba(239, 68, 68, 0.32);
    background: rgba(254, 242, 242, 0.76);
}

#mcp-detail-modal .detail-abort-section {
    border-color: rgba(245, 158, 11, 0.32);
    background: rgba(255, 251, 235, 0.82);
}

#mcp-detail-modal .detail-abort-hint {
    color: var(--text-secondary);
}

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

.btn-ghost {
    padding: 6px 14px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--accent-color);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    background: rgba(0, 102, 255, 0.08);
    border-color: rgba(0, 102, 255, 0.2);
    color: var(--accent-hover);
}

/* 全局滚动条：细条，默认隐藏，悬停显示 */
* {
    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-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    max-width: 100%;
}

.progress-container.completed {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    opacity: 0.95;
}

.progress-details {
    margin-top: 8px;
    margin-bottom: 24px;
}

.progress-timeline-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.progress-timeline-empty.progress-timeline-lazy-clickable {
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    border-radius: 4px;
}

.progress-timeline-empty.progress-timeline-lazy-clickable:hover {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.progress-timeline-empty.progress-timeline-lazy-clickable:focus-visible {
    outline: 2px solid var(--accent-color, #3b82f6);
    outline-offset: 2px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.progress-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.progress-stop {
    padding: 4px 12px;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 4px;
    font-size: 0.8125rem;
    color: var(--error-color);
    cursor: pointer;
    transition: all 0.2s;
}

.progress-stop:hover {
    background: rgba(220, 53, 69, 0.15);
    border-color: var(--error-color);
}

.progress-stop:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.progress-toggle {
    padding: 4px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.progress-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* 详情区底部「收起/展开」，流式输出过长时无需滚回顶部即可折叠 */
.progress-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.progress-timeline {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

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

.timeline-item {
    padding: 12px;
    margin-bottom: 8px;
    border-left: 3px solid var(--border-color);
    padding-left: 16px;
    background: var(--bg-secondary);
    border-radius: 4px;
    transition: all 0.2s;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.timeline-item:hover {
    background: var(--bg-tertiary);
}

.timeline-item.timeline-item-focus-pulse {
    outline: 2px solid rgba(96, 165, 250, 0.85);
    outline-offset: 2px;
    animation: highlight-flash 1.1s ease-in-out 2;
}

/* 迭代轮次：暖琥珀色条 + 极浅底，与紫（推理）/蓝（工具）区分但不抢视觉 */
.timeline-item-iteration {
    border-left-color: #c4a574;
    background: rgba(180, 140, 90, 0.045);
}

/*
 * Eino 主/子代理：保留 timeline-eino-role-* class（由 applyEinoTimelineRole 写入），
 * 但不再在此处整卡铺色 + !important，否则会盖住工具调用/结果/思考的类型色。
 * 主编排 vs 子代理的区分由「迭代轮次」上的 timeline-eino-scope-* 负责。
 */
.timeline-item.timeline-item-iteration.timeline-eino-scope-main {
    border-left-color: #b8956a;
    background: rgba(184, 149, 106, 0.05);
}
.timeline-item.timeline-item-iteration.timeline-eino-scope-sub {
    border-left-color: #a6896c;
    background: rgba(166, 137, 108, 0.045);
}

.timeline-item-iteration .timeline-item-title {
    color: var(--text-secondary);
    font-weight: 500;
}

/* 模型内部思考：弱化灰紫，避免与「助手输出」抢视觉 */
.timeline-item-thinking {
    border-left-color: #7e57c2;
    background: rgba(103, 58, 183, 0.06);
}

/* 迭代中主通道流式正文（标题常为「助手输出」等）：中性底 + 主色条，表示对用户可见的答复流 */
.timeline-item-thinking[data-response-stream-placeholder="1"] {
    border-left-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.055);
    border-color: rgba(59, 130, 246, 0.16);
}

/* Eino single/deep/supervisor 的主通道是助手正文，不使用 planning 的青绿色卡片 */
.timeline-item-planning[data-orchestration]:not([data-orchestration="plan_execute"]) {
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.055);
    border-color: rgba(59, 130, 246, 0.16);
}

.timeline-item-reasoning_chain {
    border-left-color: #5e35b1;
    background: rgba(94, 53, 177, 0.07);
}

.timeline-item-planning {
    border-left-color: #00838f;
    background: rgba(0, 131, 143, 0.06);
}

/* 工具调用：信息色（蓝），与「结果绿/红」分离；完成态不再用绿色以免与成功结果混淆 */
.timeline-item-tool_call {
    border-left-color: #1565c0;
    background: rgba(21, 101, 192, 0.07);
}

.timeline-item-tool_call:has(.tool-result-section.success) {
    border-left-color: var(--success-color);
    background: rgba(40, 167, 69, 0.07);
}

.timeline-item-tool_call:has(.tool-result-section.error) {
    border-left-color: var(--error-color);
    background: rgba(220, 53, 69, 0.07);
}

.timeline-item-tool_call .tool-result-slot {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.12);
}

.timeline-item-tool_call .tool-result-section.pending .tool-result-pending {
    color: var(--text-muted);
    font-style: italic;
}

.timeline-item-tool_result {
    border-left-color: #78909c;
    background: rgba(120, 144, 156, 0.06);
}

.timeline-item-tool_result:has(.tool-result-section.success) {
    border-left-color: var(--success-color);
    background: rgba(40, 167, 69, 0.07);
}

.timeline-item-tool_result:has(.tool-result-section.error) {
    border-left-color: var(--error-color);
    background: rgba(220, 53, 69, 0.07);
}

.timeline-item-tool_result.error {
    border-left-color: var(--error-color);
    background: rgba(220, 53, 69, 0.07);
}

.timeline-item-eino_agent_reply {
    border-left-color: #6a1b9a;
    background: rgba(106, 27, 154, 0.07);
}

.timeline-item-progress {
    border-left-color: #607d8b;
    background: rgba(96, 125, 139, 0.08);
}

.timeline-item-eino_usage_summary {
    border-left-color: #0f766e;
    background: rgba(20, 184, 166, 0.07);
}

.timeline-item-warning {
    border-left-color: #f57c00;
    background: rgba(245, 124, 0, 0.09);
}

.timeline-item-finalization_check {
    border-left-color: #f57c00;
    background: linear-gradient(90deg, rgba(245, 124, 0, 0.1), rgba(96, 125, 139, 0.045));
}

.timeline-item-finalization_check .timeline-item-title {
    color: #9a5200;
    font-weight: 600;
}

.timeline-item-tool_calls_detected {
    border-left-color: #0277bd;
    background: rgba(2, 119, 189, 0.06);
}

.timeline-item-error {
    border-left-color: var(--error-color);
    background: rgba(220, 53, 69, 0.1);
}

.timeline-item-cancelled {
    border-left-color: #ff7043;
    background: rgba(255, 112, 67, 0.12);
}

.timeline-item-user_interrupt_continue {
    border-left-color: #d97706;
    background: rgba(217, 119, 6, 0.08);
}

.timeline-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.timeline-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    min-width: 70px;
}

.timeline-item-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    flex: 1;
}

.timeline-item-content {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow-x: auto;
    box-sizing: border-box;
}

/* 流式增量阶段纯文本展示（避免半段 Markdown 反复解析） */
.timeline-item-content.timeline-stream-plain {
    white-space: pre-wrap;
    word-break: break-word;
}

/* 过程详情纯文本：避免长 URL/代码/表格撑破时间线条目 */
.timeline-item-content .timeline-plain-text {
    margin: 0;
    font: inherit;
    color: inherit;
    background: transparent;
}

.timeline-item-content p,
.timeline-item-content li,
.timeline-item-content td,
.timeline-item-content th {
    overflow-wrap: break-word;
    word-break: break-word;
}

.timeline-item-content pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    box-sizing: border-box;
}

.timeline-item-content code {
    overflow-wrap: break-word;
    word-break: break-word;
}

.timeline-item-content .table-wrapper {
    max-width: 100%;
    overflow-x: auto;
}

.timeline-item-content table {
    max-width: 100%;
}

/* 长过程详情：跳过视口外时间线条目的布局/绘制，减轻大段工具输出时的主线程压力 */
.progress-timeline .timeline-item {
    content-visibility: auto;
    contain-intrinsic-size: auto 72px;
}

.timeline-live-pruned-marker {
    position: sticky;
    top: 0;
    z-index: 3;
    margin: 8px 0;
    padding: 8px 12px;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 6px;
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.08);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    font-size: 0.8125rem;
}

.tool-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-arg-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-arg-section strong {
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.tool-args {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow-x: auto;
    margin: 0;
    color: var(--text-primary);
}

.tool-result-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-result-section strong {
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.tool-result {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-primary);
}

.workflow-agent-io {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.workflow-agent-input {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: color-mix(in srgb, var(--bg-tertiary) 70%, transparent);
}

.workflow-agent-input summary {
    display: grid;
    grid-template-columns: auto auto auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
    list-style: none;
    min-width: 0;
}

.workflow-agent-input summary::-webkit-details-marker {
    display: none;
}

.workflow-agent-input summary::before {
    content: '▸';
    color: var(--text-muted);
    font-size: 0.75rem;
}

.workflow-agent-input[open] summary::before {
    content: '▾';
}

.workflow-agent-io-label {
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 600;
}

.workflow-agent-input code {
    color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-color) 24%, transparent);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.workflow-agent-input-summary {
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.workflow-agent-input pre {
    margin: 0 10px 10px;
    max-height: 180px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}

.workflow-agent-empty {
    margin: 0 10px 10px;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.workflow-agent-output {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.workflow-agent-output-body {
    color: var(--text-secondary);
}

.workflow-condition-result,
.workflow-branch-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.workflow-condition-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.workflow-condition-result code,
.workflow-branch-detail code {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-secondary, rgba(127, 127, 127, 0.12));
    word-break: break-all;
}

.workflow-condition-branch {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.workflow-condition-branch.is-true {
    color: #86efac;
    background: rgba(34, 197, 94, 0.15);
}

.workflow-condition-branch.is-false {
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.15);
}

.timeline-item-workflow_branch_taken .timeline-item-title {
    color: #86efac;
}

.timeline-item-workflow_branch_skipped .timeline-item-title {
    color: var(--text-secondary);
}

/* 整页 HTML（如 HTTP 探测响应）在时间线中仅以转义文本展示 */
.timeline-item-content .sanitized-raw-html-fallback {
    max-height: 320px;
}

.tool-result-section.error .tool-result {
    background: rgba(220, 53, 69, 0.1);
    border-color: var(--error-color);
    color: var(--error-color);
}

.tool-result-section.success .tool-result {
    background: rgba(40, 167, 69, 0.1);
    border-color: var(--success-color);
}

.tool-execution-id {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tool-execution-id code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    color: var(--text-secondary);
}

/* 工具调用状态徽章 */
.tool-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
    white-space: nowrap;
    vertical-align: middle;
}

.tool-status-badge.tool-status-running {
    background: rgba(0, 102, 255, 0.12);
    color: var(--accent-color);
    border: 1px solid rgba(0, 102, 255, 0.3);
}

.tool-status-badge.tool-status-running::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    display: inline-block;
    animation: tool-running-pulse 1.5s infinite;
}

@keyframes tool-running-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.tool-status-badge.tool-status-completed {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.tool-status-badge.tool-status-failed {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error-color);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* 工具调用项状态：摘要态直接表达成功/失败，避免必须展开才能判断状态 */
.timeline-item-tool_call.tool-call-running {
    border: 1px solid rgba(66, 165, 245, 0.32);
    border-left: 3px solid #42a5f5;
    background: rgba(66, 165, 245, 0.075);
}

.timeline-item-tool_call.tool-call-completed {
    border: 1px solid rgba(40, 167, 69, 0.34);
    border-left: 3px solid var(--success-color);
    background: rgba(40, 167, 69, 0.075);
}

.timeline-item-tool_call.tool-call-failed {
    border: 1px solid rgba(220, 53, 69, 0.36);
    border-left: 3px solid var(--error-color);
    background: rgba(220, 53, 69, 0.085);
}

.timeline-item-tool_call.tool-call-incomplete {
    border: 1px solid rgba(245, 158, 11, 0.38);
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.085);
}

.timeline-item.tool-detail-collapsible {
    cursor: pointer;
}

.timeline-item.tool-detail-collapsible .timeline-item-header {
    cursor: pointer;
    position: relative;
}

.timeline-item.tool-detail-collapsible .timeline-item-header:hover .timeline-item-title {
    color: var(--accent-color);
}

/* 参数块与卡片类型色弱对齐，扫读时一眼归到「调用」 */
.timeline-item-tool_call .tool-args {
    background: rgba(21, 101, 192, 0.06);
    border-color: rgba(21, 101, 192, 0.22);
}

.tool-args-hitl-edited {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
    font-size: 11px;
    font-weight: 600;
}

.timeline-item-tool_result:has(.tool-result-section.success) .tool-result {
    background: rgba(40, 167, 69, 0.08);
    border-color: rgba(40, 167, 69, 0.35);
}

.timeline-item-tool_result:has(.tool-result-section.error) .tool-result {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.45);
}

/* 活跃任务栏 */
.active-tasks-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 13px 24px 14px;
    margin: 0;
    background: var(--bg-primary);
    border: 1px solid rgba(0, 102, 255, 0.15);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

.active-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-primary);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 8px;
    height: 40px;
    padding: 3px 12px;
    flex-shrink: 0;
    min-width: 280px;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.03);
}

.active-task-item-clickable {
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

.active-task-item-clickable:hover {
    border-color: rgba(0, 102, 255, 0.45);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.03), 0 2px 8px rgba(0, 102, 255, 0.12);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .active-tasks-bar {
        padding: 10px 16px;
    }
}

.active-task-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
}

.active-task-status {
    background: rgba(0, 102, 255, 0.12);
    color: var(--accent-color);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.active-task-message {
    font-size: 0.85rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
}

.active-task-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.active-task-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.active-task-cancel {
    padding: 6px 12px;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 6px;
    color: var(--error-color);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.active-task-cancel:hover {
    background: rgba(220, 53, 69, 0.2);
    border-color: var(--error-color);
}

.active-task-cancel:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.active-task-error {
    font-size: 0.875rem;
    color: var(--error-color);
}

/* 设置模态框样式 */
.settings-modal-content {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.settings-body {
    overflow-y: auto;
    flex: 1;
    padding: 24px;
}

/* 设置页面布局 */
.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;
}

.settings-advanced-block {
    grid-column: 1 / -1;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.settings-advanced-block summary {
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent-color);
}

.robot-manager {
    margin-bottom: 24px;
}

.robot-manager-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.robot-manager-toolbar h4 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.robot-manager-toolbar p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.robot-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.robot-card {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    min-height: 104px;
    padding: 16px;
    text-align: left;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.robot-card:hover,
.robot-card.is-active {
    border-color: var(--accent-color);
    background: var(--bg-primary);
}

.robot-card:hover {
    transform: translateY(-1px);
}

.robot-card-main,
.robot-card-meta {
    display: flex;
    flex-direction: column;
}

.robot-card-main {
    min-width: 0;
    gap: 8px;
}

.robot-card-meta {
    flex-shrink: 0;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.robot-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.robot-card-desc {
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.robot-card-action {
    font-size: 0.8125rem;
    color: var(--accent-color);
    font-weight: 500;
}

.robot-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.robot-status-pill--idle {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.robot-status-pill--ready {
    color: var(--accent-color);
    background: rgba(0, 102, 255, 0.1);
    border-color: rgba(0, 102, 255, 0.25);
}

.robot-status-pill--enabled {
    color: var(--success-color);
    background: rgba(40, 167, 69, 0.12);
    border-color: rgba(40, 167, 69, 0.35);
}

.robot-editor-empty {
    margin: 8px 0 24px;
    padding: 28px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    text-align: center;
}

.robot-editor-empty h4 {
    margin: 0 0 8px;
    font-size: 1rem;
    color: var(--text-primary);
}

.robot-editor-empty p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.robot-editor-panel {
    margin-top: 8px;
    padding: 20px 22px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.robot-editor-panel[hidden],
.robot-editor-empty[hidden] {
    display: none !important;
}

.robot-service-admin-warning {
    display: block;
    margin-top: 8px;
    padding: 9px 11px;
    border: 1px solid rgba(220, 53, 69, 0.25);
    border-radius: 8px;
    color: var(--error-color) !important;
    background: rgba(220, 53, 69, 0.07);
    line-height: 1.45;
}

.robot-service-admin-warning[hidden] {
    display: none !important;
}

.robot-create-modal-content {
    max-width: 680px;
}

.robot-commands-modal-content {
    max-width: 720px;
    max-height: 86vh;
}

.robot-commands-modal-body {
    max-height: calc(86vh - 88px);
    overflow-y: auto;
}

/* Robot account binding */
.robot-account-binding-content {
    width: min(760px, calc(100% - 32px));
    max-width: 760px;
    max-height: 90vh;
    border-radius: 18px;
}

.robot-binding-header {
    padding: 22px 26px;
    background: var(--bg-primary);
}

.robot-binding-heading {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.robot-binding-heading-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    color: #fff;
    border-radius: 12px;
    background: var(--brand-gradient);
    box-shadow: 0 8px 18px rgba(88, 80, 236, 0.24);
}

.robot-binding-heading h2 {
    font-size: 1.3rem;
    background: none;
    -webkit-text-fill-color: currentColor;
}

.robot-binding-heading p {
    margin: 3px 0 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.robot-binding-body {
    padding: 24px 26px 26px;
    overflow-y: auto;
    background: var(--bg-secondary);
}

.robot-binding-guide {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.robot-binding-guide-number {
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: var(--accent-color);
    background: rgba(0, 102, 255, 0.1);
    font-size: 0.72rem;
    font-weight: 700;
}

.robot-binding-guide-arrow {
    margin: 0 5px;
    color: var(--text-muted);
}

.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-code-meta,
.robot-binding-timer-copy,
.robot-binding-section-heading,
.robot-binding-account-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.robot-binding-one-time-badge {
    padding: 4px 9px;
    border-radius: 999px;
    color: #5b35c9;
    background: rgba(124, 58, 237, 0.1);
    font-size: 0.72rem;
    font-weight: 700;
}

.robot-binding-state {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
}

.is-active .robot-binding-state {
    color: var(--success-color);
}

.is-expired .robot-binding-state {
    color: var(--error-color);
}

.robot-binding-code-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 18px 0 15px;
}

.robot-binding-code-row code {
    flex: 1;
    min-width: 190px;
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: clamp(1.7rem, 4vw, 2.25rem);
    font-weight: 700;
    letter-spacing: 0.16em;
    line-height: 1.2;
    white-space: nowrap;
}

.is-empty .robot-binding-code-row code {
    color: var(--text-muted);
}

.is-expired .robot-binding-code-row code {
    color: var(--error-color);
    font-size: 1.4rem;
    letter-spacing: 0.08em;
}

.robot-binding-code-actions {
    display: flex;
    gap: 9px;
}

.robot-binding-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.robot-binding-timer {
    margin-top: 4px;
}

.robot-binding-timer-copy {
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.robot-binding-timer-copy strong {
    color: var(--accent-color);
    font: 700 0.95rem ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.04em;
}

.is-expired .robot-binding-timer-copy strong,
.is-expired .robot-binding-timer-copy span {
    color: var(--error-color);
}

.robot-binding-progress {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--bg-tertiary);
}

.robot-binding-progress span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: var(--brand-gradient);
    transition: width 0.25s linear;
}

.robot-binding-security-note {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 15px 0 0;
    color: var(--text-secondary);
    font-size: 0.76rem;
}

.robot-binding-security-note svg {
    flex: 0 0 auto;
    color: var(--success-color);
}

.robot-binding-list-section {
    margin-top: 22px;
}

.robot-binding-section-heading {
    margin-bottom: 12px;
}

.robot-binding-section-heading h3 {
    margin: 0;
    font-size: 1rem;
}

.robot-binding-section-heading p {
    margin: 2px 0 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.robot-account-binding-list {
    display: grid;
    gap: 9px;
}

.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,
.robot-binding-list-loading {
    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-service-hint {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    min-width: 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.5;
}

.robot-binding-service-hint-icon {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: inline-grid;
    place-items: center;
    color: var(--accent-color);
    border-radius: 8px;
    background: rgba(0, 102, 255, 0.09);
}

.robot-binding-footer > .btn-secondary {
    flex: 0 0 auto;
    min-width: 66px;
    min-height: 38px;
}

html[data-theme="dark"] .robot-binding-guide-number,
html[data-theme="dark"] .robot-binding-platform-icon,
html[data-theme="dark"] .robot-binding-empty-icon {
    background: rgba(96, 165, 250, 0.14);
}

html[data-theme="dark"] .robot-binding-one-time-badge {
    color: #c4b5fd;
    background: rgba(167, 139, 250, 0.14);
}

html[data-theme="dark"] .robot-binding-service-hint-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;
    }

}

.robot-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.robot-type-option {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 92px;
    padding: 16px;
    text-align: left;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.robot-type-option:hover {
    border-color: var(--accent-color);
    background: var(--bg-primary);
    transform: translateY(-1px);
}

.robot-type-option span {
    font-size: 0.9375rem;
    font-weight: 600;
}

.robot-type-option small {
    color: var(--text-secondary);
    line-height: 1.45;
}

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

.settings-subsection-header {
    margin-top: 24px;
    margin-bottom: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.settings-subsection-header h5 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.robot-command-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.robot-command-entry h4 {
    margin: 0 0 6px;
}

.robot-command-entry .settings-description {
    margin: 0;
}

.robot-command-entry-copy {
    min-width: 0;
}

.robot-cmd-category {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 16px 0 6px;
    letter-spacing: 0.02em;
}

.robot-cmd-category:first-of-type {
    margin-top: 8px;
}

.robot-cmd-list {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.8;
    margin: 0 0 4px 16px;
    padding: 0;
}

.robot-cmd-footer {
    margin-top: 12px !important;
    margin-bottom: 0 !important;
}

@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: flex-end;
    gap: 12px 14px;
}

.audit-field--event {
    flex: 0 1 360px;
    min-width: 200px;
    max-width: 420px;
}

.audit-field--result {
    flex: 0 0 112px;
    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: column;
    gap: 6px;
    min-width: 0;
}

.audit-field > span {
    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--ok {
    color: #0d7a3e;
    background: rgba(13, 122, 62, 0.1);
    border-color: rgba(13, 122, 62, 0.22);
}

.audit-tag--fail {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.1);
    border-color: rgba(192, 57, 43, 0.22);
}

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

.audit-tag--ip {
    color: #5c6b7a;
    background: rgba(92, 107, 122, 0.08);
    border-color: rgba(92, 107, 122, 0.18);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

#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-wrapper {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: #0d1117;
}

.terminal-tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    padding: 6px 10px 0;
    background: #161b22;
    border-bottom: 1px solid var(--border-color);
    min-height: 36px;
}

.terminal-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 12px;
    font-size: 0.8125rem;
    color: #8b949e;
    background: transparent;
    border: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    margin-right: 2px;
}

.terminal-tab-label {
    cursor: pointer;
}

.terminal-tab-close {
    padding: 0;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    font-size: 0;
    line-height: 0;
    color: #8b949e;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
    appearance: none;
}

.terminal-tab-close::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    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;
}

.terminal-tab-close:hover {
    background: var(--close-btn-bg-hover);
    color: var(--close-btn-color);
}

.terminal-tab-close:active {
    background: var(--close-btn-bg-active);
    color: var(--close-btn-color);
}

.terminal-tab:hover {
    color: #e6edf3;
    background: rgba(255, 255, 255, 0.06);
}

.terminal-tab.active {
    color: #e6edf3;
    background: #0d1117;
    font-weight: 500;
}

.terminal-tab-new {
    margin-left: 4px;
    width: 28px;
    height: 28px;
    font-size: 1.125rem;
    line-height: 1;
    color: #8b949e;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.terminal-tab-new:hover {
    color: #58a6ff;
    background: rgba(88, 166, 255, 0.1);
    border-color: rgba(88, 166, 255, 0.3);
}

.terminal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #161b22;
    border-bottom: 1px solid var(--border-color);
}

.terminal-toolbar-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #8b949e;
    letter-spacing: 0.02em;
}

.terminal-btn {
    padding: 6px 12px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.terminal-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border-color: #8b949e;
}

.terminal-panes {
    position: relative;
    height: 400px;
    min-height: 400px;
    overflow: hidden;
}

.terminal-pane {
    display: none;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.terminal-pane.active {
    display: block;
}

.terminal-container {
    height: 100%;
    min-height: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.terminal-container .xterm {
    padding: 8px 12px 8px 8px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    background: #0d1117;
}

.terminal-container .xterm-viewport {
    border-radius: 0;
    background: #0d1117;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 148, 158, 0.7) rgba(22, 27, 34, 0.95);
}
.terminal-container .xterm-viewport::-webkit-scrollbar {
    width: 8px;
}
.terminal-container .xterm-viewport::-webkit-scrollbar-track {
    background: rgba(22, 27, 34, 0.95);
    border-left: 1px solid rgba(48, 54, 61, 0.9);
}
.terminal-container .xterm-viewport::-webkit-scrollbar-thumb {
    min-height: 44px;
    background: rgba(139, 148, 158, 0.72);
    border: 1px solid rgba(22, 27, 34, 0.95);
    border-radius: 8px;
}
.terminal-container .xterm-viewport::-webkit-scrollbar-thumb:hover {
    background: rgba(177, 186, 196, 0.82);
}
.terminal-container .xterm-viewport::-webkit-scrollbar-thumb:active {
    background: rgba(201, 209, 217, 0.9);
}

.terminal-error {
    color: #ff7b72;
    padding: 16px;
    font-size: 0.875rem;
}

.settings-section {
    margin-bottom: 32px;
}

.mcp-management-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 16px;
    align-items: stretch;
    height: calc(100vh - 210px);
    min-height: 520px;
    max-height: calc(100vh - 210px);
}

.mcp-management-panel {
    margin-bottom: 0 !important;
    padding: 14px 16px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.mcp-tools-panel {
    min-width: 0;
    order: 2;
}

.mcp-external-panel {
    min-width: 0;
    order: 1;
}

.mcp-panel-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.mcp-tools-panel .tools-controls,
.mcp-external-panel .external-mcp-controls {
    flex: 1;
    min-height: 0;
}

.mcp-tools-panel .tools-list {
    flex: 1;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
}

.mcp-tools-panel .tools-list-items {
    max-height: none;
    overflow: visible;
}

.mcp-external-panel .external-mcp-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.mcp-external-panel .external-mcp-controls {
    gap: 12px;
}

/* MCP 双栏内工具操作条允许换行，避免面板内溢出 */
.mcp-tools-panel .tools-actions {
    flex-wrap: wrap;
    row-gap: 8px;
}

.mcp-tools-panel .search-box {
    min-width: min(280px, 100%);
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.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: 100%;
    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-native-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.settings-custom-select {
    position: relative;
    width: 100%;
    min-width: 0;
}

.settings-custom-select--compact {
    width: auto;
    flex: 0 0 auto;
}

.settings-custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.9375rem;
    line-height: 1.25;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.settings-custom-select--compact .settings-custom-select-trigger {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.875rem;
}

.settings-custom-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-custom-select-caret {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1;
    transition: transform 0.15s ease;
}

.settings-custom-select.open .settings-custom-select-caret {
    transform: rotate(180deg);
}

.settings-custom-select-trigger:hover:not(:disabled) {
    border-color: var(--accent-color);
}

.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-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 2600;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
}

.settings-custom-select.open .settings-custom-select-menu {
    display: block;
}

.settings-custom-select-menu--floating {
    display: block;
    position: fixed;
    z-index: 10050;
}

.settings-custom-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.settings-custom-select-option:hover:not(:disabled) {
    background: var(--bg-secondary);
}

.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,
.settings-custom-select-option:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.settings-custom-select-check {
    flex: 0 0 14px;
    width: 14px;
    color: var(--accent-color);
    font-size: 0.75rem;
    line-height: 1;
    opacity: 0;
    text-align: center;
}

.settings-custom-select-option.is-selected .settings-custom-select-check {
    opacity: 1;
}

.settings-custom-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-custom-select-option--probe .settings-custom-select-label {
    flex: 1 1 auto;
}

.settings-custom-select-status {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    max-width: 42%;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--bg-secondary, #f5f6f8);
    color: var(--text-secondary, #64748b);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

.settings-custom-select-status-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-custom-select-status-dot {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.settings-custom-select-status.ready {
    background: color-mix(in srgb, var(--success-color, #38a169) 11%, transparent);
    color: var(--success-color, #38a169);
}

.settings-custom-select-status.failed {
    background: color-mix(in srgb, var(--danger-color, #e53e3e) 10%, transparent);
    color: var(--danger-color, #e53e3e);
}

.settings-custom-select-status.testing {
    background: color-mix(in srgb, var(--accent-color, #0066ff) 10%, transparent);
    color: var(--accent-color, #0066ff);
}

.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 picker: input + custom dropdown */
.model-pick-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}

.model-pick-input {
    flex: 1 1 140px;
    min-width: 0;
    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, box-shadow 0.2s;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.model-pick-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.model-pick-input:hover {
    border-color: rgba(0, 102, 255, 0.45);
}

.model-pick-input.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.model-pick-fetch-link {
    flex: 0 0 auto;
    align-self: center;
    font-size: 0.8125rem;
    color: var(--accent-color);
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    padding: 4px 2px;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.model-pick-fetch-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.model-pick-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.model-pick-dropdown {
    position: relative;
    flex: 0 0 auto;
    min-width: 148px;
    max-width: 220px;
}

.model-pick-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    height: 100%;
    min-height: 42px;
    box-sizing: border-box;
    padding: 0 10px 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    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, background 0.15s ease;
}

.model-pick-trigger-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    font-weight: 500;
}

.model-pick-trigger-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.model-pick-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(0, 102, 255, 0.1);
    color: var(--accent-color);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1;
}

.model-pick-caret {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
    transition: transform 0.2s ease, color 0.15s ease;
}

.model-pick-dropdown.open .model-pick-caret {
    transform: rotate(180deg);
    color: var(--accent-color);
}

.model-pick-trigger:hover:not(:disabled) {
    border-color: rgba(0, 102, 255, 0.45);
    background: var(--bg-primary);
}

.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-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    z-index: 2000;
    min-width: 280px;
    max-width: min(360px, 92vw);
    max-height: 300px;
    overflow: hidden;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.06);
}

.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-menu-header {
    flex: 0 0 auto;
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.model-pick-menu-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.model-pick-menu-list::-webkit-scrollbar {
    width: 6px;
}

.model-pick-menu-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 999px;
}

.model-pick-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.8125rem;
    line-height: 1.3;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.model-pick-option:hover {
    background: var(--bg-secondary);
}

.model-pick-option.is-selected {
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-color);
    font-weight: 600;
}

.model-pick-option-check {
    flex: 0 0 14px;
    width: 14px;
    font-size: 0.75rem;
    line-height: 1;
    color: var(--accent-color);
    opacity: 0;
    text-align: center;
}

.model-pick-option.is-selected .model-pick-option-check {
    opacity: 1;
}

.model-pick-option-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-execute-now-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    cursor: pointer;
}

.batch-execute-now-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* 现代化复选框样式 */
.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;
}

.password-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.tools-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tools-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    overflow: visible;
}

.tools-actions button {
    padding: 8px 16px;
    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;
    flex-shrink: 0;
    white-space: nowrap;
}

.tools-actions button:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.tools-actions input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.search-box {
    display: flex;
    gap: 4px;
    flex: 1;
    min-width: 150px;
    align-items: center;
}

.tools-status-filter {
    display: flex;
    gap: 0;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

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

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    white-space: nowrap;
    margin-right: 8px;
}

.page-size-selector label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-right: 4px;
}

.page-size-selector select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 70px;
    height: 32px;
}

.page-size-selector select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.page-size-selector select:hover {
    border-color: var(--accent-color);
}

.search-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.btn-search {
    padding: 6px 12px;
    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: 40px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn-search:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.tools-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    padding: 8px;
}

.tool-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    transition: background 0.2s;
    cursor: pointer;
}

.tool-item:hover {
    background: var(--bg-tertiary);
}

.tool-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--accent-color);
    flex-shrink: 0;
}

.tool-item > .theme-checkbox {
    --theme-checkbox-size: 18px;
}

.tool-item-info {
    flex: 1;
    min-width: 0;
}

.tool-item-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tool-resident-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2px 8px;
    background: var(--bg-secondary);
    cursor: pointer;
}

.tool-resident-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
}

.tool-resident-toggle .theme-checkbox {
    --theme-checkbox-size: 14px;
    border-radius: 3px;
}

.external-tool-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: rgba(255, 152, 0, 0.12);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ff9800;
    white-space: nowrap;
}

.tool-item-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 展开图标 */
.tool-expand-icon {
    font-size: 0.625rem;
    color: var(--text-tertiary);
    transition: transform 0.2s;
    user-select: none;
    flex-shrink: 0;
}

/* 展开后的详情面板 */
.tool-item-detail {
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.8125rem;
}

.tool-detail-desc {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}

.tool-detail-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* 参数表格 */
.tool-schema-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    table-layout: fixed;
}

.tool-schema-table th {
    text-align: left;
    padding: 6px 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.tool-schema-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: top;
}

/* 参数名、类型、必填列：固定宽度且不换行 */
.tool-schema-table th:nth-child(1),
.tool-schema-table td:nth-child(1) {
    width: 18%;
    min-width: 72px;
    white-space: nowrap;
}

.tool-schema-table th:nth-child(2),
.tool-schema-table td:nth-child(2) {
    width: 12%;
    min-width: 56px;
    white-space: nowrap;
}

.tool-schema-table th:nth-child(3),
.tool-schema-table td:nth-child(3) {
    width: 52px;
    min-width: 52px;
    max-width: 52px;
    white-space: nowrap;
    text-align: center;
}

/* 说明列允许换行 */
.tool-schema-table th:nth-child(4),
.tool-schema-table td:nth-child(4) {
    width: auto;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tool-schema-table code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
    color: var(--accent-color);
}

/* 可点击的外部工具徽章 */
.external-tool-badge.clickable {
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.external-tool-badge.clickable:hover {
    background: rgba(255, 152, 0, 0.25);
    border-color: rgba(255, 152, 0, 0.6);
}

/* 外部 MCP 卡片高亮动画 */
.external-mcp-item.highlight {
    animation: mcpHighlight 2s ease-out;
}

.external-mcp-item.clickable {
    cursor: pointer;
}

.external-mcp-item.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}

.tool-item.highlight {
    animation: mcpHighlight 2s ease-out;
}

.tools-source-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb, 59, 130, 246), 0.12);
    border: 1px solid var(--accent-color);
    color: var(--text-primary);
    font-size: 0.8125rem;
    line-height: 1.2;
}

.tools-source-filter-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 0;
    height: auto;
    padding: 0;
    margin: 0;
    border: none !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.tools-actions .tools-source-filter-clear {
    padding: 0;
    border: none;
    background: transparent;
}

.tools-source-filter-clear:hover,
.tools-actions .tools-source-filter-clear:hover {
    background: transparent !important;
    border: none !important;
    box-shadow: none;
    color: var(--text-primary);
}

@keyframes mcpHighlight {
    0% { box-shadow: 0 0 0 3px var(--accent-color); border-color: var(--accent-color); }
    100% { box-shadow: none; border-color: var(--border-color); }
}

.tool-item.hidden {
    display: none;
}

.tools-list-items {
    max-height: 400px;
    overflow-y: auto;
}

.tools-pagination,
.monitor-pagination,
.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;
}

/* 漏洞管理页面的分页栏间距优化 */
#vulnerability-pagination.pagination-fixed {
    margin-top: 12px;
}

/* Skills管理页面分页优化 */
.page-content-with-pagination {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.skills-list-with-pagination {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    /* 为分页组件预留空间，确保视觉连接自然 */
    padding-bottom: 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-package-tree-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin: 4px 0 8px;
    line-height: 1.45;
}

#skill-view-body {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.skill-tree-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 4px;
    margin-bottom: 1px;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    word-break: break-all;
    line-height: 1.35;
}

.skill-tree-dir {
    color: var(--text-muted);
    cursor: default;
    user-select: none;
    font-weight: 500;
    opacity: 0.88;
}

.skill-tree-dir .skill-tree-icon {
    opacity: 0.65;
}

.skill-tree-file {
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease;
}

.skill-tree-file:hover {
    background: rgba(0, 102, 255, 0.08);
}

.skill-tree-file.is-selected {
    font-weight: 600;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-color);
}

.skill-tree-icon {
    flex-shrink: 0;
    width: 1.15em;
    text-align: center;
    line-height: 1.35;
}

.skill-tree-label {
    min-width: 0;
    flex: 1;
}

.pagination-fixed {
    background: var(--bg-primary);
    margin-top: 0;
    padding: 0;
    /* 确保分页组件宽度与内容区域一致，不包括滚动条 */
    width: 100%;
    box-sizing: border-box;
    /* 确保分页组件不延伸到滚动条区域 */
    overflow: hidden;
    /* 当列表有滚动条时，分页组件应该与内容区域对齐 */
    position: relative;
    /* 添加四个角的圆角，与上方卡片保持一致 */
    border-radius: 8px;
    /* 确保底部左右角都是圆角 */
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    /* 添加边框和阴影，使圆角更明显 */
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pagination-fixed .pagination {
    margin-top: 0;
    border-top: 1px solid var(--border-color);
    padding: 10px 16px;
    background: var(--bg-primary);
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    /* 确保分页内容与列表内容对齐 */
    width: 100%;
    box-sizing: border-box;
    /* 柔和的顶部边框，与列表自然分离 */
    border-top-color: rgba(233, 236, 239, 0.6);
    /* 添加四个角的圆角，与上方卡片保持一致 */
    border-radius: 8px;
    /* 确保底部左右角都是圆角 */
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    /* 移除顶部边框，因为外层容器已有边框 */
    border-top: none;
}

/* 左侧：信息显示和每页数量选择器 - 更自然的设计 */
.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,
.pagination-btn.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 {
    padding: 6px 12px;
    font-size: 0.875rem;
    min-width: 36px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.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-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

/* 通用按钮加载态（用于耗时请求：AI 解析等） */
.btn-loading {
    opacity: 0.9;
    cursor: progress;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-loading::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid rgba(0, 0, 0, 0.18);
    border-top-color: currentColor;
    border-radius: 50%;
    display: inline-block;
    animation: btnSpin 0.8s linear infinite;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

.fofa-nl-status {
    margin-top: 6px;
    font-size: 0.8125rem;
}

.btn-danger {
    padding: 10px 20px;
    background: rgba(220, 53, 69, 0.08);
    color: var(--error-color, #dc3545);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: rgba(220, 53, 69, 0.15);
    border-color: var(--error-color, #dc3545);
    color: #c82333;
}

.monitor-modal-content {
    max-width: 1080px;
    width: 95%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.monitor-modal-body {
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 0 0 16px 16px;
    overflow-y: auto;
}

.monitor-sections {
    display: grid;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.mcp-monitor-page .monitor-sections {
    gap: 16px;
}

/* ── MCP 监控页：页面级布局 ── */
.mcp-monitor-page {
    --mcp-monitor-card-radius: 12px;
}

.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-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.mcp-monitor-page .page-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.monitor-page-subtitle {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.4;
}

.mcp-monitor-page .btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.monitor-section {
    background: var(--bg-primary);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--mcp-monitor-card-radius, 12px);
    padding: 20px 22px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.monitor-section.monitor-overview {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    gap: 0;
}

.monitor-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    flex-wrap: wrap;
}

.monitor-section .section-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    flex-shrink: 0;
    min-width: 0;
}

.monitor-section .section-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    min-width: 0;
    flex-shrink: 1;
}

.monitor-section .section-actions select {
    margin-left: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    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: 140px;
    max-width: 200px;
}

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

.monitor-section .section-actions .monitor-filter-select-ui {
    position: relative;
    display: inline-block;
    margin-left: 6px;
    min-width: 140px;
    max-width: 200px;
    vertical-align: middle;
}

.monitor-filter-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.25;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.monitor-filter-select-trigger:hover:not(:disabled) {
    border-color: var(--accent-color);
}

.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-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.monitor-filter-select-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
}

.monitor-filter-select-ui.open .monitor-filter-select-caret {
    transform: rotate(180deg);
}

.monitor-filter-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.monitor-filter-select-ui.open .monitor-filter-select-dropdown {
    display: block;
}

.monitor-filter-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.monitor-filter-select-option:hover {
    background: var(--bg-secondary);
}

.monitor-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}

.monitor-filter-select-check {
    width: 14px;
    flex-shrink: 0;
    visibility: hidden;
    color: #2563eb;
    font-size: 12px;
    line-height: 1;
}

.monitor-filter-select-option.is-selected .monitor-filter-select-check {
    visibility: visible;
}

.monitor-filter-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.monitor-section .section-actions select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.monitor-section .section-actions select:hover {
    border-color: var(--accent-color);
}

.monitor-section .section-actions input[type="text"] {
    margin-left: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s;
    min-width: 180px;
    max-width: 250px;
}

.monitor-section .section-actions input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.monitor-section .section-actions input[type="text"]:hover {
    border-color: var(--accent-color);
}

.monitor-section .section-actions input#monitor-tool-filter.is-filter-active {
    border-color: rgba(0, 102, 255, 0.45);
    background: rgba(0, 102, 255, 0.04);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.12);
}

.monitor-section .section-actions input[type="text"]::placeholder {
    color: var(--text-muted);
}

/* MCP 执行统计 — 最终布局（metrics bar + panel 表格/饼图） */
.mcp-exec-stats-root {
    width: 100%;
    min-width: 0;
}

.mcp-exec-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

/* ── KPI 概览条 ── */
.mcp-stats-kpi {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: var(--mcp-monitor-card-radius, 12px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

@media (max-width: 768px) {
    .mcp-stats-kpi {
        flex-direction: column;
    }
}

.mcp-stats-kpi__item {
    flex: 1;
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding: 14px 20px;
    min-width: 0;
    position: relative;
}

.mcp-stats-kpi__item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 18%;
    height: 64%;
    width: 1px;
    background: rgba(0, 0, 0, 0.06);
}

@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__accent {
    flex: 0 0 3px;
    border-radius: 3px;
    align-self: stretch;
}

.mcp-stats-kpi__item--calls .mcp-stats-kpi__accent { background: linear-gradient(180deg, #60a5fa, #2563eb); }
.mcp-stats-kpi__item--rate .mcp-stats-kpi__accent  { background: linear-gradient(180deg, #2dd4bf, #0d9488); }
.mcp-stats-kpi__item--time .mcp-stats-kpi__accent  { background: linear-gradient(180deg, #a78bfa, #7c3aed); }

.mcp-stats-kpi__content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.mcp-stats-kpi__label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.mcp-stats-kpi__value {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.mcp-stats-kpi__value--rate.is-success { color: #15803d; }
.mcp-stats-kpi__value--rate.is-warning { color: #ca8a04; }
.mcp-stats-kpi__value--rate.is-danger  { color: #dc2626; }
.mcp-stats-kpi__value--rate.is-muted   { color: var(--text-muted); }

.mcp-stats-kpi__value--time {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.mcp-stats-kpi__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.mcp-stats-kpi__chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mcp-stats-kpi__chip.is-ok {
    color: #166534;
    background: rgba(34, 197, 94, 0.12);
}

.mcp-stats-kpi__chip.is-fail {
    color: #991b1b;
    background: rgba(239, 68, 68, 0.1);
}

.mcp-stats-kpi__chip.is-neutral {
    color: #475569;
    background: rgba(100, 116, 139, 0.12);
}

.mcp-stats-kpi__status {
    font-size: 0.75rem;
    font-weight: 500;
}

.mcp-stats-kpi__status.is-success { color: #15803d; }
.mcp-stats-kpi__status.is-warning { color: #ca8a04; }
.mcp-stats-kpi__status.is-danger  { color: #dc2626; }
.mcp-stats-kpi__status.is-muted   { color: var(--text-muted); }

/* ── 工具统计 + 调用趋势（合并面板） ── */
.mcp-stats-combined {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: var(--mcp-monitor-card-radius, 12px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.mcp-stats-combined__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #fafbfc;
}

.mcp-stats-combined__title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mcp-stats-combined__meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-top: 6px;
}

.mcp-stats-combined__meta {
    margin: 0;
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.mcp-stats-combined__scopes {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mcp-stats-scope-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.mcp-stats-scope-badge--cumulative {
    color: #1e40af;
    background: rgba(59, 130, 246, 0.1);
}

.mcp-stats-scope-badge--timeline {
    color: #0f766e;
    background: rgba(20, 184, 166, 0.12);
}

.mcp-stats-scope-badge--inline {
    margin-right: 6px;
    vertical-align: middle;
}

.mcp-stats-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    max-width: min(280px, 100%);
    padding: 4px 8px 4px 10px;
    border-radius: 999px;
    background: rgba(0, 102, 255, 0.08);
    border: 1px solid rgba(0, 102, 255, 0.22);
}

.mcp-stats-filter-chip__label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcp-stats-filter-chip__clear,
.mcp-stats-filter-chip .mcp-stats-clear-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 18px;
    height: auto;
    margin: 0;
    padding: 0 2px 0 4px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--accent-color);
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.mcp-stats-filter-chip__clear:hover,
.mcp-stats-filter-chip .mcp-stats-clear-filter:hover {
    background: transparent;
    color: #1d4ed8;
    opacity: 0.85;
}

.mcp-stats-combined__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* 左侧工具统计 : 右侧调用趋势 = 1 : 1 */
.mcp-stats-combined__body--full {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-width: 0;
    min-height: 188px;
}

.mcp-stats-combined__body--tools {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-width: 0;
}

.mcp-stats-combined__body--timeline {
    display: block;
}

.mcp-stats-combined__main {
    flex: 1 1 50%;
    max-width: 50%;
    min-width: 0;
    padding: 10px 14px 12px;
}

.mcp-stats-combined__body--full .mcp-stats-combined__timeline {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 50%;
    max-width: 50%;
    min-width: 0;
    padding: 8px 12px 10px;
    background: #fff;
    border-left: 1px solid rgba(0, 0, 0, 0.06);
}

.mcp-stats-combined__body--tools .mcp-stats-tool-table {
    width: 100%;
}

@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 import */
.workflow-package-modal {
    padding: 14px;
    background:
        radial-gradient(circle at 50% 14%, rgba(59, 130, 246, 0.12), transparent 34rem),
        rgba(3, 9, 22, 0.72);
    backdrop-filter: blur(7px);
}

.workflow-package-modal-content {
    width: min(1080px, 100%);
    max-width: 1080px;
    max-height: calc(100vh - 28px);
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--border-color) 72%, var(--accent-color));
    border-radius: 20px;
    background: var(--bg-primary);
    box-shadow: 0 34px 100px rgba(2, 8, 23, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.025) inset;
}

.workflow-package-modal-header {
    align-items: center;
    padding: 18px 24px !important;
    background:
        radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--accent-color) 13%, transparent), transparent 25rem),
        var(--bg-primary) !important;
    box-shadow: none;
}

.workflow-package-modal-header::after {
    left: 24px;
    right: 24px;
}

.workflow-package-title-group,
.workflow-package-title-line {
    display: flex;
    align-items: center;
}

.workflow-package-title-group {
    min-width: 0;
    gap: 14px;
}

.workflow-package-title-icon {
    display: inline-flex;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--accent-color) 28%, transparent);
    border-radius: 13px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--accent-color) 17%, var(--bg-primary)), color-mix(in srgb, #8b5cf6 10%, var(--bg-primary)));
    color: var(--accent-color);
    box-shadow: 0 8px 22px color-mix(in srgb, var(--accent-color) 14%, transparent);
}

.workflow-package-title-icon svg {
    width: 22px;
    height: 22px;
}

.workflow-package-title-line {
    min-width: 0;
    gap: 10px;
}

.workflow-package-modal-header h2 {
    flex: 0 1 auto;
    margin: 0;
    font-size: 1.25rem !important;
    background: none;
    color: var(--text-primary);
    -webkit-text-fill-color: currentColor;
}

.workflow-package-modal-header h2::before {
    display: none;
}

.workflow-package-safe-badge,
.workflow-package-format-pill,
.workflow-package-decision-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--accent-color) 24%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-color) 8%, transparent);
    color: var(--accent-color);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    white-space: nowrap;
}

.workflow-package-safe-badge {
    height: 23px;
    padding: 0 9px;
}

.workflow-package-subtitle,
.workflow-package-file-hint {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.workflow-package-steps {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 9px 28px 10px;
    border-bottom: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-secondary) 68%, var(--bg-primary));
}

.workflow-package-steps::before {
    content: '';
    position: absolute;
    z-index: 0;
    top: 24px;
    left: 25%;
    right: 25%;
    height: 1px;
    background: var(--border-color);
    pointer-events: none;
}

.workflow-package-steps > span {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-secondary);
    text-align: center;
}

.workflow-package-steps > span > span {
    display: flex;
    min-width: 0;
    align-items: baseline;
    justify-content: center;
    gap: 7px;
    white-space: nowrap;
}

.workflow-package-steps strong {
    color: inherit;
    font-size: 13px;
    font-weight: 700;
}

.workflow-package-steps small {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
}

.workflow-package-steps small::before {
    content: '·';
    margin-right: 7px;
    color: var(--text-muted);
}

.workflow-package-steps b {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-primary);
    font-size: 12px;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--bg-secondary) 68%, var(--bg-primary));
}

.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-steps .is-complete b {
    border-color: color-mix(in srgb, var(--success-color) 65%, transparent);
    background: color-mix(in srgb, var(--success-color) 13%, var(--bg-primary));
    color: var(--success-color);
}

.workflow-package-steps .is-complete b {
    font-size: 0;
}

.workflow-package-steps .is-complete b::before {
    content: '✓';
    font-size: 13px;
    font-weight: 800;
}

.workflow-package-modal-body {
    display: grid;
    grid-template-columns: minmax(0, 1.16fr) minmax(330px, .84fr);
    align-items: stretch;
    gap: 16px;
    padding: 16px 24px 18px;
    background:
        linear-gradient(110deg, color-mix(in srgb, var(--accent-color) 2%, transparent), transparent 48%),
        color-mix(in srgb, var(--bg-secondary) 52%, var(--bg-primary));
}

.workflow-package-pane {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    box-shadow: 0 10px 30px rgba(2, 8, 23, 0.045);
}

.workflow-package-pane h3 {
    margin: 2px 0 0;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.35;
}

.workflow-package-pane-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.workflow-package-eyebrow {
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.workflow-package-format-pill,
.workflow-package-decision-status {
    height: 24px;
    padding: 0 9px;
    color: var(--text-secondary);
    border-color: var(--border-color);
    background: var(--bg-secondary);
    font-size: 9px;
}

.workflow-package-decision-status::before {
    content: '';
    width: 5px;
    height: 5px;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--text-muted);
}

.workflow-package-decision-status.is-ready {
    border-color: color-mix(in srgb, var(--success-color) 30%, transparent);
    background: color-mix(in srgb, var(--success-color) 9%, transparent);
    color: var(--success-color);
}

.workflow-package-decision-status.is-ready::before {
    background: var(--success-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success-color) 12%, transparent);
}

.workflow-package-pane--resolution {
    align-self: stretch;
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, #8b5cf6 5%, transparent), transparent 16rem),
        var(--bg-primary);
}

.workflow-package-pane--resolution .workflow-package-resolution {
    margin-top: 0;
}

.workflow-package-dropzone {
    display: flex;
    min-height: 116px;
    box-sizing: border-box;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border: 1.5px dashed color-mix(in srgb, var(--border-color) 64%, var(--accent-color));
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent-color) 3%, var(--bg-secondary));
    cursor: pointer;
    outline: none;
    transition: border-color 150ms ease, background-color 150ms ease;
}

.workflow-package-dropzone:hover,
.workflow-package-dropzone.is-dragging {
    border-color: color-mix(in srgb, var(--accent-color) 72%, var(--border-color));
    background: color-mix(in srgb, var(--accent-color) 5%, var(--bg-secondary));
}

.workflow-package-dropzone:focus-visible {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 18%, transparent);
}

.workflow-package-upload-icon {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--accent-color) 18%, transparent);
    border-radius: 11px;
    background: color-mix(in srgb, var(--accent-color) 11%, var(--bg-primary));
    color: var(--accent-color);
}

.workflow-package-upload-icon svg {
    width: 20px;
    height: 20px;
}

.workflow-package-dropzone-copy {
    display: grid;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
}

.workflow-package-dropzone-copy strong {
    color: var(--text-primary);
    font-size: 15px;
}

.workflow-package-browse {
    color: var(--accent-color);
    font-weight: 600;
}

.workflow-package-selected-file {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-top: 9px;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--accent-color) 18%, var(--border-color));
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent-color) 3%, var(--bg-secondary));
}

.workflow-package-selected-file[hidden] {
    display: none;
}

.workflow-package-file-badge {
    display: inline-flex;
    height: 30px;
    padding: 0 8px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: color-mix(in srgb, var(--accent-color) 14%, var(--bg-primary));
    color: var(--accent-color);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
}

.workflow-package-file-details {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.workflow-package-file-name {
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    color: var(--text-primary);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-package-file-details small {
    color: var(--text-secondary);
    font-size: 11px;
}

.workflow-package-file-remove {
    display: inline-flex;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.workflow-package-file-remove:hover,
.workflow-package-file-remove:focus-visible {
    background: color-mix(in srgb, var(--text-secondary) 10%, transparent);
    color: var(--text-primary);
}

.workflow-package-file-hint {
    margin-top: 4px;
    padding-left: 14px;
    text-align: center;
}

.workflow-package-file-hint::before {
    content: 'i';
    display: inline-flex;
    width: 13px;
    height: 13px;
    margin: 0 5px 0 -14px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--text-muted);
    border-radius: 50%;
    font-size: 8px;
    font-style: normal;
    font-weight: 800;
    vertical-align: 1px;
}

.workflow-package-inspect-btn {
    width: 100%;
    margin-top: 9px;
    min-height: 36px;
    border-radius: 9px;
    background: var(--accent-color);
    font-weight: 700;
    box-shadow: none;
}

.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-inspect-btn.is-loading::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: -2px;
    animation: workflow-package-spin .7s linear infinite;
}

@keyframes workflow-package-spin {
    to { transform: rotate(360deg); }
}

.workflow-package-summary,
.workflow-package-resolution {
    display: grid;
    gap: 8px;
    margin-top: 11px;
}

.workflow-package-summary:empty,
.workflow-package-resolution:empty {
    display: none;
}

.workflow-package-summary-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 2px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
}

.workflow-package-summary-heading b {
    color: var(--success-color);
    font-size: 10px;
    font-weight: 700;
}

.workflow-package-summary-heading b::before {
    content: '✓';
    margin-right: 4px;
}

.workflow-package-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--border-color);
}

.workflow-package-summary-row {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    padding: 7px 10px;
    border: 0;
    background: var(--bg-secondary);
    font-size: 11px;
}

.workflow-package-summary-row span {
    color: var(--text-secondary);
}

.workflow-package-summary-row code {
    overflow: hidden;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-package-status {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 9px;
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.45;
}

.workflow-package-status-icon {
    position: relative;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    border-radius: 50%;
    background: rgba(59, 130, 246, .18);
}

.workflow-package-status-icon::after {
    content: 'i';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #60a5fa;
    font-size: 9px;
    font-weight: 800;
}

.workflow-package-status.is-warning {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.1);
}

.workflow-package-status.is-warning .workflow-package-status-icon {
    background: rgba(245, 158, 11, .18);
}

.workflow-package-status.is-warning .workflow-package-status-icon::after {
    content: '!';
    color: var(--warning-color);
}

.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-resolution-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 66px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--success-color) 34%, transparent);
    border-radius: 11px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--success-color) 11%, transparent), color-mix(in srgb, var(--success-color) 4%, transparent));
}

.workflow-package-resolution-icon {
    display: inline-flex;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--success-color) 16%, var(--bg-primary));
    color: var(--success-color);
    font-size: 15px;
    font-weight: 800;
}

.workflow-package-resolution-hero strong,
.workflow-package-resolution-hero small {
    display: block;
}

.workflow-package-resolution-hero strong {
    margin-bottom: 3px;
    color: var(--text-primary);
    font-size: 13px;
}

.workflow-package-resolution-hero small {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.5;
}

.workflow-package-choice,
.workflow-package-reveal {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    cursor: pointer;
}

.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-choice input,
.workflow-package-confirm-check input {
    margin-top: 3px;
}

.workflow-package-choice strong,
.workflow-package-choice small {
    display: block;
}

.workflow-package-choice small {
    margin-top: 4px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.workflow-package-reveal {
    width: 100%;
    justify-content: center;
    border-style: dashed;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    text-align: center;
}

.workflow-package-rename-field {
    display: grid;
    gap: 7px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 650;
}

.workflow-package-rename-field input {
    width: 100%;
    height: 38px;
    box-sizing: border-box;
    padding: 0 11px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    outline: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    transition: border-color 150ms ease, background-color 150ms ease;
}

.workflow-package-rename-field input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.workflow-package-rename-field input:hover {
    border-color: color-mix(in srgb, var(--accent-color) 35%, var(--border-color));
}

.workflow-package-rename-field input:focus {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 3%, var(--bg-secondary));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 12%, transparent);
}

.workflow-package-confirm-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

.workflow-package-overwrite-content {
    width: min(480px, calc(100vw - 32px));
    margin: 18vh auto auto;
}

.workflow-package-modal-footer {
    align-items: center;
    justify-content: space-between;
    padding: 11px 24px;
    background: color-mix(in srgb, var(--bg-secondary) 45%, var(--bg-primary));
}

.workflow-package-footer-note,
.workflow-package-footer-actions {
    display: flex;
    align-items: center;
}

.workflow-package-footer-note {
    gap: 7px;
    color: var(--text-secondary);
    font-size: 11px;
}

.workflow-package-footer-note > span:first-child {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--success-color) 12%, transparent);
    color: var(--success-color);
    font-size: 10px;
    font-weight: 800;
}

.workflow-package-footer-actions {
    gap: 10px;
}

.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-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-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-toolbar {
    position: static;
    flex: 0 0 auto;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    box-shadow: none;
}

.rbac-assignment-toolbar-main {
    display: grid;
    grid-template-columns: minmax(140px, 180px) minmax(280px, 1fr);
    align-items: end;
    gap: 10px;
}

.rbac-assignment-field--search {
    flex: 1;
    min-width: 0;
}

.rbac-assignment-controls {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.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,
#rbac-user-modal .settings-custom-select,
#rbac-role-modal .settings-custom-select {
    width: 100%;
    min-width: 0;
}

.platform-rbac-page .settings-custom-select-menu,
#rbac-user-modal .settings-custom-select-menu,
#rbac-role-modal .settings-custom-select-menu {
    z-index: 3200;
}

.platform-rbac-page .settings-custom-select-trigger,
#rbac-user-modal .settings-custom-select-trigger,
#rbac-role-modal .settings-custom-select-trigger,
.rbac-assignment-field .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),
#rbac-user-modal .settings-custom-select-trigger:hover:not(:disabled),
#rbac-role-modal .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-assignment-filters--placeholder {
    display: none;
}

.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 {
    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-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-selection-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.06);
}

.rbac-resource-selection-actions {
    display: flex;
    gap: 8px;
}

.rbac-assignment-resource-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

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

.rbac-assignment-resource-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.rbac-assignment-resource-meta code {
    font-size: 0.6875rem;
}

.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-combined__col-label {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.mcp-stats-combined__timeline-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

/* 左侧工具统计：堆叠条 + 排行列表 */
.mcp-stats-tools-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.mcp-stats-tools-panel__hero {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mcp-stats-proportion-bar {
    display: flex;
    align-items: stretch;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.2);
}

.mcp-stats-proportion-seg {
    min-width: 3px;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

.mcp-stats-proportion-seg.is-others {
    cursor: default;
}

.mcp-stats-proportion-seg.is-highlighted,
.mcp-stats-proportion-seg.is-active {
    filter: brightness(1.08);
    z-index: 1;
}

.mcp-stats-proportion-seg.is-dimmed {
    opacity: 0.35;
}

.mcp-stats-proportion-seg:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.5);
    outline-offset: 1px;
}

.mcp-stats-tools-panel__caption {
    margin: 0;
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.35;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.mcp-stats-timeline__sparse-hint {
    margin: 0;
    padding: 0 2px;
    font-size: 0.625rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.mcp-stats-tools-panel__list-head {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 0 10px 4px;
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mcp-stats-tools-panel__list-head > span:nth-child(1) {
    flex: 0 0 26px;
    text-align: center;
}

.mcp-stats-tools-panel__list-head > span:nth-child(2) {
    flex: 0 0 10px;
}

.mcp-stats-tools-panel__list-head > span:nth-child(3) {
    flex: 1 1 auto;
    min-width: 0;
}

.mcp-stats-tools-panel__list-head .mcp-stats-tool-item__metrics-head {
    margin-left: auto;
}

.mcp-stats-tools-panel__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mcp-stats-tool-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease;
    font-size: 0.8125rem;
}

.mcp-stats-tool-item__rank {
    flex: 0 0 26px;
}

.mcp-stats-tool-item__dot {
    flex: 0 0 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mcp-stats-tool-item__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mcp-stats-tool-item__metrics {
    margin-left: auto;
}

.mcp-stats-tool-item__metrics,
.mcp-stats-tool-item__metrics-head {
    display: grid;
    grid-template-columns: 3.5rem 3rem 4.75rem;
    column-gap: 1.375rem;
    row-gap: 3px;
    align-items: center;
    justify-items: end;
    flex: 0 0 auto;
    padding: 4px 8px 4px 20px;
    border-left: 1px solid rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

.mcp-stats-tool-item__metrics-head {
    border-left: none;
    padding-left: 18px;
    line-height: 1.2;
}

.mcp-stats-tool-item__metrics-head > span {
    text-align: right;
}

.mcp-stats-tool-item:hover,
.mcp-stats-tool-item.is-highlighted {
    background: rgba(0, 102, 255, 0.05);
}

.mcp-stats-tool-item.is-active {
    background: rgba(0, 102, 255, 0.09);
}

.mcp-stats-tool-item.is-dimmed {
    opacity: 0.42;
}

.mcp-stats-tool-item:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.45);
    outline-offset: -2px;
}

.mcp-stats-tool-item__name {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}

.mcp-stats-tool-item__share {
    font-size: 0.75rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    line-height: 1.2;
}

.mcp-stats-tool-item__track {
    display: block;
    width: min(100%, 240px);
    max-width: 100%;
    height: 4px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.mcp-stats-tool-item__fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    min-width: 2px;
    transition: width 0.2s ease;
}

.mcp-stats-tool-item__calls {
    font-size: 0.875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1.25;
    min-width: 2ch;
}

.mcp-stats-tool-item__rate {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    line-height: 1.25;
    min-width: 3.5rem;
}

.mcp-stats-tool-item__rate.is-success { color: #15803d; }
.mcp-stats-tool-item__rate.is-warning { color: #ca8a04; }
.mcp-stats-tool-item__rate.is-danger  { color: #dc2626; }

.mcp-stats-tool-item__fail {
    display: block;
    font-size: 0.625rem;
    font-weight: 500;
    color: #b91c1c;
    line-height: 1.2;
}

.mcp-stats-tool-item .mcp-stats-rank {
    width: 22px;
    height: 22px;
    font-size: 0.6875rem;
}

.mcp-stats-combined .mcp-stats-timeline__legend {
    margin-top: 4px;
    gap: 8px;
}

/* ── 调用趋势折线图（内嵌于合并面板） ── */
.mcp-stats-timeline__inline-meta {
    margin: 0;
    font-size: 0.625rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.mcp-stats-timeline__ranges {
    display: inline-flex;
    gap: 4px;
    padding: 2px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
}

.mcp-stats-timeline__range {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    line-height: 1.2;
}

.mcp-stats-timeline__range:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.7);
}

.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__chart-wrap {
    flex: 1;
    min-height: 120px;
    min-width: 0;
    width: 100%;
    padding: 2px 0;
}

.mcp-stats-combined__timeline .mcp-stats-timeline__chart-wrap {
    flex: 1;
    min-height: 100px;
    height: auto;
}

.mcp-stats-timeline__chart {
    width: 100%;
    height: 100%;
    display: block;
}

.mcp-stats-combined__timeline .mcp-stats-timeline__chart {
    min-height: 100px;
    height: 100%;
}

.mcp-stats-timeline__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
    padding: 0 4px;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.mcp-stats-timeline__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mcp-stats-timeline__legend-item::before {
    content: '';
    width: 16px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.mcp-stats-timeline__legend-item--fail::before {
    background: transparent;
    border-top: 2px dashed #ef4444;
    height: 0;
    width: 14px;
}

.mcp-stats-timeline-line {
    fill: none;
    stroke: #3b82f6;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.mcp-stats-timeline-area {
    stroke: none;
}

.mcp-stats-timeline-line--fail {
    stroke: #f87171;
    stroke-width: 1.75;
    stroke-dasharray: 5 4;
    opacity: 0.9;
    filter: none;
}

.mcp-stats-timeline-grid {
    stroke: rgba(148, 163, 184, 0.35);
    stroke-width: 1;
    stroke-dasharray: 3 4;
}

.mcp-stats-timeline-grid--base {
    stroke: rgba(148, 163, 184, 0.55);
    stroke-dasharray: none;
}

.mcp-stats-timeline-axis {
    font-size: 9px;
    fill: var(--text-muted);
}

.mcp-stats-timeline-y {
    font-size: 9px;
    fill: var(--text-muted);
    text-anchor: end;
}

.mcp-stats-timeline-peak-glow {
    fill: rgba(59, 130, 246, 0.08);
    stroke: none;
    pointer-events: none;
}

.mcp-stats-timeline-dot {
    fill: #3b82f6;
    stroke: none;
    cursor: crosshair;
    opacity: 0;
    transition: opacity 0.12s ease, r 0.12s ease;
}

.mcp-stats-timeline-dot--peak {
    opacity: 0.85;
}

.mcp-stats-timeline__chart-wrap:hover .mcp-stats-timeline-dot,
.mcp-stats-timeline-dot.is-active {
    opacity: 1;
}

.mcp-stats-timeline-dot.is-active {
    fill: #1d4ed8;
}

.mcp-stats-timeline-error {
    margin: 0;
    padding: 16px 8px;
    text-align: center;
    font-size: 0.75rem;
    color: #b91c1c;
}

.mcp-stats-timeline-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    min-height: 88px;
    padding: 20px 16px;
    text-align: center;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.06);
    border: 1px dashed rgba(148, 163, 184, 0.28);
}

.mcp-stats-timeline-empty-state--compact {
    min-height: 72px;
    padding: 14px 10px;
    gap: 4px;
}

.mcp-stats-timeline-empty-state__icon {
    color: rgba(148, 163, 184, 0.75);
    flex-shrink: 0;
}

.mcp-stats-timeline-empty-state--compact .mcp-stats-timeline-empty-state__icon {
    width: 28px;
    height: 28px;
}

.mcp-stats-timeline-empty-state__title {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.4;
}

.mcp-stats-timeline-empty-state--compact .mcp-stats-timeline-empty-state__title {
    font-size: 0.75rem;
}

.mcp-stats-timeline-empty-state__hint {
    margin: 0;
    max-width: 28em;
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.mcp-stats-timeline-empty-state--compact .mcp-stats-timeline-empty-state__hint {
    font-size: 0.625rem;
    max-width: 100%;
}

.mcp-stats-timeline-tooltip {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    padding: 6px 10px;
    font-size: 0.75rem;
    line-height: 1.35;
    color: #fff;
    background: rgba(15, 23, 42, 0.92);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    transform: translate(-50%, -100%);
    margin-top: -8px;
    display: none;
}

/* MCP 监控统计重构：工具卡 + 柱线趋势 */

.mcp-stats-combined__head {
    padding: 14px 18px;
}

.mcp-stats-combined__body--full {
    min-height: 248px;
}

.mcp-stats-combined__main {
    padding: 14px 16px 18px;
}

.mcp-stats-combined__body--full .mcp-stats-combined__timeline {
    gap: 8px;
    padding: 14px 16px 18px;
}

.mcp-stats-tools-panel {
    gap: 12px;
}

.mcp-stats-proportion-bar {
    height: 12px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.mcp-stats-tools-panel__caption {
    gap: 6px;
}

.mcp-stats-tools-panel__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.mcp-stats-tool-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-width: 0;
    min-height: 132px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.96));
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.mcp-stats-tool-item:hover,
.mcp-stats-tool-item.is-highlighted {
    background:
        linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.98));
    border-color: rgba(59, 130, 246, 0.26);
}

.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__top,
.mcp-stats-tool-item__middle,
.mcp-stats-tool-item__bottom {
    display: flex;
    align-items: center;
    min-width: 0;
}

.mcp-stats-tool-item__top {
    gap: 8px;
}

.mcp-stats-tool-item__rank {
    flex: 0 0 auto;
}

.mcp-stats-tool-item__name {
    font-size: 0.8125rem;
}

.mcp-stats-tool-item__share {
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.05);
}

.mcp-stats-tool-item__middle {
    gap: 8px;
}

.mcp-stats-tool-item__calls {
    font-size: 1.45rem;
    line-height: 1;
}

.mcp-stats-tool-item__calls-label {
    flex: 0 0 auto;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.mcp-stats-tool-item__track {
    flex: 1 1 auto;
    width: auto;
    height: 6px;
    background: rgba(15, 23, 42, 0.07);
}

.mcp-stats-tool-item__bottom {
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}

.mcp-stats-tool-item__pill {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(148, 163, 184, 0.13);
}

.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-tool-item__rate {
    margin-left: auto;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.mcp-stats-tool-item__fail {
    font-size: 0.625rem;
}

.mcp-stats-timeline-moments {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 2px 0 0;
}

.mcp-stats-timeline-moments__label {
    flex: 0 0 auto;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
}

.mcp-stats-timeline-moments__list {
    display: flex;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: wrap;
    padding: 1px 1px 3px;
}

.mcp-stats-timeline-moment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    min-width: 0;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.08);
    color: #1d4ed8;
    font-size: 0.6875rem;
    font-weight: 600;
    flex: 0 0 auto;
    box-sizing: border-box;
    overflow: hidden;
}

.mcp-stats-timeline-moment__time {
    min-width: 0;
    max-width: 10rem;
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcp-stats-timeline-moment__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    color: #fff;
    background: #2563eb;
    box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.04);
    flex: 0 0 auto;
}

.mcp-stats-timeline-moment__fail {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.12);
    font-size: 0.625rem;
    font-weight: 700;
    white-space: nowrap;
    flex: 0 0 auto;
}

.mcp-stats-timeline-moment--more {
    min-width: 42px;
    color: var(--text-secondary);
    background: rgba(148, 163, 184, 0.14);
    font-weight: 700;
    flex: 0 0 auto;
    justify-content: center;
}

.mcp-stats-timeline__chart-wrap {
    min-height: 146px;
    padding: 4px 0 0;
}

.mcp-stats-combined__timeline .mcp-stats-timeline__chart-wrap,
.mcp-stats-combined__timeline .mcp-stats-timeline__chart {
    min-height: 132px;
}

.mcp-stats-timeline-bar {
    fill: rgba(59, 130, 246, 0.14);
    cursor: crosshair;
    transition: fill 0.12s ease, opacity 0.12s ease;
}

.mcp-stats-timeline-bar.is-active {
    fill: rgba(59, 130, 246, 0.42);
}

.mcp-stats-timeline-bar.is-hover {
    fill: rgba(37, 99, 235, 0.68);
}

.mcp-stats-timeline-bar-fail {
    fill: rgba(239, 68, 68, 0.72);
    cursor: crosshair;
}

.mcp-stats-timeline-bar-fail.is-hover {
    fill: rgba(220, 38, 38, 0.9);
}

.mcp-stats-timeline-area {
    opacity: 0.55;
}

.mcp-stats-timeline-line {
    stroke-width: 2;
}

.mcp-stats-timeline-dot {
    opacity: 0;
}

@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 {
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
    border-color: #263244;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

html[data-theme="dark"] .mcp-stats-tool-item:hover,
html[data-theme="dark"] .mcp-stats-tool-item.is-highlighted {
    background: linear-gradient(180deg, #172033 0%, #111827 100%);
    border-color: rgba(96, 165, 250, 0.36);
}

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__share,
html[data-theme="dark"] .mcp-stats-tool-item__track {
    background: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .mcp-stats-tool-item__pill {
    background: rgba(148, 163, 184, 0.14);
}

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,
html[data-theme="dark"] .mcp-stats-timeline-moment__fail {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.14);
}

html[data-theme="dark"] .mcp-stats-timeline-moment {
    color: #93c5fd;
    background: rgba(96, 165, 250, 0.14);
}

html[data-theme="dark"] .mcp-stats-timeline-moment--more {
    color: var(--text-secondary);
    background: rgba(148, 163, 184, 0.14);
}

html[data-theme="dark"] .mcp-stats-timeline-bar {
    fill: rgba(96, 165, 250, 0.16);
}

html[data-theme="dark"] .mcp-stats-timeline-bar.is-active {
    fill: rgba(96, 165, 250, 0.46);
}

html[data-theme="dark"] .mcp-stats-timeline-bar.is-hover {
    fill: rgba(96, 165, 250, 0.78);
}

/* ── 工具统计面板：表格 + 饼图 ── */
.mcp-stats-panel {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: var(--mcp-monitor-card-radius, 12px);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.mcp-stats-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #fafbfc;
}

.mcp-stats-panel__title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mcp-stats-panel__meta {
    margin: 2px 0 0;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.mcp-stats-panel__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 272px;
    align-items: stretch;
}

@media (max-width: 900px) {
    .mcp-stats-panel__body {
        grid-template-columns: 1fr;
    }
}

.mcp-stats-panel__table-wrap {
    min-width: 0;
    overflow-x: auto;
}

.mcp-stats-tool-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.mcp-stats-tool-table thead {
    background: #f8fafc;
}

.mcp-stats-tool-table th {
    padding: 8px 14px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

.mcp-stats-tool-table td {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    vertical-align: middle;
}

.mcp-stats-tool-table tbody tr:last-child td {
    border-bottom: none;
}

.mcp-stats-tool-table .col-rank {
    width: 44px;
    text-align: center;
}

.mcp-stats-tool-table .col-tool {
    min-width: 140px;
    max-width: 360px;
}

.mcp-stats-tool-table .col-num,
.mcp-stats-tool-table .col-share {
    width: 64px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mcp-stats-tool-table .col-num {
    font-weight: 600;
    color: var(--text-primary);
}

.mcp-stats-tool-table .col-share {
    color: var(--text-secondary);
    font-weight: 500;
}

.mcp-stats-tool-table .col-rate {
    width: 108px;
    text-align: right;
    white-space: nowrap;
}

.mcp-stats-tool-table th.col-num,
.mcp-stats-tool-table th.col-share,
.mcp-stats-tool-table th.col-rate {
    text-align: right;
}

.mcp-stats-tool-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.mcp-stats-tool-label {
    vertical-align: middle;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    font-weight: 500;
}

.mcp-stats-tool-table .col-tool {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcp-stats-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
}

.mcp-stats-rank.rank-1 { background: rgba(234, 179, 8, 0.18); color: #a16207; }
.mcp-stats-rank.rank-2 { background: rgba(148, 163, 184, 0.22); color: #64748b; }
.mcp-stats-rank.rank-3 { background: rgba(180, 83, 9, 0.12); color: #b45309; }

.mcp-stats-rate { font-weight: 600; font-variant-numeric: tabular-nums; }
.mcp-stats-rate.is-success { color: #15803d; }
.mcp-stats-rate.is-warning { color: #ca8a04; }
.mcp-stats-rate.is-danger  { color: #dc2626; }

.mcp-stats-fail-note {
    margin-left: 6px;
    font-size: 0.6875rem;
    color: #b91c1c;
    font-weight: 500;
}

tr.mcp-stats-tool-row[data-tool-name] {
    cursor: pointer;
    transition: background 0.12s ease;
}

tr.mcp-stats-tool-row[data-tool-name]:hover,
tr.mcp-stats-tool-row[data-tool-name].is-highlighted {
    background: rgba(0, 102, 255, 0.04);
}

tr.mcp-stats-tool-row[data-tool-name].is-active {
    background: rgba(0, 102, 255, 0.07);
}

tr.mcp-stats-tool-row[data-tool-name].is-dimmed {
    opacity: 0.4;
}

tr.mcp-stats-tool-row[data-tool-name]:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.45);
    outline-offset: -2px;
}

/* 饼图侧栏 */
.mcp-stats-panel__aside {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-left: 1px solid rgba(0, 0, 0, 0.06);
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

@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-panel--compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 220px;
    padding: 0;
}

.mcp-stats-panel__aside-title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

.mcp-stats-panel__chart {
    position: relative;
    width: 100%;
    max-width: 196px;
    aspect-ratio: 1;
}

.mcp-stats-panel__aside-hint {
    margin: 0;
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.35;
}

.mcp-stats-dist-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.mcp-stats-dist-segment {
    cursor: pointer;
    transition: opacity 0.15s ease, filter 0.15s ease;
    outline: none;
}

.mcp-stats-dist-segment.is-others { cursor: default; }
.mcp-stats-dist-segment.is-dimmed { opacity: 0.35; }
.mcp-stats-dist-segment.is-highlighted,
.mcp-stats-dist-segment.is-active { filter: brightness(1.06); }

.mcp-stats-dist-segment:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.45);
    outline-offset: 1px;
}

.mcp-stats-dist-donut-hole {
    position: absolute;
    inset: 27%;
    border-radius: 50%;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
    pointer-events: none;
}

.mcp-stats-dist-donut-label {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: center;
}

.mcp-stats-dist-donut-label:not(.is-default) {
    text-transform: none;
    font-size: 0.5rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcp-stats-dist-donut-value {
    display: flex;
    align-items: baseline;
    gap: 1px;
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.mcp-stats-dist-donut-unit {
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.mcp-stats-clear-filter {
    padding: 5px 12px;
    font-size: 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(0, 102, 255, 0.25);
    background: #fff;
    color: var(--accent-color);
    cursor: pointer;
    font-weight: 500;
    font: inherit;
    flex-shrink: 0;
}

.mcp-stats-clear-filter:hover {
    background: rgba(0, 102, 255, 0.06);
}

@media (prefers-reduced-motion: reduce) {
    tr.mcp-stats-tool-row[data-tool-name],
    .mcp-stats-dist-segment {
        transition: none;
    }
}

/* 兼容 Skills 监控等复用 monitor-stats-grid 的页面 */
.monitor-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.monitor-stat-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 102, 255, 0.12);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow-xs);
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.monitor-stat-card h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-word;
    max-width: 100%;
}

.monitor-stat-value {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: break-word;
}

.monitor-stat-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-word;
    max-width: 100%;
}

.monitor-table-container {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
}

.mcp-monitor-page .monitor-executions {
    padding: 14px 16px;
}

.mcp-monitor-page .monitor-section.monitor-executions:has(.monitor-filter-select-ui.open) {
    overflow: visible;
    z-index: 5;
}

.mcp-monitor-page .monitor-executions .section-header {
    margin-bottom: 10px;
}

.mcp-monitor-page .monitor-table th,
.mcp-monitor-page .monitor-table td {
    padding: 8px 12px;
}

.mcp-monitor-page .monitor-table-container {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--mcp-monitor-card-radius, 12px);
    box-shadow: none;
}

.mcp-monitor-page .monitor-table thead {
    background: rgba(0, 0, 0, 0.02);
}

.mcp-monitor-page .monitor-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.mcp-monitor-page .monitor-empty__title {
    margin: 0 0 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.mcp-monitor-page .monitor-empty__hint {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.monitor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    table-layout: auto;
    min-width: 100%;
}

.monitor-table th,
.monitor-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    word-break: break-word;
    overflow-wrap: break-word;
}

.monitor-table th {
    white-space: nowrap;
}

.monitor-table td {
    white-space: nowrap;
}

.monitor-table td:nth-child(2) {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.monitor-table thead {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
}

.monitor-table tbody tr:hover {
    background: rgba(0, 102, 255, 0.08);
}

.monitor-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.monitor-status-chip.completed {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
}

.monitor-status-chip.running {
    background: rgba(0, 102, 255, 0.12);
    color: var(--accent-color);
}

.monitor-status-chip.queued {
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
}

.monitor-status-chip.failed {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error-color);
}

.monitor-status-chip.hard_timeout {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.monitor-status-chip.cancelled {
    background: rgba(108, 117, 125, 0.15);
    color: var(--text-muted, #6c757d);
}

.monitor-status-chip.orphaned {
    background: rgba(100, 116, 139, 0.14);
    color: #64748b;
}

.monitor-execution-actions .btn-monitor-abort {
    border-color: rgba(253, 126, 20, 0.55);
    color: #fd7e14;
}

.monitor-execution-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.monitor-execution-actions button {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.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-batch-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 16px;
    gap: 16px;
}

.monitor-batch-actions .batch-actions-info {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.monitor-batch-actions .batch-actions-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.monitor-batch-actions .batch-actions-buttons button {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.monitor-execution-checkbox {
    --theme-checkbox-size: 18px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
    margin: 0;
    vertical-align: middle;
    display: inline-block;
}

/* 确保复选框单元格垂直居中 */
.monitor-table td:first-child,
.monitor-table th:first-child {
    text-align: center;
    vertical-align: middle;
}

/* 统一表头复选框大小 */
#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-vuln-container {
    display: grid;
    gap: 16px;
}

.monitor-vuln-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.vuln-counter {
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 102, 255, 0.12);
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vuln-counter strong {
    font-size: 1.4rem;
    color: var(--text-primary);
}

.vuln-counter span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.vuln-list {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.vuln-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vuln-item:last-child {
    border-bottom: none;
}

.vuln-title {
    font-weight: 600;
    color: var(--text-primary);
}

.vuln-severity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.vuln-severity.critical {
    background: rgba(108, 0, 150, 0.15);
    color: #bf00ff;
}

.vuln-severity.high {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error-color);
}

.vuln-severity.medium {
    background: rgba(255, 193, 7, 0.15);
    color: #b8860b;
}

.vuln-severity.low {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
}

.monitor-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.monitor-error {
    text-align: center;
    padding: 24px 16px;
    color: var(--error-color);
    font-size: 0.9rem;
    background: rgba(220, 53, 69, 0.08);
    border-radius: 12px;
}

/* 外部MCP配置样式 */
.external-mcp-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.external-mcp-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.external-mcp-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.external-mcp-stats span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    white-space: nowrap;
}

.external-mcp-stats span strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-left: 4px;
}

.external-mcp-stats span:not(:last-child)::after {
    content: '';
}

.tools-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    flex-wrap: nowrap;
    flex-shrink: 1;
    white-space: nowrap;
    min-width: 0;
}

.tools-stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.tools-stats span strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-left: 4px;
}

.tools-stats span:not(:last-child)::after {
    content: '';
    width: 1px;
    height: 16px;
    background: var(--border-color);
    margin-left: 8px;
    display: inline-block;
}

.external-mcp-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.external-mcp-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.external-mcp-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.external-mcp-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.external-mcp-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.external-mcp-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.external-mcp-item-info h4 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tool-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(0, 102, 255, 0.1);
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-left: 8px;
    white-space: nowrap;
}

.external-mcp-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.external-mcp-status.status-connected {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.external-mcp-status.status-connected::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.external-mcp-status.status-disconnected {
    background: rgba(108, 117, 125, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(108, 117, 125, 0.3);
}

.external-mcp-status.status-connecting {
    background: rgba(0, 123, 255, 0.12);
    color: var(--accent-color);
    border: 1px solid rgba(0, 123, 255, 0.3);
}

.external-mcp-status.status-connecting::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    display: inline-block;
    animation: pulse 1.5s infinite;
}

.external-mcp-status.status-disabled {
    background: rgba(255, 193, 7, 0.12);
    color: #b8860b;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.external-mcp-status.status-error {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error-color);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.external-mcp-status.status-error::before {
    content: '❌';
    display: inline-block;
    margin-right: 4px;
}

.external-mcp-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* btn-sm 与 btn-small 等价（C2 / WebShell 等模块使用 btn-sm 别名） */
.btn-small,
.btn-sm {
    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-danger.btn-sm,
.btn-ghost.btn-small,
.btn-ghost.btn-sm {
    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 .settings-custom-select-trigger {
    padding: 8px 11px;
}

.rbac-assignment-toolbar-main .btn-primary.btn-small {
    padding: 0 14px;
    line-height: 1.25;
}

.btn-small:hover,
.btn-sm: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-sm.btn-danger,
.btn-danger.btn-small,
.btn-danger.btn-sm {
    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-sm.btn-danger:hover,
.btn-danger.btn-small:hover,
.btn-danger.btn-sm:hover {
    background: rgba(220, 53, 69, 0.15);
    border-color: var(--error-color);
    color: #c82333;
}

.external-mcp-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, auto));
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.external-mcp-item-details > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.external-mcp-item-details > div:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.external-mcp-item-details strong {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.external-mcp-item-details span {
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.5;
}

.external-mcp-list .empty {
    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;
}

.external-mcp-list .error {
    text-align: center;
    padding: 24px;
    color: var(--error-color);
    background: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 12px;
    font-size: 0.875rem;
}

.error-message {
    display: block;
    padding: 8px 12px;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 6px;
    color: var(--error-color);
    font-size: 0.875rem;
    line-height: 1.5;
}

.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-modal-content {
    max-width: 95vw;
    width: 95vw;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    overflow: hidden;
    box-shadow:
        0 32px 96px rgba(15, 23, 42, 0.28),
        0 8px 24px rgba(15, 23, 42, 0.1),
        0 0 0 1px rgba(15, 23, 42, 0.06);
    background: #ffffff;
}

.attack-chain-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 0;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
        radial-gradient(1000px 500px at 100% 110%, rgba(14, 165, 233, 0.05) 0%, transparent 60%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.attack-chain-main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    gap: 0;
}

.attack-chain-visualization-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

.attack-chain-sidebar {
    width: 300px;
    flex-shrink: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: saturate(1.1) blur(6px);
    -webkit-backdrop-filter: saturate(1.1) blur(6px);
    border-left: 1px solid rgba(15, 23, 42, 0.07);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.attack-chain-sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
}

.attack-chain-sidebar-content::-webkit-scrollbar {
    width: 6px;
}
.attack-chain-sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}
.attack-chain-sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.15);
    border-radius: 3px;
}
.attack-chain-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.3);
}

.attack-chain-toolbar {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.92) 100%);
    backdrop-filter: saturate(1.1) blur(6px);
    -webkit-backdrop-filter: saturate(1.1) blur(6px);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.attack-chain-info {
    font-size: 0.8125rem;
    color: #1e293b;
    font-weight: 600;
    padding: 7px 14px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(99, 102, 241, 0.08) 100%);
    border: 1px solid rgba(59, 130, 246, 0.22);
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

.attack-chain-info::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background:
        linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
}

.attack-chain-legend {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px 16px 20px;
    background: transparent;
    flex-shrink: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #334155;
    padding: 5px 8px;
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.legend-item:hover {
    background: rgba(99, 102, 241, 0.06);
    transform: translateX(2px);
}

.legend-color {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    border: 1.5px solid rgba(255, 255, 255, 0.95);
    box-shadow:
        0 2px 6px rgba(15, 23, 42, 0.18),
        inset 0 1px 2px rgba(255, 255, 255, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    position: relative;
}

.legend-color::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, transparent 60%);
    pointer-events: none;
}

.legend-item:hover .legend-color {
    transform: scale(1.12);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.legend-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 12px 12px 14px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.legend-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 14px;
    border-radius: 2px;
    background: linear-gradient(180deg, #3b82f6 0%, #6366f1 100%);
}

.legend-line {
    display: inline-block;
    width: 34px;
    height: 0;
    margin-right: 0;
    vertical-align: middle;
    border-radius: 2px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.legend-item:hover .legend-line {
    transform: scaleX(1.2);
}

.attack-chain-container {
    flex: 1;
    min-height: 0;
    background:
        linear-gradient(180deg, #fbfcfe 0%, #f6f8fc 100%);
    border: 1px solid rgba(15, 23, 42, 0.06);
    position: relative;
    overflow: hidden;
    margin: 14px 14px 14px 14px;
    border-radius: 14px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.attack-chain-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at center, rgba(15, 23, 42, 0.07) 1px, transparent 1.5px);
    background-size: 22px 22px;
    background-position: 0 0;
    opacity: 0.55;
    pointer-events: none;
    z-index: 0;
    border-radius: 14px;
    mask-image: radial-gradient(ellipse at center, black 60%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 60%, transparent 100%);
}

.attack-chain-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(800px 400px at 15% 12%, rgba(59, 130, 246, 0.06) 0%, transparent 70%),
        radial-gradient(700px 360px at 85% 88%, rgba(168, 85, 247, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    border-radius: 14px;
}

/* 攻击链筛选器样式 */
.attack-chain-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.attack-chain-filters input[type="text"] {
    padding: 7px 14px 7px 34px;
    border: 1.5px solid rgba(15, 23, 42, 0.1);
    border-radius: 10px;
    font-size: 0.8125rem;
    min-width: 200px;
    flex: 1;
    max-width: 320px;
    background:
        #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 10px center;
    color: #0f172a;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.attack-chain-filters input[type="text"]:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), 0 2px 6px rgba(99, 102, 241, 0.12);
}

.attack-chain-filters input[type="text"]:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.attack-chain-filters input[type="text"]::placeholder {
    color: #94a3b8;
}

.attack-chain-filters select {
    padding: 7px 34px 7px 14px;
    border: 1.5px solid rgba(15, 23, 42, 0.1);
    border-radius: 10px;
    font-size: 0.8125rem;
    background: #ffffff;
    color: #0f172a;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    font-weight: 500;
    min-width: 130px;
}

.attack-chain-filters select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), 0 2px 6px rgba(99, 102, 241, 0.12);
}

.attack-chain-filters select:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
}

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

.attack-chain-action-btn {
    padding: 9px 16px !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08) !important;
    letter-spacing: 0.2px;
}

.attack-chain-action-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14) !important;
}

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

.attack-chain-details {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    margin: 4px 16px 16px;
    padding: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 14px;
    box-shadow:
        0 4px 14px rgba(15, 23, 42, 0.06),
        0 1px 2px rgba(15, 23, 42, 0.03);
    transition: opacity 0.2s ease;
    overflow: hidden;
    will-change: opacity;
    position: relative;
}

/* ========== 节点详情独占态：点击节点后详情占满 sidebar，图例隐藏 ========== */
/* 激活态：隐藏图例的两个辅助 section（风险等级、连线含义），保留详情 */
.attack-chain-sidebar.details-active
    .attack-chain-legend > .legend-section:not(.attack-chain-details) {
    display: none !important;
}

/* 激活态：让 legend 容器成为可撑满的 flex 列，详情占满剩余空间 */
.attack-chain-sidebar.details-active .attack-chain-legend {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    gap: 0;
    display: flex;
}

/* 激活态：详情面板填满 sidebar 全高 */
.attack-chain-sidebar.details-active .attack-chain-details {
    flex: 1 1 auto;
    min-height: 0;
    margin: 14px 14px 16px;
    border-radius: 14px;
}

/* 激活态：详情内容区占满剩余空间可滚动 */
.attack-chain-sidebar.details-active .attack-chain-details-content {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
}

.attack-chain-details::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6 0%, #6366f1 50%, #a855f7 100%);
    border-radius: 14px 14px 0 0;
}

.attack-chain-details[style*="display: none"] {
    display: none !important;
}

@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-details-title {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0 !important;
    padding-bottom: 10px !important;
    border-bottom: 1px dashed rgba(15, 23, 42, 0.1) !important;
}

.attack-chain-details-title span {
    flex: 1;
}

.attack-chain-details-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
}

.attack-chain-details-content::-webkit-scrollbar {
    width: 6px;
}

.attack-chain-details-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.attack-chain-details-content::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.15);
    border-radius: 3px;
}

.attack-chain-details-content::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.3);
}

.node-detail-item {
    margin-bottom: 0;
    font-size: 0.8125rem;
    line-height: 1.65;
    padding: 10px 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    color: #1e293b;
}

.node-detail-item:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.08);
    transform: translateY(-1px);
}

.node-detail-item strong {
    display: block;
    margin-bottom: 6px;
    color: #64748b;
    font-weight: 700;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.node-detail-item code {
    background: rgba(99, 102, 241, 0.08);
    color: #4338ca;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.8rem;
    word-break: break-all;
    display: inline-block;
    max-width: 100%;
    font-family: 'SFMono-Regular', 'Monaco', 'Menlo', 'Consolas', monospace;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.node-detail-item pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    overflow-x: auto;
    margin: 8px 0 0 0;
    line-height: 1.6;
    max-width: 100%;
    font-family: 'SFMono-Regular', 'Monaco', 'Menlo', 'Consolas', monospace;
    border: 1px solid rgba(15, 23, 42, 0.2);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

.node-detail-item ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.node-detail-item li {
    margin-bottom: 6px;
    line-height: 1.5;
}

.node-detail-item li:last-child {
    margin-bottom: 0;
}

.node-detail-item div[style*="background"],
.node-detail-ai-analysis {
    margin-top: 8px;
    padding: 10px 12px !important;
    border-radius: 6px;
    line-height: 1.6;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.node-detail-item ul {
    margin: 8px 0;
    padding-left: 20px;
}

.node-detail-item li {
    margin-bottom: 4px;
}

.node-detail-item strong {
    color: var(--text-primary);
    margin-right: 8px;
}

.node-detail-item code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
}

.metadata-pre {
    background: var(--bg-tertiary);
    padding: 8px;
    border-radius: 4px;
    font-size: 0.8125rem;
    overflow-x: auto;
    margin-top: 4px;
}

.modal-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.attack-chain-action-btn {
    padding: 8px 16px !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
    border: 1.5px solid transparent !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    letter-spacing: 0.2px;
    position: relative;
    overflow: hidden;
}

.attack-chain-action-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    pointer-events: none;
}

.attack-chain-action-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12) !important;
}

.attack-chain-action-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1) !important;
}

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

.empty-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    font-size: 0.9375rem;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ef4444;
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 20px;
    position: relative;
    z-index: 2;
}

/* ==================== 知识管理样式 ==================== */

.knowledge-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.knowledge-stats-bar {
    display: flex;
    gap: 24px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.05) 0%, rgba(0, 102, 255, 0.02) 100%);
    border: 1px solid rgba(0, 102, 255, 0.15);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.knowledge-stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.knowledge-stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.knowledge-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-color);
}

/* 索引进度显示 */
.knowledge-index-progress {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 193, 7, 0.05) 100%);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.knowledge-index-progress-complete {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(40, 167, 69, 0.05) 100%);
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
}

.knowledge-index-progress .progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.knowledge-index-progress .progress-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.knowledge-index-progress .progress-text {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

.knowledge-index-progress-complete .progress-icon {
    font-size: 1.25rem;
}

.knowledge-index-progress-complete .progress-text {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffc107 0%, #ff9800 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    animation: progress-pulse 2s ease-in-out infinite;
}

@keyframes progress-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.progress-hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.knowledge-filters {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.knowledge-filters label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.knowledge-filters select {
    padding: 8px 12px;
    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: 160px;
}

.knowledge-filters select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.knowledge-filters .knowledge-search-field {
    flex: 1;
    min-width: 200px;
}

.knowledge-filters .knowledge-search-field .search-box {
    width: 100%;
    flex: none;
    align-items: stretch;
}

.knowledge-filters .custom-select-trigger,
.knowledge-filters .search-box input,
.knowledge-filters .search-box .btn-search {
    height: 38px;
    min-height: 38px;
    box-sizing: border-box;
}

.knowledge-filters .search-box .btn-search {
    padding: 0 12px;
    flex-shrink: 0;
}

/* 自定义下拉组件样式 */
.custom-select-wrapper {
    position: relative;
    min-width: 160px;
}

.custom-select {
    position: relative;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    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: 160px;
}

.custom-select-trigger:hover {
    border-color: var(--accent-color);
}

.custom-select-trigger svg {
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: 8px;
}

.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-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
}

.custom-select.open .custom-select-dropdown {
    display: block;
}

.custom-select-option {
    padding: 10px 12px;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.15s;
    border-bottom: 1px solid var(--border-color);
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover {
    background: var(--bg-secondary);
}

.custom-select-option.selected {
    background: var(--accent-color);
    color: white;
}

.custom-select-option.selected:hover {
    background: var(--accent-hover);
}

/* 自定义下拉组件滚动条样式 */
.custom-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.knowledge-items-list {
    min-height: 200px;
}

.knowledge-categories-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.knowledge-category-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.knowledge-category-section:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(0, 102, 255, 0.2);
}

.knowledge-category-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.knowledge-category-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.knowledge-category-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.knowledge-category-title::before {
    content: '📁';
    font-size: 1.1rem;
}

.knowledge-category-count {
    padding: 4px 12px;
    background: rgba(0, 102, 255, 0.1);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent-color);
}

.knowledge-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.knowledge-item-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.knowledge-item-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-color);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.knowledge-item-card:hover {
    background: var(--bg-primary);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.knowledge-item-card:hover::before {
    opacity: 1;
}

.knowledge-item-card-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.knowledge-item-card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.knowledge-item-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.knowledge-item-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.knowledge-item-card:hover .knowledge-item-card-actions {
    opacity: 1;
}

.knowledge-item-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.knowledge-item-action-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: scale(1.05);
}

.knowledge-item-delete-btn:hover {
    background: rgba(220, 53, 69, 0.1);
    border-color: var(--error-color);
    color: var(--error-color);
}

.knowledge-item-action-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.knowledge-item-path {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.knowledge-item-card-content {
    flex: 1;
    min-height: 60px;
}

.knowledge-item-preview {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.knowledge-item-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.knowledge-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.knowledge-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.knowledge-item-badge-new {
    padding: 2px 6px;
    background: rgba(40, 167, 69, 0.15);
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--success-color);
    white-space: nowrap;
}

.knowledge-item-updated {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

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

/* ==================== 检索历史样式 ==================== */

.retrieval-logs-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.retrieval-stats-bar {
    display: flex;
    gap: 24px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.05) 0%, rgba(0, 102, 255, 0.02) 100%);
    border: 1px solid rgba(0, 102, 255, 0.15);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.retrieval-stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.retrieval-stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.retrieval-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-color);
}

.retrieval-stat-value.text-success {
    color: var(--success-color);
}

.retrieval-logs-filters {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.retrieval-logs-filters label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    min-width: 200px;
}

.retrieval-logs-filters input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.retrieval-logs-filters input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.retrieval-logs-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.retrieval-log-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.retrieval-log-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--border-color);
    transition: all 0.2s ease;
}

.retrieval-log-card.has-results::before {
    background: var(--success-color);
}

.retrieval-log-card.no-results::before {
    background: var(--warning-color);
}

.retrieval-log-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.retrieval-log-card-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.retrieval-log-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.retrieval-log-main-info {
    flex: 1;
    min-width: 0;
}

.retrieval-log-query {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.5;
    word-break: break-word;
}

.retrieval-log-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.retrieval-log-time {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.retrieval-log-risk-type {
    font-size: 0.8125rem;
    padding: 4px 10px;
    background: rgba(0, 102, 255, 0.1);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 12px;
    color: var(--accent-color);
    font-weight: 500;
}

.retrieval-log-result-badge {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.retrieval-log-result-badge.success {
    background: rgba(40, 167, 69, 0.15);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: var(--success-color);
}

.retrieval-log-result-badge.empty {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #b8860b;
}

.retrieval-log-card-body {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.retrieval-log-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.retrieval-log-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-all;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.detail-value.text-success {
    color: var(--success-color);
}

.detail-value.text-muted {
    color: var(--text-muted);
}

.retrieval-log-items-preview {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.retrieval-log-items-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.retrieval-log-items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.retrieval-log-item-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(0, 102, 255, 0.1);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent-color);
}

.retrieval-log-item-tag.more {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* 响应式设计 */
@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);
    }
}

/* 最近对话样式 */
.recent-conversations-section {
    margin-bottom: 24px;
    min-width: 0;
}

.recent-conversations-section:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 8px;
    min-width: 0;
    gap: 8px;
}

.section-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.conversation-sort-dropdown {
    position: relative;
}

.conversation-sort-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.conversation-sort-btn:hover,
.conversation-sort-btn[aria-expanded="true"] {
    background: var(--bg-tertiary);
    color: var(--accent-color);
}

.conversation-sort-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 200;
    min-width: 156px;
    padding: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.conversation-sort-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 8px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    cursor: pointer;
    border-radius: 6px;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
}

.conversation-sort-option:hover {
    background: var(--bg-tertiary);
}

.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-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.conversation-sort-option:hover .conversation-sort-option-icon {
    color: var(--text-secondary);
}

.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-label {
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

.conversation-sort-option-check {
    flex-shrink: 0;
    width: 14px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-color);
    opacity: 0;
    text-align: center;
}

.conversation-sort-option.is-selected .conversation-sort-option-check {
    opacity: 1;
}

.section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recent-conversations-section .section-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-conversations-section .section-title.section-title--filtered {
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.add-group-btn,
.batch-manage-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.add-group-btn:hover,
.batch-manage-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent-color);
}

.add-group-btn svg,
.batch-manage-btn svg {
    width: 16px;
    height: 16px;
}

.conversation-item {
    position: relative;
}

.conversation-item-pinned {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    color: var(--accent-color);
}

.conversation-item-menu {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
}

.conversation-item:hover .conversation-item-menu {
    opacity: 1;
}

.conversation-item-menu:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    opacity: 1;
}

/* 批量管理模态框 */
.batch-manage-modal-content {
    max-width: 1040px;
    width: 92vw;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.batch-manage-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.batch-manage-header-actions .conversation-project-filter-ui {
    width: 132px;
    min-width: 100px;
    flex-shrink: 0;
}

.batch-manage-header-actions .conversation-project-filter-trigger {
    font-size: 0.8125rem;
    padding: 8px 10px;
}

.batch-manage-modal-content .conversation-project-filter-ui.open {
    z-index: 400;
}

.batch-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.batch-search-box input {
    padding: 8px 32px 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;
}

.batch-search-box svg {
    position: absolute;
    right: 8px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.batch-manage-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.batch-conversations-table {
    display: flex;
    flex-direction: column;
}

.batch-table-header {
    display: grid;
    grid-template-columns: 40px minmax(0, 1.4fr) minmax(0, 0.85fr) 160px 72px;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.batch-conversations-list {
    display: flex;
    flex-direction: column;
}

.batch-conversation-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1.4fr) minmax(0, 0.85fr) 160px 72px;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: background 0.2s ease;
}

.batch-conversation-row:hover {
    background: var(--bg-tertiary);
}

.batch-table-col-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
}

.batch-table-col-name {
    font-size: 0.875rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
    word-break: keep-all;
    /* 完全依赖JavaScript截断，禁用CSS的ellipsis以避免在UTF-8多字节字符中间截断 */
}

.batch-table-col-project {
    font-size: 0.8125rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-table-col-project.is-unbound {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.85;
}

.batch-table-col-time {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.batch-table-col-action {
    display: flex;
    align-items: center;
    justify-content: center;
}

.batch-delete-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.batch-delete-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.batch-delete-btn:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--error-color);
}

.batch-delete-btn:hover svg {
    transform: scale(1.08);
}

.batch-delete-btn:active {
    background: rgba(220, 53, 69, 0.2);
    transform: scale(0.95);
}

.batch-manage-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.batch-table-col-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.batch-table-col-checkbox .theme-checkbox {
    --theme-checkbox-size: 16px;
}

.batch-footer-actions {
    display: flex;
    gap: 12px;
}

/* 上下文菜单 */
.context-menu {
    position: fixed;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 180px;
    padding: 4px;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
}

.context-menu-item:hover {
    background: var(--bg-tertiary);
    color: var(--accent-color);
}

.context-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.context-menu-item-has-submenu {
    justify-content: space-between;
}

.context-menu-item-has-submenu .submenu-arrow {
    width: 12px;
    height: 12px;
    margin-left: auto;
}

.context-menu-item-danger {
    color: var(--error-color);
}

.context-menu-item-danger:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--error-color);
}

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.context-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    max-width: 240px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
    z-index: 10001;
}

.context-submenu[style*="right: 100%"] {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 4px;
}

.context-submenu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.context-submenu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.context-submenu-item:hover {
    background: var(--bg-tertiary);
    color: var(--accent-color);
}

/* 任务管理页面样式 */
.tasks-stats-bar {
    display: flex;
    gap: 24px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.05) 0%, rgba(0, 102, 255, 0.02) 100%);
    border: 1px solid rgba(0, 102, 255, 0.15);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tasks-controls {
    margin-bottom: 24px;
}

.tasks-filters {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    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: column;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.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: 100%;
    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);
}

.tasks-batch-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0, 102, 255, 0.05);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 8px;
    margin-top: 12px;
}

.tasks-batch-actions span {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.auto-refresh-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.auto-refresh-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.show-history-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    margin-left: auto;
}

.show-history-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.tasks-history-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
}

.tasks-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.tasks-history-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.task-item-history {
    opacity: 0.85;
}

.task-item-history:hover {
    opacity: 1;
}

.task-history-badge {
    font-size: 0.875rem;
    margin-left: 4px;
    opacity: 0.7;
}

.task-stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.task-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-color);
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tasks-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.tasks-empty p {
    font-size: 1rem;
    margin-bottom: 16px;
}

.task-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.task-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.task-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px;
}

.task-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.task-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.task-checkbox-placeholder {
    width: 18px;
    height: 18px;
}

.task-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
}

.task-status-running {
    background: rgba(0, 123, 255, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(0, 123, 255, 0.3);
}

.task-status-cancelling {
    background: rgba(255, 193, 7, 0.1);
    color: #b8860b;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.task-status-completed {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.task-status-failed,
.task-status-timeout {
    background: rgba(220, 53, 69, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.task-status-cancelled {
    background: rgba(108, 117, 125, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(108, 117, 125, 0.3);
}

.task-status-unknown {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.task-message {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.task-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.task-time {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.task-duration {
    font-size: 0.8125rem;
    color: var(--accent-color);
    font-weight: 500;
    white-space: nowrap;
    padding: 4px 8px;
    background: rgba(0, 102, 255, 0.1);
    border-radius: 4px;
}

.task-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
}

.task-id-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.task-id-value {
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    word-break: break-all;
    cursor: pointer;
    transition: all 0.2s;
}

.task-id-value:hover {
    background: var(--bg-tertiary);
    color: var(--accent-color);
}

@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-section {
    margin-top: 0;
    padding-top: 0;
    /* 确保底部左右角都是圆角 */
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    overflow: hidden;
}

/* 列表 + 底部分页同一外框，与 MCP 监控「表格 + 分页」一致 */
.batch-queues-board {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-primary);
}

.batch-queues-board .batch-queues-list {
    margin-bottom: 0;
    padding: 14px 16px;
    box-sizing: border-box;
    /* 与卡片底色区分，flex gap 才能被看见，避免「白贴白」连成一片 */
    background: var(--bg-secondary);
}

.batch-queues-board #batch-queues-pagination {
    margin-top: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    width: 100%;
    box-sizing: border-box;
}

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

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

.batch-queues-filters.tasks-filters.batch-queues-filters--compact .tasks-filter-select-ui {
    position: relative;
    min-width: 120px;
}

.tasks-filter-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 6px 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.25;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tasks-filter-select-trigger:hover:not(:disabled) {
    border-color: var(--accent-color);
}

.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-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.tasks-filter-select-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
}

.tasks-filter-select-ui.open .tasks-filter-select-caret {
    transform: rotate(180deg);
}

.tasks-filter-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.tasks-filter-select-ui.open .tasks-filter-select-dropdown {
    display: block;
}

.tasks-filter-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.tasks-filter-select-option:hover {
    background: var(--bg-secondary);
}

.tasks-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}

.tasks-filter-select-check {
    width: 14px;
    flex-shrink: 0;
    visibility: hidden;
    color: #2563eb;
    font-size: 12px;
    line-height: 1;
}

.tasks-filter-select-option.is-selected .tasks-filter-select-check {
    visibility: visible;
}

.tasks-filter-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.batch-queues-filters__search {
    flex: 1 1 220px;
    min-width: 0;
    max-width: none;
}

.batch-queues-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
}

.batch-queues-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.batch-queues-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 28px;
}

.batch-queue-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 11px 16px 12px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.batch-queue-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-color: var(--accent-color);
}

.batch-queue-item--cron-wait {
    border-left: 3px solid var(--accent-color);
}

.batch-queue-item--cron-wait:hover {
    border-color: var(--accent-color);
}

.batch-queue-item__inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

/* 任务管理 · 队列卡片：单行主网格 + 进度列内统计，降低高度 */
.batch-queue-item__inner--grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(128px, auto) minmax(88px, 14%) minmax(40px, max-content);
    grid-template-rows: auto;
    grid-template-areas: "lead cluster progress actions";
    column-gap: 22px;
    align-items: center;
    gap: 0;
}

.batch-queue-item__lead {
    grid-area: lead;
    min-width: 0;
}

.batch-queue-item__title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.batch-queue-item__role-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    border-radius: 9px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.batch-queue-item__titles {
    flex: 1;
    min-width: 0;
}

.batch-queue-item__inner--grid .batch-queue-card-title {
    font-size: 0.9375rem;
    line-height: 1.3;
}

.batch-queue-item__cluster {
    grid-area: cluster;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    text-align: right;
    max-width: min(100%, 360px);
    justify-self: end;
}

/* 状态徽章与百分比同一行，用 gap 明确分隔（避免视觉上「贴住」） */
.batch-queue-item__status-inline {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px 20px;
    max-width: 100%;
    min-width: 0;
}

.batch-queue-item__progress-col {
    grid-area: progress;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    align-self: center;
}

.batch-queue-item__actions-col {
    grid-area: actions;
    justify-self: end;
    align-self: center;
    padding-left: 6px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.batch-queue-item__idline--lead {
    display: block;
    margin: 4px 0 0;
    font-size: 0.6875rem;
    color: var(--text-muted, var(--text-secondary));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.batch-queue-item__idline--lead code {
    font-size: 0.65rem;
}

.batch-queue-item__inner--grid .batch-queue-item__config {
    margin-top: 3px;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.batch-queue-item__inner--grid .batch-queue-item__sublabel {
    font-size: 0.75rem;
    color: var(--text-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-queue-item__inner--grid .batch-queue-item__pct {
    flex: 0 0 auto;
    text-align: right;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
    white-space: nowrap;
}

.batch-queue-progress-bar--card-row {
    height: 6px;
}

.batch-queue-item--no-actions .batch-queue-item__inner--grid {
    grid-template-columns: minmax(0, 1fr) minmax(128px, auto) minmax(88px, 16%);
    grid-template-areas: "lead cluster progress";
}

.batch-queue-item--no-actions .batch-queue-item__actions-col {
    display: none;
}

.batch-queue-item__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px 14px;
}

.batch-queue-item__top-actions {
    flex-shrink: 0;
    margin-top: 1px;
}

.batch-queue-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.batch-queue-icon-btn:hover {
    color: var(--accent-color, #0066ff);
    border-color: rgba(0, 102, 255, 0.35);
    background: rgba(0, 102, 255, 0.08);
}

.batch-queue-icon-btn--danger:hover {
    color: var(--error-color, #dc3545);
    border-color: rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.06);
}

.batch-queue-icon-btn__svg {
    display: block;
}

.batch-queue-item__band {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 12px 14px;
    margin: 0;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.batch-queue-item__band-left {
    flex: 1 1 220px;
    min-width: 0;
}

.batch-queue-item__band-right {
    flex: 1 1 200px;
    min-width: 160px;
    max-width: 100%;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

.batch-queue-progress-meta--band {
    align-items: stretch;
    text-align: right;
}

.batch-queue-progress-meta--band .batch-queue-progress-note {
    text-align: right;
    max-width: none;
}

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

.batch-queue-card-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px 20px;
    margin-bottom: 12px;
}

.batch-queue-primary {
    flex: 1 1 280px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.batch-queue-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    letter-spacing: -0.015em;
}

.batch-queue-card-title--muted {
    color: var(--text-secondary);
    font-weight: 500;
}

.batch-queue-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.batch-queue-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    max-width: 100%;
}

.batch-queue-chip-emoji {
    font-size: 0.875rem;
    line-height: 1;
    flex-shrink: 0;
}

.batch-queue-chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.batch-queue-chip--role .batch-queue-chip-text {
    max-width: 160px;
}

.batch-queue-chip--schedule {
    color: var(--accent-color);
    border-color: var(--border-color);
    background: var(--bg-primary);
    box-shadow: inset 2px 0 0 0 var(--accent-color);
}

.batch-queue-chip--warn {
    color: #b45309;
    border-color: rgba(180, 83, 9, 0.35);
    background: rgba(251, 191, 36, 0.12);
}

.batch-queue-status-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.batch-queue-next-run {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-color);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.batch-queue-next-run__icon {
    font-size: 1rem;
    line-height: 1;
    opacity: 0.88;
}

.batch-queue-next-run__text {
    line-height: 1.35;
}

.batch-queue-footnotes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.batch-queue-footnotes__id code {
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    word-break: break-all;
    color: var(--text-secondary);
}

.batch-queue-footnotes__sep {
    opacity: 0.45;
    user-select: none;
}

.batch-queue-side {
    flex: 0 1 232px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.batch-queue-delete-btn {
    font-size: 0.75rem !important;
    padding: 5px 12px !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
    background: var(--bg-primary) !important;
}

.batch-queue-delete-btn:hover {
    color: var(--error-color, #dc3545) !important;
    border-color: rgba(220, 53, 69, 0.4) !important;
    background: rgba(220, 53, 69, 0.06) !important;
}

.batch-queue-progress-stack {
    width: 100%;
    min-width: 200px;
}

.batch-queue-progress-bar.batch-queue-progress-bar--card {
    height: 10px;
    border-radius: 999px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.batch-queue-progress-fill--cron-wait {
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover), var(--accent-color));
    background-size: 200% 100%;
    animation: batch-queue-progress-shimmer 2.4s ease infinite;
}

@keyframes batch-queue-progress-shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

.batch-queue-progress-stack .batch-queue-progress-meta {
    width: 100%;
    align-items: flex-end;
}

.batch-queue-progress-fraction {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.8125rem;
}

.batch-queue-stats--pills {
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    gap: 8px;
}

.batch-queue-stat-pill {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
}

.batch-queue-stat-pill__k {
    color: var(--text-secondary);
    font-weight: 500;
}

.batch-queue-stat-pill__v {
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.batch-queue-stat-pill--ok .batch-queue-stat-pill__v {
    color: var(--success-color);
}

.batch-queue-stat-pill--err .batch-queue-stat-pill__v {
    color: var(--error-color);
}

.batch-queue-stat-pill--muted .batch-queue-stat-pill__v {
    color: var(--text-secondary);
}

.batch-queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.batch-queue-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    flex-wrap: wrap;
}

.batch-queue-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
}

.batch-queue-status-pending {
    background: rgba(108, 117, 125, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(108, 117, 125, 0.3);
}

.batch-queue-status-running {
    background: rgba(0, 123, 255, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(0, 123, 255, 0.3);
}

.batch-queue-cron-active {
    box-shadow: 0 0 0 1px rgba(0, 123, 255, 0.15);
}

.batch-queue-status-paused {
    background: rgba(255, 193, 7, 0.12);
    color: #b38600;
    border: 1px solid rgba(255, 193, 7, 0.45);
}

.batch-queue-status-completed {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

/* Cron 队列：本轮跑完、等待下次触发（区别于「一次性任务已完成」） */
.batch-queue-status-cron-cycle {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px dashed var(--accent-color);
}

.batch-queue-status-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    max-width: 100%;
}

.batch-queue-cron-sublabel {
    font-size: 0.75rem;
    color: var(--accent-color);
    font-weight: 500;
    line-height: 1.35;
    max-width: 280px;
}

.batch-queue-cron-sublabel.detail {
    margin-top: 6px;
    max-width: none;
}

.batch-queue-detail-status-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.batch-queue-progress-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 0;
}

.batch-queue-progress-note {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.35;
    text-align: right;
    max-width: 240px;
}

.batch-queue-progress-note.detail {
    text-align: left;
    max-width: none;
    margin-top: 2px;
    opacity: 0.95;
}

.batch-queue-cron-callout {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    margin-bottom: 8px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-color);
    background: var(--bg-secondary);
}

.batch-queue-cron-callout-icon {
    font-size: 1.25rem;
    line-height: 1.2;
    flex-shrink: 0;
    opacity: 0.9;
}

.batch-queue-cron-callout p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.batch-queue-status-cancelled {
    background: rgba(108, 117, 125, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(108, 117, 125, 0.3);
}

.batch-queue-id {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.batch-queue-time {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.batch-queue-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.batch-queue-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.batch-queue-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    transition: width 0.3s ease;
}

.batch-queue-progress-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
}

.batch-queue-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.batch-queue-stats span {
    white-space: nowrap;
}

/* 批量队列详情：信息分层（状态 → 摘要 → 告警 → 折叠技术信息） */
.batch-queue-detail-layout {
    margin-bottom: 20px;
}

.batch-queue-detail-hero {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.batch-queue-detail-hero__sub {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.45;
}

.batch-queue-detail-hero__note {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.batch-queue-detail-kv {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 12px 32px;
    margin-bottom: 18px;
}

.bq-kv {
    display: grid;
    grid-template-columns: minmax(88px, 112px) 1fr;
    gap: 10px 16px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.bq-kv--block {
    grid-column: 1 / -1;
    grid-template-columns: minmax(100px, 28%) 1fr;
}

.bq-kv:last-child {
    border-bottom: none;
}

.bq-kv__k {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.8125rem;
}

.bq-kv__v {
    color: var(--text-primary);
    word-break: break-word;
}

.bq-kv__v code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

.bq-kv__v--control {
    min-width: 0;
}

/* Inline editable value — hover hint */
.bq-inline-editable {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 6px;
    margin: -2px -6px;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.bq-inline-editable:hover {
    background: var(--bg-secondary);
}
.bq-inline-editable::after {
    content: '\270E';
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.bq-inline-editable:hover::after {
    opacity: 0.5;
}

/* Inline edit controls (replaces value in-place) */
.bq-inline-edit-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
}
.bq-inline-edit-controls input[type="text"],
.bq-inline-edit-controls select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1.5px solid var(--accent-color);
    font-size: 0.875rem;
    outline: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.bq-inline-edit-controls input[type="text"] {
    flex: 1;
    min-width: 200px;
}

.bq-inline-edit-controls .bq-edit-cron-expr {
    flex: 1 1 280px;
    min-width: 240px;
    max-width: 100%;
}
.bq-inline-edit-controls input[type="text"]:focus,
.bq-inline-edit-controls select:focus {
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.15);
}
/* Task inline edit textarea */
.batch-task-inline-edit {
    flex: 1;
    min-width: 0;
}
.batch-task-inline-edit textarea {
    width: 100%;
    min-height: 56px;
    padding: 8px 10px;
    border: 1.5px solid var(--accent-color);
    border-radius: 6px;
    font-size: 0.875rem;
    resize: vertical;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.batch-task-inline-edit textarea:focus {
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.15);
}
@media (max-width: 720px) {
    .batch-queue-detail-kv {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

@media (max-width: 520px) {
    .bq-kv,
    .bq-kv--block {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

.bq-cron-toggle {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    margin: 0;
}

.bq-cron-toggle input {
    margin-top: 3px;
    flex-shrink: 0;
}

.bq-cron-toggle__hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.bq-alert {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.8125rem;
}

.bq-alert--err {
    background: rgba(220, 53, 69, 0.07);
    border: 1px solid rgba(220, 53, 69, 0.28);
    color: var(--text-primary);
}

.bq-alert--err strong {
    display: block;
    color: var(--error-color);
    font-size: 0.8125rem;
    margin-bottom: 4px;
}

.bq-alert--err p {
    margin: 0;
    color: var(--text-primary);
    word-break: break-word;
}

.batch-queue-detail-tech {
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    padding: 0 12px;
}

.batch-queue-detail-tech__sum {
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 10px 0;
    list-style: none;
}

.batch-queue-detail-tech__sum::-webkit-details-marker {
    display: none;
}

.batch-queue-detail-tech__body {
    padding: 4px 0 12px;
    border-top: 1px solid var(--border-color);
}

.batch-queue-detail-tech__body .bq-kv:first-child {
    padding-top: 10px;
}

.batch-queue-cron-callout--compact {
    margin-bottom: 12px;
    padding: 10px 12px;
}

.batch-queue-cron-callout--compact p {
    font-size: 0.8125rem;
}

/* 列表卡片紧凑布局 */
.batch-queue-item__config {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.batch-queue-item__idline {
    margin: 6px 0 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
}

.batch-queue-item__idline code {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    word-break: break-all;
}

.batch-queue-item__idsep {
    opacity: 0.45;
    user-select: none;
}

.batch-queue-inline-warn {
    color: #b45309;
    font-weight: 500;
    font-size: 0.8125rem;
}

.batch-queue-item__mid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 10px 0 6px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.batch-queue-item__mid-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    flex: 1 1 200px;
    min-width: 0;
}

.batch-queue-item__sublabel {
    font-size: 0.8125rem;
    color: var(--text-primary);
    line-height: 1.35;
}

.batch-queue-item__mid-right {
    flex: 0 1 200px;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
}

.batch-queue-progress-bar--list {
    height: 8px;
}

.batch-queue-item__pct {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}

.batch-queue-item__pct-frac {
    font-variant-numeric: tabular-nums;
}

.batch-queue-statsline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding-top: 8px;
}

.batch-queue-statsline__sep {
    margin: 0 8px;
    opacity: 0.4;
    user-select: none;
}

.batch-queue-statsline__item--ok {
    color: var(--success-color);
}

.batch-queue-statsline__item--err {
    color: var(--error-color);
}

.batch-queue-detail-info {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.batch-queue-detail-info .detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.batch-queue-detail-info .detail-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.08);
}

.batch-queue-detail-info .detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.batch-queue-detail-info .detail-value {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.batch-queue-detail-info .detail-value code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-color);
}

/* 批量队列详情弹窗：标题很长时避免挤压右侧按钮 */
#batch-queue-detail-modal .modal-header {
    align-items: flex-start;
    gap: 12px;
}

#batch-queue-detail-modal .modal-header > div {
    flex-shrink: 0;
}

#batch-queue-detail-modal .modal-header-actions {
    flex-direction: row;
    width: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#batch-queue-detail-modal .modal-header-actions button {
    white-space: nowrap;
}

.batch-queue-tasks-list {
    max-height: 500px;
    overflow-y: auto;
}

.batch-queue-tasks-list h4 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.batch-queue-detail-layout + .batch-queue-tasks-list h4 {
    margin-top: 4px;
}

.batch-queue-item__title-col {
    flex: 1;
    min-width: 0;
}

.batch-task-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.batch-task-item:hover {
    box-shadow: var(--shadow-sm);
}

.batch-task-item-active {
    border-color: var(--accent-color);
    background: rgba(0, 102, 255, 0.02);
}

.batch-task-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.batch-task-header .btn-small {
    margin-left: 0;
    flex-shrink: 0;
}

.batch-task-header .batch-task-edit-btn {
    /* 仅把「编辑」(首个操作按钮)推到最右，避免多个按钮都 margin-left:auto 导致挤压/错位 */
    margin-left: auto;
}

.batch-task-header .batch-task-edit-btn--push {
    margin-left: auto;
}

.batch-task-header .batch-task-run-btn {
    flex-shrink: 0;
}

.batch-task-header .batch-task-run-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.batch-task-header .batch-task-delete-btn {
    margin-left: 8px;
}

.batch-task-index {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 30px;
}

.batch-task-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.batch-task-status-pending {
    background: rgba(108, 117, 125, 0.1);
    color: var(--text-secondary);
}

.batch-task-status-running {
    background: rgba(0, 123, 255, 0.1);
    color: var(--accent-color);
}

.batch-task-status-completed {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.batch-task-status-failed {
    background: rgba(220, 53, 69, 0.1);
    color: var(--error-color);
}

.batch-task-status-cancelled {
    background: rgba(108, 117, 125, 0.1);
    color: var(--text-secondary);
}

.batch-task-message {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-word;
}

.batch-task-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.batch-task-error {
    font-size: 0.8125rem;
    color: var(--error-color);
    margin-top: 8px;
    padding: 8px;
    background: rgba(220, 53, 69, 0.05);
    border-radius: 4px;
    border-left: 3px solid var(--error-color);
}

.batch-task-result {
    font-size: 0.8125rem;
    color: var(--text-primary);
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    max-height: 150px;
    overflow-y: auto;
    word-break: break-word;
}

.batch-import-stats {
    display: none;
    padding: 8px 12px;
    background: rgba(0, 102, 255, 0.05);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--accent-color);
}

.batch-import-stat {
    font-weight: 500;
}

@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);
}

.vulnerability-dashboard {
    margin-bottom: 24px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

@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 {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card.stat-critical {
    border-left: 4px solid #dc3545;
}

.stat-card.stat-high {
    border-left: 4px solid #fd7e14;
}

.stat-card.stat-medium {
    border-left: 4px solid #ffc107;
}

.stat-card.stat-low {
    border-left: 4px solid #20c997;
}

.stat-card.stat-info {
    border-left: 4px solid #6c757d;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    transition: color 0.2s ease;
}

.stat-card.is-clickable {
    cursor: pointer;
    user-select: none;
}

.stat-card.is-clickable:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

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

.stat-pct {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.stat-card .stat-value.is-zero {
    color: var(--text-secondary);
    opacity: 0.5;
}

.stat-card.stat-critical .stat-value:not(.is-zero) { color: #dc2626; }
.stat-card.stat-high .stat-value:not(.is-zero) { color: #ea580c; }
.stat-card.stat-medium .stat-value:not(.is-zero) { color: #ca8a04; }
.stat-card.stat-low .stat-value:not(.is-zero) { color: #0f766e; }
.stat-card.stat-info .stat-value:not(.is-zero) { color: #2563eb; }

.stat-stacked-bar {
    display: flex;
    height: 5px;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 12px;
    background: rgba(0, 0, 0, 0.06);
    gap: 1px;
}

.stat-stacked-bar.is-empty {
    opacity: 0.35;
}

.stat-stacked-seg {
    flex: 0 0 auto;
    min-width: 0;
    transition: flex-grow 0.35s ease, opacity 0.2s ease;
}

.stat-stacked-seg.critical { background: #f87171; }
.stat-stacked-seg.high { background: #fb923c; }
.stat-stacked-seg.medium { background: #facc15; }
.stat-stacked-seg.low { background: #2dd4bf; }
.stat-stacked-seg.info { background: #60a5fa; }

/* WebShell 管理页面样式 - 美化版 */
.webshell-page-content {
    height: calc(100vh - 140px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, #f0f4f8 0%, #e8eef5 50%, #f5f7fa 100%);
}

.webshell-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-primary);
    box-shadow: var(--shadow-md);
}

.webshell-sidebar {
    width: 360px;
    min-width: 260px;
    max-width: 50%;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #fafbfd 0%, #f5f7fa 100%);
}

/* 可拖拽调整连接列表宽度 */
.webshell-resize-handle {
    position: relative;
    width: 6px;
    min-width: 6px;
    flex-shrink: 0;
    cursor: col-resize;
    background: var(--border-color);
    transition: background 0.15s ease;
    user-select: none;
}
.webshell-resize-handle:hover,
.webshell-resize-handle.active {
    background: var(--accent-color);
}
.webshell-resize-handle::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 12px;
    margin-left: -3px;
}

.webshell-sidebar-header {
    padding: 14px 18px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.webshell-conn-search {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.webshell-sidebar-tools {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.45);
}

.webshell-sidebar-tools .btn-ghost {
    width: 100%;
    border: 1px solid var(--border-color);
    background: #fff;
}

.webshell-conn-search-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    background: var(--bg-secondary);
}

.webshell-conn-search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.12);
}

.webshell-sidebar-header::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230066ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E") center/contain no-repeat;
}

.webshell-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.webshell-empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    border: 1px dashed var(--border-color);
}

.webshell-item {
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    background: #fff;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.webshell-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.08);
}

.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-item-remark {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.webshell-item-remark-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.webshell-probe-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.72rem;
    padding: 2px 8px;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.webshell-probe-badge.probing {
    color: #a16207;
    background: #fef3c7;
    border-color: #fde68a;
}

.webshell-probe-badge.ok {
    color: #166534;
    background: #dcfce7;
    border-color: #86efac;
}

.webshell-probe-badge.fail {
    color: #b91c1c;
    background: #fee2e2;
    border-color: #fca5a5;
}

#webshell-modal .webshell-form-native-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#webshell-modal .webshell-form-select-ui {
    position: relative;
    width: 100%;
}

#webshell-modal .webshell-form-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 42px;
    padding: 0 42px 0 14px;
    border: 1px solid var(--border-color, #d8dee8);
    border-radius: 8px;
    background: var(--input-bg, #fff);
    color: var(--text-primary, #111827);
    font: inherit;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

#webshell-modal .webshell-form-select-trigger:hover:not(:disabled),
#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-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#webshell-modal .webshell-form-select-caret {
    position: absolute;
    right: 15px;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    opacity: .65;
    transform: translateY(-2px) rotate(45deg);
    transition: transform .16s ease, opacity .16s ease;
}

#webshell-modal .webshell-form-select-ui.open .webshell-form-select-caret {
    opacity: .9;
    transform: translateY(2px) rotate(225deg);
}

#webshell-modal .webshell-form-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 5200;
    display: none;
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border-color, #d8dee8);
    border-radius: 10px;
    background: var(--input-bg, #fff);
    color: var(--text-primary, #111827);
    box-shadow: 0 18px 38px rgba(15, 23, 42, .22);
}

#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 {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 36px;
    padding: 7px 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
}

#webshell-modal .webshell-form-select-option:hover {
    background: var(--bg-secondary, #f4f6f8);
}

#webshell-modal .webshell-form-select-option.is-selected {
    background: rgba(59, 130, 246, .14);
    color: var(--primary-color, #2563eb);
}

#webshell-modal .webshell-form-select-check {
    visibility: hidden;
    font-weight: 800;
}

#webshell-modal .webshell-form-select-option.is-selected .webshell-form-select-check {
    visibility: visible;
}

#webshell-modal .webshell-form-select-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.webshell-item-url {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: ui-monospace, monospace;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.webshell-item-actions {
    margin-top: 6px;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

.webshell-delete-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--error-color);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.webshell-delete-btn:hover {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.3);
}

.webshell-main {
    flex: 1;
    min-width: 380px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.webshell-workspace {
    flex: 1;
    overflow: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.webshell-workspace-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 280px;
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    padding: 32px;
    background: linear-gradient(180deg, rgba(255,255,255,0.8) 0%, rgba(248,249,250,0.9) 100%);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.webshell-workspace-placeholder::before {
    content: '';
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23adb5bd' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' opacity='0.8'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E") center/contain no-repeat;
}

.webshell-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.webshell-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
    transition: color 0.2s ease, background 0.2s ease;
}

.webshell-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.webshell-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    background: transparent;
}

.webshell-pane {
    display: none;
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
}

.webshell-pane.active {
    display: flex;
    width: 100%;
}

.webshell-terminal-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
.webshell-terminal-sessions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 8px;
    height: 34px;
    background: #0b0f14;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
}
.webshell-terminal-session {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    height: 30px;
    color: #c9d1d9;
}
.webshell-terminal-session.active {
    background: #0d1117;
    border-color: rgba(88, 166, 255, 0.45);
    color: #e6edf3;
}
.webshell-terminal-session-main {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 12px;
    height: 100%;
    padding: 0 10px;
    cursor: pointer;
    white-space: nowrap;
}
.webshell-terminal-session-close {
    border: 0;
    background: transparent;
    color: #8b949e;
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 20px;
    padding: 0;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0;
    line-height: 0;
    transition: background 0.15s ease, color 0.15s ease;
    appearance: none;
}

.webshell-terminal-session-close::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    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;
}

.webshell-terminal-session-close:hover {
    background: var(--close-btn-bg-hover);
    color: var(--close-btn-color);
}

.webshell-terminal-session-close:active {
    background: var(--close-btn-bg-active);
    color: var(--close-btn-color);
}

.webshell-terminal-session-add {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-bottom: none;
    background: rgba(255, 255, 255, 0.03);
    color: #8b949e;
    height: 30px;
    width: 28px;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}
.webshell-terminal-session-add:hover {
    color: #e6edf3;
    background: rgba(255, 255, 255, 0.08);
}
.webshell-quick-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-right: 4px;
}
.webshell-terminal-toolbar .btn-ghost {
    font-size: 12px;
}
.webshell-terminal-status {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
}
.webshell-terminal-status.idle {
    color: #166534;
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.25);
}
.webshell-terminal-status.running {
    color: #9a3412;
    background: rgba(251, 146, 60, 0.14);
    border-color: rgba(251, 146, 60, 0.28);
}

#webshell-pane-terminal {
    flex-direction: column;
}

/* 仅外框圆角，内部不做额外装饰，避免挡住文字 */
.webshell-terminal-shell {
    flex: 1;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    background: #0d1117;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.webshell-terminal-container {
    flex: 1;
    min-height: 0;
    padding: 0;
    background: transparent;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.webshell-terminal-container .terminal {
    width: 100%;
    height: 100%;
    padding: 12px 14px;
    box-sizing: border-box;
    overflow: hidden;
}

/* 防止 xterm 辅助层（.xterm-helper-textarea）遮挡终端文字：移出视口并缩小 */
.webshell-terminal-container .xterm .xterm-helper-textarea {
    left: -9999em !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    opacity: 0 !important;
    position: absolute !important;
    z-index: -10 !important;
}
/* 确保光标层不超出单元格，避免整行被蓝条挡住 */
.webshell-terminal-container .xterm-screen {
    overflow: hidden;
}

.webshell-terminal-container .xterm-viewport {
    overflow: hidden;
}

/* WebShell 终端滚动条：深色主题、细窄、圆角，弱化存在感 */
.webshell-terminal-container .xterm-viewport {
    scrollbar-width: thin;
    scrollbar-color: rgba(110, 118, 129, 0.5) transparent;
}
.webshell-terminal-container .xterm-viewport::-webkit-scrollbar {
    width: 6px;
}
.webshell-terminal-container .xterm-viewport::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
    border-radius: 3px;
}
.webshell-terminal-container .xterm-viewport::-webkit-scrollbar-thumb {
    background: rgba(110, 118, 129, 0.4);
    border-radius: 3px;
}
.webshell-terminal-container .xterm-viewport::-webkit-scrollbar-thumb:hover {
    background: rgba(110, 118, 129, 0.65);
}
.webshell-terminal-container .xterm-viewport::-webkit-scrollbar-thumb:active {
    background: rgba(139, 148, 158, 0.7);
}

.webshell-file-layout {
    display: flex;
    gap: 12px;
    min-height: 0;
    flex: 1;
}

.webshell-file-sidebar {
    width: 280px;
    min-width: 260px;
    max-width: 320px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    display: flex;
    flex-direction: column;
    min-height: 0;
    box-shadow: var(--shadow-sm);
}

.webshell-file-sidebar-title {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

.webshell-dir-tree {
    padding: 10px 8px;
    overflow: auto;
    min-height: 0;
}

.webshell-tree-node {
    position: relative;
}

.webshell-tree-row {
    display: flex;
    align-items: center;
    border-radius: 8px;
    margin: 2px 0;
    min-width: 0;
}

.webshell-tree-row.active {
    background: rgba(0, 102, 255, 0.11);
}

.webshell-tree-toggle {
    width: 18px;
    min-width: 18px;
    height: 24px;
    margin-left: 2px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    font-size: 12px;
}

.webshell-tree-toggle.empty {
    cursor: default;
    opacity: 0.6;
}

.webshell-tree-children {
    margin-left: 14px;
    border-left: 1px dashed rgba(128, 128, 128, 0.28);
    padding-left: 6px;
}

.webshell-dir-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--text-primary);
    border-radius: 6px;
    padding: 4px 8px;
    margin: 0;
    cursor: pointer;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.webshell-tree-icon {
    flex: 0 0 auto;
    font-size: 0.92rem;
    opacity: 0.92;
}

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

.webshell-dir-item:hover {
    background: rgba(0, 102, 255, 0.08);
}

.webshell-tree-row.active .webshell-dir-item {
    color: var(--accent-color);
    font-weight: 600;
}

.webshell-tree-row.selected-file .webshell-dir-item {
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-color);
    font-weight: 600;
}

.webshell-file-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    flex: 1;
}

.webshell-file-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.webshell-file-toolbar-main {
    display: flex;
    flex: 1 1 720px;
    min-width: 0;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.webshell-file-toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1 1 200px;
    min-width: 0;
}

.webshell-file-toolbar label span {
    white-space: nowrap;
    flex-shrink: 0;
}

.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-path-field {
    flex: 1 1 260px !important;
}

.webshell-file-toolbar .btn-secondary,
.webshell-file-toolbar .btn-ghost {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.webshell-file-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.webshell-file-breadcrumb {
    width: 100%;
    flex: 0 0 100%;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    min-width: 0;
}
.webshell-file-breadcrumb a.webshell-breadcrumb-item {
    color: var(--accent-color);
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 4px;
}
.webshell-file-breadcrumb a.webshell-breadcrumb-item:hover {
    background: rgba(0, 102, 255, 0.08);
}
.webshell-file-filter {
    min-width: 0 !important;
    flex: 1 1 180px;
    max-width: 260px;
}
.webshell-col-check {
    width: 36px;
    text-align: center;
    vertical-align: middle;
}
.webshell-col-size {
    width: 90px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.webshell-col-mtime {
    width: 170px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    white-space: nowrap;
}

.webshell-col-owner {
    width: 150px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.webshell-col-perms {
    width: 150px;
    font-family: ui-monospace, monospace;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.webshell-col-type {
    width: 72px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    text-transform: lowercase;
}

.webshell-col-actions {
    width: 90px;
}

.webshell-file-list {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    width: 100%;
}

@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-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.9rem;
}

.webshell-file-table thead {
    background: linear-gradient(180deg, #f8f9fa 0%, #f1f3f5 100%);
}

.webshell-file-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.webshell-file-table td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
    min-width: 0;
}

.webshell-col-name {
    min-width: 0;
}

.webshell-file-empty-state {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.92rem;
    background: var(--bg-primary);
}

.webshell-file-table td:last-child {
    white-space: nowrap;
    width: auto;
}

.webshell-file-table tbody tr:hover {
    background: var(--bg-secondary);
}

.webshell-file-table tbody tr.webshell-file-row-selected {
    background: rgba(0, 102, 255, 0.1);
}

.webshell-file-table tbody tr.webshell-file-row-selected a.webshell-file-link {
    color: var(--accent-hover);
    font-weight: 600;
}

.webshell-file-table tbody tr:last-child td {
    border-bottom: none;
}

.webshell-file-table a.webshell-file-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.webshell-file-table a.webshell-file-link:hover {
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-hover);
}

.webshell-file-link.is-dir::before,
.webshell-file-link.is-file::before {
    display: inline-block;
    margin-right: 6px;
    font-size: 0.95rem;
    opacity: 0.95;
}

.webshell-file-link.is-dir::before {
    content: "📁";
}

.webshell-file-link.is-file::before {
    content: "📄";
}

.webshell-file-table .webshell-file-read {
    color: var(--accent-color);
    margin-right: 8px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
}

.webshell-file-table .webshell-file-read:hover {
    background: rgba(0, 102, 255, 0.1);
}

.webshell-file-table .webshell-file-del {
    color: var(--error-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
}

.webshell-file-table .webshell-file-del:hover {
    background: rgba(220, 53, 69, 0.08);
}

/* WebShell 行内“操作”下拉菜单（替代一堆按钮） */
.webshell-conn-actions,
.webshell-row-actions {
    display: inline-block;
    position: relative;
}

.webshell-conn-actions summary,
.webshell-row-actions summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.webshell-conn-actions summary::-webkit-details-marker,
.webshell-row-actions summary::-webkit-details-marker {
    display: none;
}

.webshell-row-actions-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 6px;
    box-shadow: var(--shadow-md);
    min-width: 180px;
    gap: 6px;
    flex-direction: column;
}

.webshell-toolbar-actions {
    position: relative;
}

.webshell-toolbar-actions .webshell-row-actions-menu {
    min-width: 220px;
}

.webshell-conn-actions[open] .webshell-row-actions-menu,
.webshell-row-actions[open] .webshell-row-actions-menu,
.webshell-toolbar-actions[open] .webshell-row-actions-menu {
    display: flex;
}

.webshell-row-actions-menu .btn-ghost {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.86rem;
    white-space: nowrap;
}

.webshell-row-actions-menu .btn-ghost:hover {
    background: rgba(0, 102, 255, 0.08);
    border-color: rgba(0, 102, 255, 0.22);
}

.webshell-row-actions-menu .webshell-file-del:hover {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.25);
}

.webshell-conn-actions-btn,
.webshell-row-actions-btn,
.webshell-toolbar-actions-btn {
    min-width: 72px;
    text-align: center;
    border: 1px solid var(--border-color);
    background: #fff;
}

.webshell-conn-actions-btn:hover,
.webshell-row-actions-btn:hover,
.webshell-toolbar-actions-btn:hover {
    background: var(--bg-secondary);
}

.webshell-loading {
    padding: 24px 20px;
    color: var(--text-muted);
    text-align: center;
}

.webshell-file-error {
    padding: 20px;
    color: var(--error-color);
    background: rgba(220, 53, 69, 0.06);
    border-radius: 10px;
    margin: 8px;
}

.webshell-file-raw,
.webshell-file-content pre {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 0.82rem;
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.webshell-file-content {
    padding: 12px 0;
}

.webshell-file-content-path {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 8px 12px;
    font-family: ui-monospace, monospace;
    word-break: break-all;
    background: var(--bg-secondary, rgba(0, 0, 0, 0.04));
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.webshell-file-content .btn-ghost {
    margin-top: 12px;
    padding: 8px 16px;
    border-radius: 8px;
}

.webshell-file-edit-wrap {
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.webshell-file-edit-path {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 8px 12px;
    font-family: ui-monospace, monospace;
    word-break: break-all;
    background: var(--bg-secondary, rgba(0, 0, 0, 0.04));
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.webshell-file-edit-textarea {
    width: 100%;
    min-height: 280px;
    padding: 14px;
    font-size: 0.82rem;
    font-family: ui-monospace, monospace;
    line-height: 1.5;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.webshell-file-edit-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.15);
}
.webshell-file-edit-actions {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}
.webshell-file-edit-actions .btn-primary,
.webshell-file-edit-actions .btn-ghost {
    min-width: 72px;
}

/* WebShell AI 助手 Tab：仅在此 pane 激活时显示；左右布局 = 左侧栏 + 右侧主区（与对话页一致） */
#webshell-pane-ai {
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
/* 不设 display，避免覆盖 .webshell-pane 的 display:none（否则终端/文件管理页会露出 AI 面板）。左右布局由 #webshell-pane-ai 的 flex-direction:row 提供 */
.webshell-pane-ai-with-sidebar {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    width: 100%;
}
.webshell-ai-sidebar {
    flex-shrink: 0;
    width: 280px;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.webshell-ai-new-btn {
    margin: 10px 12px;
    width: calc(100% - 24px);
}
.webshell-ai-conv-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 0;
}
.webshell-ai-conv-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}
.webshell-ai-conv-item:hover {
    background: var(--border-color);
}
.webshell-ai-conv-item.active {
    background: var(--accent-light, rgba(59, 130, 246, 0.1));
    border-left-color: var(--accent-color);
}
.webshell-ai-conv-item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.webshell-ai-conv-item-date {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.webshell-ai-conv-del {
    flex-shrink: 0;
    padding: 2px 6px;
    opacity: 0.6;
}
.webshell-ai-conv-item:hover .webshell-ai-conv-del {
    opacity: 1;
}
.webshell-ai-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.webshell-pane-memo {
    padding: 14px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.55) 0%, rgba(241, 245, 249, 0.28) 100%);
}
.webshell-memo-layout {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.9) 100%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.85);
    overflow: hidden;
}
.webshell-memo-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    background: #ffffff;
}
.webshell-memo-input {
    flex: 1;
    min-height: 0;
    margin: 12px 14px 8px;
    padding: 12px 13px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: #fff;
    font-size: 0.9rem;
    line-height: 1.55;
    font-family: "JetBrains Mono", "Fira Code", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: var(--text-primary);
    resize: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.webshell-memo-input:focus {
    border-color: rgba(37, 99, 235, 0.5);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}
.webshell-memo-status {
    margin: 0 14px 12px auto;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    color: var(--text-secondary);
    background: rgba(148, 163, 184, 0.14);
    border: 1px solid rgba(148, 163, 184, 0.25);
}
.webshell-memo-status.error {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.28);
}
.webshell-ai-memo {
    flex-shrink: 0;
    width: 300px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    background: var(--bg-secondary);
    min-height: 0;
}
.webshell-ai-memo-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
}
.webshell-ai-memo-input {
    flex: 1;
    min-height: 0;
    margin: 10px 12px 8px;
    resize: none;
}
.webshell-ai-memo-status {
    padding: 0 12px 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.webshell-ai-memo-status.error {
    color: #dc2626;
}
@media (max-width: 1280px) {
    .webshell-ai-memo {
        width: 260px;
    }
}
@media (max-width: 980px) {
    .webshell-ai-memo {
        display: none;
    }
}

/* 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],
[data-require-permission].rbac-permission-denied,
[data-require-permission-any].rbac-permission-denied {
    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-hint {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}
.webshell-ai-toolbar {
    flex-shrink: 0;
    padding: 6px 14px 8px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
}
.webshell-ai-progress {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 6px 12px;
    margin: 0 0 4px 0;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    align-self: flex-start;
}
.webshell-ai-timeline {
    display: none;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}
.webshell-ai-timeline.has-items {
    display: flex;
}
.webshell-ai-timeline-item {
    font-size: 0.85rem;
    color: var(--text-primary);
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}
.webshell-ai-timeline-item:last-child {
    border-bottom: none;
}
.webshell-ai-timeline-title {
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
}

.webshell-ai-timeline-finalization_check {
    border-left: 3px solid #f57c00;
    padding-left: 10px;
    background: linear-gradient(90deg, rgba(245, 124, 0, 0.08), transparent);
}

.webshell-ai-timeline-finalization_check .webshell-ai-timeline-title {
    color: #9a5200;
    font-weight: 600;
}

.webshell-ai-timeline-eino_usage_summary {
    border-left: 3px solid #0f766e;
    padding-left: 10px;
    background: rgba(20, 184, 166, 0.06);
}

.webshell-ai-timeline-msg {
    margin-top: 4px;
    padding-left: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
}
.webshell-ai-process-block.process-details-container {
    margin-top: 8px;
    margin-bottom: 8px;
}
.webshell-ai-process-block.process-details-container {
    /* 让“任务执行详情”视觉上跟随助手气泡宽度，而不是强行 100% 宽 */
    width: auto;
    max-width: 80%;
    align-self: flex-start;
    /* 覆盖通用 .process-details-container 的边框/内边距，避免重复一层“边框卡片” */
    border-top: none;
    padding-top: 0;
    margin-top: 10px;
}
.webshell-ai-process-toggle {
    display: block;
    width: 100%;
    padding: 10px 14px;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
}
.webshell-ai-process-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}
.webshell-ai-process-block .process-details-content .progress-timeline {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.webshell-ai-process-block .process-details-content .progress-timeline {
    /* 避免与外层卡片重复背景/边框 */
    background: transparent;
    border: none;
    padding: 0;
    width: 100%;
    margin-top: 10px;
    gap: 0;
}
.webshell-ai-process-block .webshell-ai-timeline {
    background: transparent;
    border: none;
    padding: 0;
    border-radius: 0;
    margin-bottom: 0;
    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-old-conv {
    width: 100%;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    overflow: hidden;
}
.webshell-ai-old-conv-label {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
}
.webshell-ai-old-conv-label:hover {
    background: var(--border-color);
    color: var(--text-primary);
}
.webshell-ai-old-conv-body {
    padding: 0 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 让 timeline item 更“像条目”而不是松散的分隔块 */
.webshell-ai-process-block .webshell-ai-timeline-item {
    border-left: 3px solid transparent;
    padding: 10px 0 10px 12px;
    border-bottom: 1px solid var(--border-color);
}
.webshell-ai-process-block .webshell-ai-timeline-item:last-child {
    border-bottom: none;
}
.webshell-ai-process-block .webshell-ai-timeline-msg {
    /* 避免每条详情都出现内层滚动条（体验会显得很“碎”） */
    max-height: none;
    overflow-y: visible;
}
.webshell-ai-process-block .webshell-ai-timeline-iteration {
    border-left-color: #c4a574;
    background: rgba(180, 140, 90, 0.04);
}
.webshell-ai-process-block .webshell-ai-timeline-iteration .webshell-ai-timeline-title {
    color: var(--text-secondary);
    font-weight: 500;
}
.webshell-ai-process-block .webshell-ai-timeline-thinking {
    border-left-color: #9c27b0;
}
.webshell-ai-process-block .webshell-ai-timeline-reasoning_chain {
    border-left-color: #5c6bc0;
}
.webshell-ai-process-block .webshell-ai-timeline-tool_call,
.webshell-ai-process-block .webshell-ai-timeline-tool_calls_detected {
    border-left-color: #ff9800;
}
.webshell-ai-process-block .webshell-ai-timeline-tool_result {
    border-left-color: var(--success-color);
}
.webshell-ai-process-block .webshell-ai-timeline-error {
    border-left-color: var(--error-color);
}
.webshell-ai-process-block .webshell-ai-timeline-warning {
    border-left-color: #f57c00;
    background: rgba(245, 124, 0, 0.08);
}
.webshell-ai-process-block .webshell-ai-timeline-eino_usage_summary {
    border-left-color: #0f766e;
    background: rgba(20, 184, 166, 0.06);
}
.webshell-ai-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.webshell-ai-msg {
    padding: 10px 14px;
    border-radius: 10px;
    max-width: 90%;
    white-space: pre-wrap;
    word-break: break-word;
}
.webshell-ai-msg.user {
    align-self: flex-end;
    background: var(--accent-color);
    color: #fff;
}
.webshell-ai-msg.assistant {
    align-self: flex-start;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}
.webshell-ai-msg.assistant.webshell-ai-candidate-output {
    border-color: rgba(245, 124, 0, 0.28);
    background: linear-gradient(90deg, rgba(245, 124, 0, 0.08), rgba(245, 124, 0, 0.035));
    box-shadow: 0 6px 16px rgba(245, 124, 0, 0.08);
}
.webshell-ai-msg.assistant.webshell-ai-msg-error {
    max-width: 72%;
    border-color: rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.06);
}
.webshell-ai-error-head {
    color: var(--error-color);
    font-weight: 600;
    line-height: 1.45;
}
.webshell-ai-error-detail {
    margin-top: 6px;
    font-size: 0.82rem;
}
.webshell-ai-error-detail summary {
    cursor: pointer;
    color: var(--text-secondary);
}
.webshell-ai-error-detail pre {
    margin-top: 6px;
    max-height: 140px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
/* AI 助手 markdown 渲染优化：避免行间距离过大和内容横向溢出 */
.webshell-ai-msg.assistant {
    /* markdown 里已经有块级元素，不需要再整体 pre-wrap，否则容易在块之间产生“空行”感 */
    white-space: normal;
}
.webshell-ai-msg.assistant p,
.webshell-ai-msg.assistant ul,
.webshell-ai-msg.assistant ol,
.webshell-ai-msg.assistant pre,
.webshell-ai-msg.assistant blockquote {
    margin-top: 0;
    margin-bottom: 4px;
}
.webshell-ai-msg.assistant p:last-child,
.webshell-ai-msg.assistant ul:last-child,
.webshell-ai-msg.assistant ol:last-child,
.webshell-ai-msg.assistant pre:last-child,
.webshell-ai-msg.assistant blockquote:last-child {
    margin-bottom: 0;
}
.webshell-ai-msg pre {
    font-family: var(--font-mono, Menlo, Monaco, Consolas, "Courier New", monospace);
    font-size: 0.82rem;
    background: #020617;
    color: #e5e7eb;
    border-radius: 6px;
    padding: 8px 10px;
    overflow-x: auto;
    max-width: 100%;
    white-space: pre;
    box-sizing: border-box;
}
.webshell-ai-msg pre code {
    padding: 0;
    background: transparent;
}
.webshell-ai-msg code {
    font-family: var(--font-mono, Menlo, Monaco, Consolas, "Courier New", monospace);
    font-size: 0.82rem;
    background: rgba(15, 23, 42, 0.06);
    color: inherit;
    border-radius: 4px;
    padding: 0.1em 0.4em;
    white-space: normal;
    box-sizing: border-box;
}
.webshell-ai-msg table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    overflow-x: auto;
    display: block;
}
.webshell-ai-msg table th,
.webshell-ai-msg table td {
    border: 1px solid var(--border-color);
    padding: 4px 6px;
    font-size: 0.8rem;
}
.webshell-ai-msg ul,
.webshell-ai-msg ol {
    padding-left: 20px;
}
/* WebShell AI 输入区域：选择器 + 输入框同行 */
.webshell-ai-input-area {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-top: 1px solid var(--border-color);
}
.webshell-ai-selectors-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}
.webshell-ai-selectors-row .role-selector-btn {
    height: 36px;
    padding: 4px 10px;
    font-size: 0.8125rem;
    border-radius: 8px;
}
.webshell-ai-selectors-row .role-selector-icon {
    font-size: 0.85rem;
}
.webshell-ai-selectors-row .role-selector-text {
    font-size: 0.8125rem;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ws-role-selector-wrapper {
    position: relative;
    flex-shrink: 0;
}
.ws-project-selector-wrapper {
    position: relative;
    flex-shrink: 0;
}
.ws-agent-mode-wrapper {
    flex-shrink: 0;
}
.ws-agent-mode-wrapper .agent-mode-inner {
    position: relative;
}
.webshell-ai-input-row {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 10px;
    align-items: center;
}
.webshell-ai-input {
    flex: 1;
    height: 36px;
    min-height: 36px;
    resize: none;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    /* 更柔和的滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 23, 42, 0.25) transparent;
}
.webshell-ai-input:focus {
    outline: none;
    border-color: var(--accent-color);
}
.webshell-ai-input::-webkit-scrollbar {
    width: 6px;
}
.webshell-ai-input::-webkit-scrollbar-track {
    background: transparent;
}
.webshell-ai-input::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.25);
    border-radius: 999px;
}
.webshell-ai-input::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.4);
}
.webshell-ai-input-row .btn-primary,
.webshell-ai-input-row .webshell-ai-stop-btn {
    flex-shrink: 0;
    height: 36px;
    min-width: 72px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.webshell-ai-stop-btn {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}
.webshell-ai-stop-btn:hover {
    background: #dc2626;
}

/* WebShell 数据库管理 Tab */
.webshell-pane-db {
    flex: 1;
    min-height: 0;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.015) 0%, rgba(2, 6, 23, 0.03) 100%);
    border-radius: 10px;
}
.webshell-db-profiles-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    padding: 6px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.92) 100%);
}
.webshell-db-profiles {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    min-width: 0;
    flex: 1;
}
.webshell-db-profile-actions {
    flex-shrink: 0;
}
.webshell-db-profile-tab {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.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-main,
.webshell-db-profile-menu {
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
.webshell-db-profile-main {
    padding: 5px 10px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
}
.webshell-db-profile-tab.active .webshell-db-profile-main {
    color: var(--text-primary);
    font-weight: 600;
}
.webshell-db-profile-menu {
    padding: 5px 7px;
    border-left: 1px solid rgba(15, 23, 42, 0.1);
    font-size: 0.78rem;
}
.webshell-db-profile-menu:hover {
    background: rgba(15, 23, 42, 0.06);
}
.webshell-db-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 12px;
}
.webshell-db-sidebar {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 100%);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.webshell-db-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}
.webshell-db-sidebar-head span {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}
.webshell-db-schema-tree {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
}
.webshell-db-sidebar-hint {
    border-top: 1px solid var(--border-color);
    padding: 8px 12px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    background: rgba(2, 6, 23, 0.02);
}
.webshell-db-group {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    background: #fff;
    margin-bottom: 8px;
}
.webshell-db-group-title {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    padding: 8px 10px;
    font-size: 0.82rem;
    color: var(--text-primary);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}
.webshell-db-group-title::-webkit-details-marker {
    display: none;
}
.webshell-db-count {
    margin-left: auto;
    font-size: 0.74rem;
    color: var(--text-secondary);
    flex: 0 0 auto;
}
.webshell-db-group-items {
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
}
.webshell-db-table-node {
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    min-width: 0;
}
.webshell-db-table-node:last-child {
    border-bottom: 0;
}
.webshell-db-table-item {
    border: 0;
    background: transparent;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8rem;
    list-style: none;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}
.webshell-db-table-item::-webkit-details-marker {
    display: none;
}
.webshell-db-table-item:hover {
    background: rgba(0, 102, 255, 0.06);
    color: var(--text-primary);
}
.webshell-db-column-list {
    display: flex;
    flex-direction: column;
    margin: 0 0 4px;
}
.webshell-db-column-item {
    border: 0;
    background: transparent;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 24px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.78rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}
.webshell-db-column-item:hover {
    background: rgba(0, 102, 255, 0.06);
    color: var(--text-primary);
}
.webshell-db-column-empty {
    padding: 4px 10px 8px 24px;
    font-size: 0.74rem;
    color: var(--text-secondary);
}
.webshell-db-icon {
    opacity: 0.85;
    flex: 0 0 auto;
}
.webshell-db-label {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.webshell-db-main {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.webshell-db-profile-modal-content {
    max-width: 840px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.18);
}
#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 {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    background: #f8fafc;
    box-shadow: none;
}
.webshell-db-toolbar label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    padding: 7px 9px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.webshell-db-toolbar label:focus-within {
    border-color: rgba(0, 102, 255, 0.32);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}
.webshell-db-toolbar label span {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: none;
}
.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-sql-tools {
    display: flex;
    gap: 8px;
}
.webshell-db-sql {
    width: 100%;
    min-height: 140px;
    resize: vertical;
    font-family: var(--font-mono, Menlo, Monaco, Consolas, "Courier New", monospace);
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    line-height: 1.45;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.webshell-db-sql:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.12);
}
.webshell-db-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.webshell-db-actions .btn-primary,
.webshell-db-actions .btn-ghost {
    min-width: 96px;
    height: 34px;
    border-radius: 8px;
}
.webshell-db-output-wrap {
    flex: 1;
    min-height: 0;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.webshell-db-output-title {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-secondary);
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.015) 0%, transparent 100%);
}
.webshell-db-output {
    flex: 1;
    margin: 0;
    padding: 12px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-mono, Menlo, Monaco, Consolas, "Courier New", monospace);
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-primary);
}
.webshell-db-output.error {
    color: var(--error-color);
}
.webshell-db-result-table {
    border-bottom: 1px solid var(--border-color);
    overflow: auto;
    max-height: 46%;
}
.webshell-db-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.webshell-db-table th,
.webshell-db-table td {
    padding: 7px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
    border-right: 1px solid rgba(148, 163, 184, 0.24);
    white-space: nowrap;
}
.webshell-db-table th:last-child,
.webshell-db-table td:last-child {
    border-right: none;
}
.webshell-db-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(248, 250, 252, 0.98);
    font-weight: 700;
}
.webshell-db-table-meta {
    padding: 6px 8px;
    font-size: 0.74rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    background: rgba(248, 250, 252, 0.9);
}
.webshell-db-hint {
    border-top: 1px solid var(--border-color);
    font-size: 0.76rem;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: rgba(2, 6, 23, 0.02);
}
@media (max-width: 1280px) {
    .webshell-db-layout {
        grid-template-columns: 240px minmax(0, 1fr);
    }
    .webshell-db-toolbar {
        grid-template-columns: repeat(3, minmax(120px, 1fr));
    }
}
@media (max-width: 980px) {
    .webshell-db-layout {
        grid-template-columns: 1fr;
    }
    .webshell-db-sidebar {
        min-height: 200px;
    }
    .webshell-db-toolbar {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}
@media (max-width: 700px) {
    .webshell-db-toolbar {
        grid-template-columns: 1fr;
    }
    #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 {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: auto;
    background: linear-gradient(180deg, #eef2f7 0%, #f1f5f9 50%, #e2e8f0 100%);
    position: relative;
}

.dashboard-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.03) 1px, transparent 0);
    background-size: 24px 24px;
    pointer-events: none;
}

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

.dashboard-content {
    flex: 1;
    padding: 24px;
    overflow: auto;
    width: 100%;
    box-sizing: border-box;
}

/* 第一行：核心 KPI（视觉层次 + 色块强调） */
.dashboard-kpi-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

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

/* 接入概览（C2 / WebShell Tab）：主列内卡片，Tab 样式复用 .dashboard-feed-tabs */

.dashboard-access-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.dashboard-access-strip--webshell {
    grid-template-columns: repeat(3, 1fr);
    max-width: 100%;
}

@media (max-width: 720px) {
    .dashboard-access-strip { grid-template-columns: 1fr; }
    .dashboard-access-strip--webshell { grid-template-columns: 1fr; }
}

.dashboard-access-stat {
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.dashboard-access-stat--c2 {
    background: linear-gradient(145deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid rgba(99, 102, 241, 0.14);
}

.dashboard-access-stat--c2:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.28);
}

.dashboard-access-stat--c2:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.45);
    outline-offset: 2px;
}

.dashboard-access-stat--webshell {
    background: linear-gradient(145deg, #f8fafc 0%, #ecfdf5 100%);
    border: 1px solid rgba(16, 185, 129, 0.16);
}

.dashboard-access-stat--webshell:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
}

.dashboard-access-stat--webshell:focus-visible {
    outline: 2px solid rgba(16, 185, 129, 0.45);
    outline-offset: 2px;
}

.dashboard-access-stat-value {
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.dashboard-access-stat-label {
    display: block;
    margin-top: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.dashboard-webshell-recent {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.dashboard-webshell-recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.1);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    min-width: 0;
}

.dashboard-webshell-recent-item:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.22);
}

.dashboard-webshell-recent-item:focus-visible {
    outline: 2px solid rgba(16, 185, 129, 0.4);
    outline-offset: 2px;
}

.dashboard-webshell-recent-type {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.14);
    color: #047857;
}

.dashboard-webshell-recent-label {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-webshell-recent-empty {
    margin-top: 10px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.dashboard-kpi-card {
    background: #fff;
    border-radius: 14px;
    padding: 18px 20px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.25s ease;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 116px;
}

.dashboard-kpi-card:nth-child(1) { background: linear-gradient(145deg, #fff 0%, #f0f9ff 100%); }
.dashboard-kpi-card:nth-child(2) { background: linear-gradient(145deg, #fff 0%, #fef2f2 100%); }
.dashboard-kpi-card:nth-child(3) { background: linear-gradient(145deg, #fff 0%, #f0fdf4 100%); }
.dashboard-kpi-card:nth-child(4) { background: linear-gradient(145deg, #fff 0%, #f0fdfa 100%); }
.dashboard-kpi-card:nth-child(5) { background: linear-gradient(145deg, #fff 0%, #f8fafc 100%); }

.dashboard-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08), 0 4px 12px rgba(0,102,255,0.08);
    border-color: rgba(0, 102, 255, 0.2);
}

.dashboard-kpi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dashboard-kpi-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-kpi-icon-tasks { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.dashboard-kpi-icon-vuln { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.dashboard-kpi-icon-calls { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.dashboard-kpi-icon-rate { background: rgba(20, 184, 166, 0.1); color: #14b8a6; }
.dashboard-kpi-icon-tokens { background: rgba(99, 102, 241, 0.1); color: #6366f1; }

.dashboard-kpi-value {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.dashboard-kpi-card:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.5);
    outline-offset: 2px;
}

.dashboard-kpi-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* KPI 副标：徽章 + 文本，承载次级信息（严重漏洞数 / 待执行 / 工具数 / 健康度） */
.dashboard-kpi-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 22px;
    margin-top: 2px;
}

.dashboard-kpi-sub-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.dashboard-kpi-sub-text.is-pending { color: #ca8a04; }
.dashboard-kpi-sub-text.is-running { color: #2563eb; }
.dashboard-kpi-sub-text.is-idle    { color: #94a3b8; }
.dashboard-kpi-sub-text.is-success { color: #15803d; }
.dashboard-kpi-sub-text.is-warning { color: #ca8a04; }
.dashboard-kpi-sub-text.is-danger  { color: #dc2626; }

.dashboard-kpi-sub-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

.dashboard-kpi-sub-badge[hidden] { display: none; }

.dashboard-kpi-sub-badge-critical {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.dashboard-kpi-sub-badge .dashboard-kpi-sub-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.85;
}

/* 「上次更新」徽章 */
.dashboard-last-updated {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.03);
    transition: background 0.2s, color 0.3s;
    font-variant-numeric: tabular-nums;
}

.dashboard-last-updated.is-flash {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
    animation: dashboard-last-flash 1.4s ease-out 1;
}

@keyframes dashboard-last-flash {
    0% { background: rgba(34, 197, 94, 0.22); }
    100% { background: rgba(0, 0, 0, 0.03); }
}

.dashboard-last-updated-icon {
    flex-shrink: 0;
}

.dashboard-last-updated-time {
    font-weight: 600;
    color: var(--text-primary);
}

/* 关键提醒条 */
.dashboard-alert-banner {
    --dashboard-alert-accent: #3b82f6;
    --dashboard-alert-accent-soft: rgba(59, 130, 246, 0.07);
    --dashboard-alert-accent-border: rgba(59, 130, 246, 0.18);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    background: linear-gradient(105deg, var(--dashboard-alert-accent-soft) 0%, rgba(255, 255, 255, 0.98) 28%, #fff 100%);
    border: 1px solid var(--dashboard-alert-accent-border);
    color: var(--text-primary, #111827);
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.045), inset 0 1px 0 rgba(255, 255, 255, 0.68);
    animation: dashboard-alert-slide-in 0.3s ease-out;
}

@keyframes dashboard-alert-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-alert-banner[hidden] { display: none; }

.dashboard-alert-banner.is-warning {
    --dashboard-alert-accent: #f59e0b;
    --dashboard-alert-accent-soft: rgba(245, 158, 11, 0.07);
    --dashboard-alert-accent-border: rgba(245, 158, 11, 0.18);
}

.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-alert-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--dashboard-alert-accent-soft);
    color: var(--dashboard-alert-accent);
    box-shadow: inset 0 0 0 1px var(--dashboard-alert-accent-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-alert-icon svg {
    width: 19px;
    height: 19px;
}

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

.dashboard-alert-title {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 3px;
    letter-spacing: 0.01em;
}

.dashboard-alert-desc {
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-secondary, #64748b);
}

.dashboard-alert-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.dashboard-alert-btn {
    appearance: none;
    border: 1px solid var(--dashboard-alert-accent-border);
    background: var(--dashboard-alert-accent-soft);
    color: var(--dashboard-alert-accent);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 7px;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.16s, border-color 0.16s, color 0.16s, filter 0.16s;
    white-space: nowrap;
}

.dashboard-alert-btn:hover {
    filter: saturate(1.15) brightness(0.98);
    border-color: var(--dashboard-alert-accent);
}

.dashboard-alert-btn:focus-visible,
.dashboard-alert-close:focus-visible {
    outline: 2px solid var(--dashboard-alert-accent);
    outline-offset: 2px;
}

.dashboard-alert-btn-secondary {
    background: transparent;
    border-color: var(--dashboard-alert-accent-border);
    color: var(--dashboard-alert-accent);
    box-shadow: none;
}

/* 告警条「× 忽略」按钮：低权重，hover 时才显形 */
.dashboard-alert-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);
    opacity: 0.45;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
}

.dashboard-alert-close svg {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
}

.dashboard-alert-close:hover {
    opacity: 1;
    background: var(--close-btn-bg-hover);
    color: var(--close-btn-color);
}

.dashboard-alert-close:active {
    background: var(--close-btn-bg-active);
    color: var(--close-btn-color);
}

/* 「上次更新」过期状态：变灰 + ⚠️ 图标显形 */
.dashboard-last-updated.is-stale {
    background: rgba(245, 158, 11, 0.08);
    color: #92400e;
    border-color: rgba(245, 158, 11, 0.25);
}

.dashboard-last-updated-stale {
    display: inline-flex;
    align-items: center;
    color: #d97706;
    margin-left: 4px;
}

.dashboard-last-updated-stale[hidden] { display: none; }

/* 推荐操作 section：紧急 / 警告 / 配置 三类，颜色区分但不喧宾夺主 */
.dashboard-section-recommend[hidden] { display: none; }

.dashboard-section-hint {
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
    font-weight: 400;
    margin-left: auto;
}

.dashboard-recommend-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.dashboard-recommend-item {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    column-gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    text-decoration: none;
    color: inherit;
}

.dashboard-recommend-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
}

.dashboard-recommend-item:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.dashboard-recommend-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-recommend-item.lvl-urgent .dashboard-recommend-icon {
    background: #fee2e2;
    color: #dc2626;
}
.dashboard-recommend-item.lvl-warning .dashboard-recommend-icon {
    background: #fef3c7;
    color: #d97706;
}
.dashboard-recommend-item.lvl-setup .dashboard-recommend-icon {
    background: #dbeafe;
    color: #2563eb;
}

/* 紧急推荐：左侧加红条强调 */
.dashboard-recommend-item.lvl-urgent {
    border-left: 3px solid #ef4444;
}

.dashboard-recommend-body {
    min-width: 0;
}

.dashboard-recommend-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-recommend-desc {
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
    margin-top: 2px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-recommend-arrow {
    color: var(--text-tertiary, #9ca3af);
    font-size: 1.125rem;
    font-weight: 400;
    transition: transform 0.15s, color 0.15s;
}

.dashboard-recommend-item:hover .dashboard-recommend-arrow {
    color: #6366f1;
    transform: translateX(2px);
}

/* 最近事件 section：列表风格，按 p0/p1/p2 着色 */
.dashboard-section-events[hidden] { display: none; }

.dashboard-events-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    overflow: hidden;
}

.dashboard-event-item {
    display: grid;
    grid-template-columns: 8px 1fr auto;
    align-items: center;
    column-gap: 12px;
    padding: 10px 12px;
    background: #fff;
}

.dashboard-event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    flex-shrink: 0;
}

.dashboard-event-item.lvl-p0 .dashboard-event-dot { background: #ef4444; }
.dashboard-event-item.lvl-p1 .dashboard-event-dot { background: #f59e0b; }
.dashboard-event-item.lvl-p2 .dashboard-event-dot { background: #6b7280; }

.dashboard-event-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.dashboard-event-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-event-msg {
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-event-time {
    font-size: 0.6875rem;
    color: var(--text-tertiary, #9ca3af);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
    justify-self: end;
    text-align: right;
    min-width: 3.5rem;
}

/* External MCP 健康度：能力总览中专门一行的 N/N + 状态徽章 */
.dashboard-resource-icon-external {
    background: #eef2ff;
    color: #4f46e5;
}

.dashboard-resource-health {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary, #6b7280);
}

.dashboard-resource-health.is-ok {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.dashboard-resource-health.is-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.dashboard-resource-health.is-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

/* 升级版「最近漏洞」空状态：标题 + 描述 + 行动按钮 */
.dashboard-recent-vulns-empty.is-rich {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    text-align: center;
    gap: 8px;
}

.dashboard-empty-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.dashboard-empty-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary, #6b7280);
    line-height: 1.4;
    max-width: 420px;
}

.dashboard-empty-action {
    appearance: none;
    border: 1px solid #6366f1;
    background: #6366f1;
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s, transform 0.15s;
}

.dashboard-empty-action:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

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

/* 两列主内容网格 */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dashboard-side {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 侧栏：批量任务队列（窄栏专用布局） */
.dashboard-section-batch-side .dashboard-section-header {
    margin-bottom: 12px;
}

.dashboard-batch-side-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s ease;
}

.dashboard-batch-side-body:hover {
    background: rgba(0, 102, 255, 0.03);
}

.dashboard-batch-side-body:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.45);
    outline-offset: 2px;
}

.dashboard-batch-side-total {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

.dashboard-batch-side-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.dashboard-batch-side-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-top-width: 3px;
}

.dashboard-batch-side-stat--pending { border-top-color: #f59e0b; }
.dashboard-batch-side-stat--running { border-top-color: #3b82f6; }
.dashboard-batch-side-stat--done    { border-top-color: #10b981; }

.dashboard-batch-side-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.dashboard-batch-side-stat-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.dashboard-batch-side-progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}

.dashboard-batch-side-progress-segment {
    height: 100%;
    transition: width 0.4s ease;
    min-width: 0;
}

.dashboard-batch-side-progress-pending { background: #f59e0b; }
.dashboard-batch-side-progress-running { background: #3b82f6; }
.dashboard-batch-side-progress-done    { background: #10b981; }

.dashboard-side .dashboard-section-tools .dashboard-tools-chart-wrap {
    max-height: 280px;
    overflow-y: auto;
}

.dashboard-grid .dashboard-section {
    margin-bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.05);
    transition: box-shadow 0.25s ease;
    position: relative;
}

.dashboard-grid .dashboard-section:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.07), 0 2px 8px rgba(0,0,0,0.04);
}

.dashboard-section-title {
    display: block;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
    letter-spacing: -0.01em;
}

/* 章节标题 + 「查看全部」链接横排（标题不再单独占下边框） */
.dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
}

.dashboard-section-header .dashboard-section-title {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.dashboard-section-link {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s, transform 0.15s;
    flex-shrink: 0;
    user-select: none;
}

.dashboard-section-link:hover {
    color: #0066ff;
    transform: translateX(2px);
}

.dashboard-section-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

.dashboard-severity-status-filter {
    display: inline-flex;
    align-items: center;
    position: relative;
}

.dashboard-severity-status-filter-btn {
    height: 30px;
    min-width: 124px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(248, 250, 252, 0.62);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.15s;
}

.dashboard-severity-status-filter-btn:hover,
.dashboard-severity-status-filter.is-open .dashboard-severity-status-filter-btn {
    border-color: rgba(0, 102, 255, 0.24);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.dashboard-severity-status-filter-btn:focus-visible {
    border-color: rgba(0, 102, 255, 0.42);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.10);
}

.dashboard-severity-status-filter-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #64748b;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.12);
    flex-shrink: 0;
}

.dashboard-severity-status-filter[data-value="open"] .dashboard-severity-status-filter-dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14); }
.dashboard-severity-status-filter[data-value="confirmed"] .dashboard-severity-status-filter-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16); }
.dashboard-severity-status-filter[data-value="fixed"] .dashboard-severity-status-filter-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16); }
.dashboard-severity-status-filter[data-value="false_positive"] .dashboard-severity-status-filter-dot { background: #94a3b8; box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16); }
.dashboard-severity-status-filter[data-value="ignored"] .dashboard-severity-status-filter-dot { background: #64748b; box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.16); }

.dashboard-severity-status-filter-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-severity-status-filter-caret {
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    opacity: 0.62;
    flex-shrink: 0;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.dashboard-severity-status-filter.is-open .dashboard-severity-status-filter-caret {
    transform: translateY(2px) rotate(225deg);
    opacity: 0.9;
}

.dashboard-severity-status-filter-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    width: 156px;
    padding: 5px;
    border-radius: 9px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16), 0 1px 0 rgba(255, 255, 255, 0.65) inset;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dashboard-severity-status-filter-option {
    width: 100%;
    height: 30px;
    padding: 0 10px 0 28px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    position: relative;
    transition: background 0.15s, color 0.15s;
}

.dashboard-severity-status-filter-option::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    width: 9px;
    height: 5px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-65%) rotate(-45deg);
    opacity: 0;
}

.dashboard-severity-status-filter-option:hover,
.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;
    }
}

/* 最近漏洞 / 近期事实 Tab */
.dashboard-section-header--tabs {
    align-items: center;
    gap: 12px;
}

.dashboard-feed-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    background: #f1f5f9;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.dashboard-feed-tab {
    padding: 7px 14px;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.dashboard-feed-tab:hover {
    color: #0f172a;
}

.dashboard-feed-tab.is-active {
    color: #0066ff;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.dashboard-feed-tab:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.45);
    outline-offset: 2px;
}

.dashboard-feed-panel[hidden] {
    display: none !important;
}

.dashboard-recent-facts {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 60px;
    width: 100%;
    min-width: 0;
    align-items: stretch;
}

.dashboard-recent-facts-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 28px 12px;
    font-size: 0.875rem;
    background: #fafbfc;
    border-radius: 10px;
    border: 1px dashed rgba(0, 0, 0, 0.08);
}

.dashboard-recent-facts-empty.is-rich {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    text-align: center;
    gap: 8px;
}

.dashboard-recent-fact-item {
    display: grid;
    /* 置顶 / 分类 / 置信度 / 摘要 / fact_key / 项目 / 时间 */
    grid-template-columns: 20px 64px 56px minmax(0, 1.2fr) minmax(0, 1fr) 72px 9.5rem;
    align-items: center;
    column-gap: 10px;
    padding: 12px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f3f4f6;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.dashboard-recent-fact-item:last-child {
    border-bottom: none;
}

.dashboard-recent-fact-item:hover {
    background: rgba(0, 102, 255, 0.04);
}

.dashboard-recent-fact-item:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.5);
    outline-offset: 2px;
}

.dashboard-recent-fact-pin {
    width: 20px;
    flex-shrink: 0;
    font-size: 0.75rem;
    line-height: 1;
    text-align: center;
    justify-self: center;
}

.dashboard-recent-fact-project {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    box-sizing: border-box;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-self: start;
    background: #fff;
    border: 1px dashed transparent;
}

/* 项目：虚线描边 + 浅底，与置信度实心药丸区分 */
.dashboard-recent-fact-project.proj-tone-0 { background: rgba(139, 92, 246, 0.05); color: #6d28d9; border-color: rgba(109, 40, 217, 0.45); }
.dashboard-recent-fact-project.proj-tone-1 { background: rgba(59, 130, 246, 0.05); color: #1d4ed8; border-color: rgba(29, 78, 216, 0.45); }
.dashboard-recent-fact-project.proj-tone-2 { background: rgba(20, 184, 166, 0.05); color: #0f766e; border-color: rgba(15, 118, 110, 0.45); }
.dashboard-recent-fact-project.proj-tone-3 { background: rgba(245, 158, 11, 0.06); color: #b45309; border-color: rgba(180, 83, 9, 0.45); }
.dashboard-recent-fact-project.proj-tone-4 { background: rgba(244, 63, 94, 0.05); color: #be123c; border-color: rgba(190, 18, 60, 0.45); }
.dashboard-recent-fact-project.proj-tone-5 { background: rgba(99, 102, 241, 0.05); color: #4338ca; border-color: rgba(67, 56, 202, 0.45); }
.dashboard-recent-fact-project.proj-tone-6 { background: rgba(16, 185, 129, 0.05); color: #047857; border-color: rgba(4, 120, 87, 0.45); }
.dashboard-recent-fact-project.proj-tone-7 { background: rgba(236, 72, 153, 0.05); color: #be185d; border-color: rgba(190, 24, 93, 0.45); }

.dashboard-recent-fact-cat,
.dashboard-recent-fact-conf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    justify-self: start;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-recent-fact-cat {
    width: 64px;
    box-sizing: border-box;
}

.dashboard-recent-fact-conf {
    width: 56px;
    box-sizing: border-box;
}

.dashboard-recent-fact-cat {
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
}

.dashboard-recent-fact-cat.cat-finding,
.dashboard-recent-fact-cat.cat-vuln,
.dashboard-recent-fact-cat.cat-exploit,
.dashboard-recent-fact-cat.cat-poc,
.dashboard-recent-fact-cat.cat-chain {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

.dashboard-recent-fact-cat.cat-target,
.dashboard-recent-fact-cat.cat-env,
.dashboard-recent-fact-cat.cat-auth {
    background: rgba(14, 165, 233, 0.12);
    color: #0369a1;
}

.dashboard-recent-fact-conf.conf-confirmed {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.dashboard-recent-fact-conf.conf-tentative {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.dashboard-recent-fact-summary {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-recent-fact-key {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

.dashboard-recent-fact-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-align: left;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* 最近漏洞列表 */
.dashboard-recent-vulns {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 60px;
    width: 100%;
    min-width: 0;
    align-items: stretch;
}

.dashboard-recent-vulns-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 28px 12px;
    font-size: 0.875rem;
    background: #fafbfc;
    border-radius: 10px;
    border: 1px dashed rgba(0, 0, 0, 0.08);
}

.dashboard-recent-vuln-item {
    display: grid;
    /* 时间列固定宽度：每行独立 grid 时若用 auto，「刚刚」与「N 分钟前」列宽不同 + 右对齐会看起来歪 */
    grid-template-columns: 56px minmax(0, 1.6fr) minmax(0, 1fr) auto 9.5rem;
    align-items: center;
    column-gap: 14px;
    padding: 12px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f3f4f6;
    /* 占满卡片内容宽，避免无 href 的 <a> 或 flex 子项按内容收缩导致右侧大块留白 */
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.dashboard-recent-vuln-item:last-child {
    border-bottom: none;
}

.dashboard-recent-vuln-item:hover {
    background: rgba(0, 102, 255, 0.04);
}

.dashboard-recent-vuln-item:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.5);
    outline-offset: 2px;
}

.dashboard-recent-vuln-sev {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    width: fit-content;
}

.dashboard-recent-vuln-sev.sev-critical { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.dashboard-recent-vuln-sev.sev-high     { background: rgba(249, 115, 22, 0.12); color: #c2410c; }
.dashboard-recent-vuln-sev.sev-medium   { background: rgba(234, 179, 8, 0.15);  color: #a16207; }
.dashboard-recent-vuln-sev.sev-low      { background: rgba(20, 184, 166, 0.12); color: #0f766e; }
.dashboard-recent-vuln-sev.sev-info     { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }

.dashboard-recent-vuln-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-recent-vuln-target {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

.dashboard-recent-vuln-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-align: left;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 状态药丸：和处置状态卡片用同一套语义色，但采用更克制的尺寸 */
.dashboard-recent-vuln-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    border: 1px solid transparent;
}

.dashboard-recent-vuln-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.85;
}

.dashboard-recent-vuln-status.st-open {
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.18);
}

.dashboard-recent-vuln-status.st-confirmed {
    background: rgba(245, 158, 11, 0.10);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.20);
}

.dashboard-recent-vuln-status.st-fixed {
    background: rgba(34, 197, 94, 0.10);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.20);
}

.dashboard-recent-vuln-status.st-fp {
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
    border-color: rgba(148, 163, 184, 0.25);
}

.dashboard-recent-vuln-status.st-ignored {
    background: rgba(108, 117, 125, 0.12);
    color: #868e96;
    border-color: rgba(108, 117, 125, 0.22);
}

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

/* 能力总览 - 侧栏列表 */
.dashboard-resource-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dashboard-resource-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    border-bottom: 1px solid #f3f4f6;
}

/* External MCP 行可能在没配置时隐藏，display:grid 会覆盖 [hidden] 默认行为，需补一条 */
.dashboard-resource-item[hidden] { display: none; }

.dashboard-resource-item:last-child {
    border-bottom: none;
}

.dashboard-resource-item:hover {
    background: rgba(0, 102, 255, 0.04);
}

.dashboard-resource-item:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.5);
    outline-offset: 2px;
}

.dashboard-resource-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-resource-icon-mcp        { background: rgba(99, 102, 241, 0.1);  color: #6366f1; }
.dashboard-resource-icon-skills     { background: rgba(168, 85, 247, 0.1);  color: #a855f7; }
.dashboard-resource-icon-knowledge  { background: rgba(34, 197, 94, 0.1);   color: #22c55e; }
.dashboard-resource-icon-roles      { background: rgba(245, 158, 11, 0.1);  color: #f59e0b; }
.dashboard-resource-icon-agents     { background: rgba(20, 184, 166, 0.1);  color: #14b8a6; }
/* WebShell 用偏暗的青蓝色，跟"终端 / shell"语义对得上，又跟其他几个色相区分 */
.dashboard-resource-icon-webshell   { background: rgba(8, 145, 178, 0.1);   color: #0e7490; }

.dashboard-resource-label {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-resource-value {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    min-width: 1.5em;
    text-align: right;
}

.dashboard-overview-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-overview-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #fafbfc 0%, #f8fafc 100%);
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.dashboard-overview-item:hover {
    border-color: rgba(0, 102, 255, 0.25);
    background: linear-gradient(135deg, rgba(0,102,255,0.04) 0%, rgba(0,102,255,0.06) 100%);
    transform: translateX(4px);
}

.dashboard-overview-item:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.5);
    outline-offset: 2px;
}

.dashboard-overview-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(0, 102, 255, 0.08);
    color: #0369a1;
    flex-shrink: 0;
}

.dashboard-overview-item > div {
    min-width: 0;
}

.dashboard-overview-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.dashboard-overview-value {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* 运行概览优化样式 */
.dashboard-overview-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dashboard-overview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.dashboard-overview-total {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0, 102, 255, 0.08);
    padding: 2px 8px;
    border-radius: 12px;
}

.dashboard-overview-success-rate {
    font-size: 0.75rem;
    font-weight: 600;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
}

.dashboard-overview-status {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 12px;
}

.dashboard-overview-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.dashboard-overview-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
}

.dashboard-overview-stat-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.dashboard-overview-stat-badge.badge-pending {
    background: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
}

.dashboard-overview-stat-badge.badge-running {
    background: #3b82f6;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    animation: pulse-running 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.dashboard-overview-stat-badge.badge-done {
    background: #10b981;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes pulse-running {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0);
    }
}

.dashboard-overview-stat-value {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.dashboard-overview-stat-label {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.dashboard-overview-progress {
    margin-top: 4px;
}

.dashboard-overview-progress-bar {
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
    display: flex;
    position: relative;
}

.dashboard-overview-progress-segment {
    height: 100%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.dashboard-overview-progress-pending {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.dashboard-overview-progress-running {
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    animation: shimmer 2s infinite;
}

.dashboard-overview-progress-done {
    background: linear-gradient(90deg, #34d399, #10b981);
}

@keyframes shimmer {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        opacity: 1;
    }
}

.dashboard-overview-value-group {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}

.dashboard-overview-value-large {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.dashboard-overview-value-normal {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.dashboard-overview-value-unit {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.dashboard-overview-value-separator {
    color: var(--text-secondary);
    opacity: 0.4;
    margin: 0 2px;
}

/* 不同模块的图标颜色 */
.dashboard-overview-icon-batch {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.dashboard-overview-icon-tools {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.dashboard-overview-icon-knowledge {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.dashboard-overview-icon-skills {
    background: rgba(236, 72, 153, 0.1);
    color: #db2777;
}

/* 悬停效果增强 */
.dashboard-overview-item:hover .dashboard-overview-icon {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

.dashboard-overview-item:hover .dashboard-overview-value-large {
    color: #0066ff;
    transition: color 0.2s ease;
}

.dashboard-overview-item-batch:hover {
    border-color: rgba(245, 158, 11, 0.3);
    background: linear-gradient(135deg, rgba(245,158,11,0.06) 0%, rgba(245,158,11,0.08) 100%);
}

.dashboard-overview-item-tools:hover {
    border-color: rgba(59, 130, 246, 0.3);
    background: linear-gradient(135deg, rgba(59,130,246,0.06) 0%, rgba(59,130,246,0.08) 100%);
}

.dashboard-overview-item-knowledge:hover {
    border-color: rgba(139, 92, 246, 0.3);
    background: linear-gradient(135deg, rgba(139,92,246,0.06) 0%, rgba(139,92,246,0.08) 100%);
}

.dashboard-overview-item-skills:hover {
    border-color: rgba(236, 72, 153, 0.3);
    background: linear-gradient(135deg, rgba(236,72,153,0.06) 0%, rgba(236,72,153,0.08) 100%);
}

/* 响应式优化 */
@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;
    }
}

/* 漏洞严重程度分布：半环形图（浅色风格）
   三列布局：[风险概览卡(结论)] [donut(分布图)] [legend(明细)]
   —— 左列的「风险概览」填补原来 donut 左侧的留白，把"多危险 / 还有几个紧急项 / 多久前更新"这类
   结论性信息前置，与右列的分类明细互补。 */
.dashboard-severity-wrap {
    display: grid;
    grid-template-columns: minmax(160px, 180px) minmax(0, 1fr) minmax(200px, 260px);
    gap: 24px;
    align-items: center;
}

@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-insights {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-self: stretch;
    justify-content: center;
    padding: 4px 0;
}

/* —— 风险等级模块 —— */
.dashboard-severity-insight-risk {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fafbfc;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s, border-color 0.2s;
}

.dashboard-severity-insight-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dashboard-severity-insight-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.dashboard-severity-insight-risk-badge {
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 风险等级着色：安全/低/中/高/极高 */
.dashboard-severity-insight-risk[data-level="safe"]   { border-color: rgba(34, 197, 94, 0.20); background: rgba(34, 197, 94, 0.04); }
.dashboard-severity-insight-risk[data-level="safe"]   .dashboard-severity-insight-risk-badge { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.dashboard-severity-insight-risk[data-level="low"]    { border-color: rgba(59, 130, 246, 0.22); background: rgba(59, 130, 246, 0.04); }
.dashboard-severity-insight-risk[data-level="low"]    .dashboard-severity-insight-risk-badge { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.dashboard-severity-insight-risk[data-level="medium"] { border-color: rgba(234, 179, 8, 0.25);  background: rgba(234, 179, 8, 0.05); }
.dashboard-severity-insight-risk[data-level="medium"] .dashboard-severity-insight-risk-badge { background: rgba(234, 179, 8, 0.15); color: #b45309; }
.dashboard-severity-insight-risk[data-level="high"]   { border-color: rgba(249, 115, 22, 0.28); background: rgba(249, 115, 22, 0.05); }
.dashboard-severity-insight-risk[data-level="high"]   .dashboard-severity-insight-risk-badge { background: rgba(249, 115, 22, 0.15); color: #c2410c; }
.dashboard-severity-insight-risk[data-level="severe"] { border-color: rgba(239, 68, 68, 0.30);  background: rgba(239, 68, 68, 0.06); }
.dashboard-severity-insight-risk[data-level="severe"] .dashboard-severity-insight-risk-badge { background: rgba(239, 68, 68, 0.15); color: #dc2626; }

/* 风险分进度条 */
.dashboard-severity-insight-score-track {
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.dashboard-severity-insight-score-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease, background 0.2s;
    background: #94a3b8;
}

.dashboard-severity-insight-risk[data-level="safe"]   .dashboard-severity-insight-score-fill { background: linear-gradient(90deg, #4ade80, #16a34a); }
.dashboard-severity-insight-risk[data-level="low"]    .dashboard-severity-insight-score-fill { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.dashboard-severity-insight-risk[data-level="medium"] .dashboard-severity-insight-score-fill { background: linear-gradient(90deg, #facc15, #ca8a04); }
.dashboard-severity-insight-risk[data-level="high"]   .dashboard-severity-insight-score-fill { background: linear-gradient(90deg, #fb923c, #ea580c); }
.dashboard-severity-insight-risk[data-level="severe"] .dashboard-severity-insight-score-fill { background: linear-gradient(90deg, #f87171, #dc2626); }

.dashboard-severity-insight-score-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.dashboard-severity-insight-score-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.dashboard-severity-insight-score-value {
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* —— 待处理紧急项：分组（标题 + 两个小徽章） —— */
.dashboard-severity-insight-urgent-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dashboard-severity-insight-urgent {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.dashboard-severity-insight-urgent-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 6px;
    border-radius: 10px;
    background: #fafbfc;
    border: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.dashboard-severity-insight-urgent-item:hover {
    transform: translateY(-1px);
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.dashboard-severity-insight-urgent-item:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.5);
    outline-offset: 2px;
}

.dashboard-severity-insight-urgent-item.u-critical { border-color: rgba(239, 68, 68, 0.22); }
.dashboard-severity-insight-urgent-item.u-critical:hover { border-color: rgba(239, 68, 68, 0.40); }
.dashboard-severity-insight-urgent-item.u-high { border-color: rgba(249, 115, 22, 0.22); }
.dashboard-severity-insight-urgent-item.u-high:hover { border-color: rgba(249, 115, 22, 0.40); }

.dashboard-severity-insight-urgent-value {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.dashboard-severity-insight-urgent-item.u-critical .dashboard-severity-insight-urgent-value { color: #dc2626; }
.dashboard-severity-insight-urgent-item.u-high .dashboard-severity-insight-urgent-value { color: #ea580c; }

/* 当数量为 0 时，数值变灰，避免在无紧急项时仍然引人注目 */
.dashboard-severity-insight-urgent-item.is-zero .dashboard-severity-insight-urgent-value {
    color: var(--text-secondary);
    opacity: 0.7;
}

.dashboard-severity-insight-urgent-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* —— 最近发现 —— */
.dashboard-severity-insight-latest {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 4px;
}

.dashboard-severity-insight-time {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.dashboard-severity-insight-time.is-empty {
    color: var(--text-secondary);
    font-weight: 500;
    opacity: 0.75;
}

.dashboard-severity-chart {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    aspect-ratio: 480 / 260;
    isolation: isolate;
}

/* 底部氛围光：轻微呼吸 + 悬停扇区时整体染上该等级色调 */
.dashboard-severity-chart::before {
    content: '';
    position: absolute;
    inset: -14% -12% -10%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.92;
    background:
        radial-gradient(ellipse 82% 64% at 50% 74%, rgba(99, 102, 241, 0.17), transparent 58%),
        radial-gradient(ellipse 52% 42% at 14% 94%, rgba(56, 189, 248, 0.11), transparent 52%),
        radial-gradient(ellipse 48% 38% at 88% 90%, rgba(244, 114, 182, 0.08), transparent 50%);
    animation: dashboard-donut-aura 7s ease-in-out infinite alternate;
}

.dashboard-severity-chart[data-hover-severity="critical"]::before {
    opacity: 1;
    animation: none;
    background: radial-gradient(ellipse 82% 64% at 50% 74%, rgba(239, 68, 68, 0.38), transparent 58%),
                radial-gradient(ellipse 50% 44% at 22% 92%, rgba(249, 115, 22, 0.18), transparent 54%);
}

.dashboard-severity-chart[data-hover-severity="high"]::before {
    opacity: 1;
    animation: none;
    background: radial-gradient(ellipse 82% 64% at 50% 74%, rgba(249, 115, 22, 0.36), transparent 58%),
                radial-gradient(ellipse 48% 40% at 78% 88%, rgba(234, 179, 8, 0.14), transparent 52%);
}

.dashboard-severity-chart[data-hover-severity="medium"]::before {
    opacity: 1;
    animation: none;
    background: radial-gradient(ellipse 82% 64% at 50% 74%, rgba(234, 179, 8, 0.34), transparent 58%),
                radial-gradient(ellipse 46% 38% at 18% 88%, rgba(250, 204, 21, 0.16), transparent 52%);
}

.dashboard-severity-chart[data-hover-severity="low"]::before {
    opacity: 1;
    animation: none;
    background: radial-gradient(ellipse 82% 64% at 50% 74%, rgba(45, 212, 191, 0.34), transparent 58%),
                radial-gradient(ellipse 46% 38% at 86% 88%, rgba(14, 165, 233, 0.14), transparent 52%);
}

.dashboard-severity-chart[data-hover-severity="info"]::before {
    opacity: 1;
    animation: none;
    background: radial-gradient(ellipse 82% 64% at 50% 74%, rgba(59, 130, 246, 0.34), transparent 58%),
                radial-gradient(ellipse 46% 38% at 30% 86%, rgba(129, 140, 248, 0.16), transparent 52%);
}

@keyframes dashboard-donut-aura {
    0% {
        opacity: 0.78;
        transform: scale(0.97);
        filter: saturate(0.92);
    }
    100% {
        opacity: 1;
        transform: scale(1.03);
        filter: saturate(1.08);
    }
}

.dashboard-severity-chart > .dashboard-severity-donut {
    position: relative;
    z-index: 1;
}

.dashboard-severity-donut {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.dashboard-severity-donut .donut-track-shadow {
    fill: #c9d4e3;
    opacity: 0.85;
}

.dashboard-severity-donut .donut-track-vignette {
    pointer-events: none;
}

.dashboard-severity-donut .donut-segment-gloss {
    mix-blend-mode: soft-light;
    opacity: 0.48;
    transition: opacity 0.26s ease;
    pointer-events: none;
}

.dashboard-severity-donut .donut-segment-gloss.is-active {
    opacity: 0.72;
}

.dashboard-severity-donut .donut-segment {
    filter: url(#donut-segment-soften);
    stroke: none;
    pointer-events: none;
    transition: opacity 0.22s ease, filter 0.22s ease;
}

/* 透明命中层：几何固定，悬停时只改视觉层，避免 scale/描边导致边缘频闪 */
.dashboard-severity-donut .donut-segment-hit {
    fill: transparent;
    stroke: transparent;
    stroke-width: 0;
    cursor: pointer;
    outline: none;
    pointer-events: visible;
}

.dashboard-severity-donut .donut-segment-hit:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.55);
    outline-offset: 2px;
}

.dashboard-severity-donut.donut-ready .donut-segment {
    animation: donut-segment-in 0.72s cubic-bezier(0.22, 1.18, 0.36, 1) backwards;
}

.dashboard-severity-donut.donut-ready .donut-segment.seg-critical { animation-delay: 0.03s; }
.dashboard-severity-donut.donut-ready .donut-segment.seg-high { animation-delay: 0.07s; }
.dashboard-severity-donut.donut-ready .donut-segment.seg-medium { animation-delay: 0.11s; }
.dashboard-severity-donut.donut-ready .donut-segment.seg-low { animation-delay: 0.15s; }
.dashboard-severity-donut.donut-ready .donut-segment.seg-info { animation-delay: 0.19s; }

@keyframes donut-segment-in {
    from {
        opacity: 0;
        transform: scale(0.72) translateY(10px);
    }
    72% {
        opacity: 1;
        transform: scale(1.06) translateY(0);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dashboard-severity-donut.is-highlighting .donut-segment.is-dimmed,
.dashboard-severity-donut.is-highlighting .donut-label-text.is-dimmed,
.dashboard-severity-donut.is-highlighting .donut-leader.is-dimmed,
.dashboard-severity-donut.is-highlighting .donut-segment-gloss.is-dimmed {
    opacity: 0.26;
}

.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 {
    stroke: rgba(148, 163, 184, 0.45);
    stroke-width: 1.25;
    pointer-events: none;
    stroke-linecap: round;
    transition: opacity 0.22s ease, stroke 0.22s ease;
}

.dashboard-severity-donut.donut-ready .donut-leader {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: donut-leader-draw 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.dashboard-severity-donut.donut-ready .donut-leader.label-critical { animation-delay: 0.12s; }
.dashboard-severity-donut.donut-ready .donut-leader.label-high { animation-delay: 0.18s; }
.dashboard-severity-donut.donut-ready .donut-leader.label-medium { animation-delay: 0.24s; }
.dashboard-severity-donut.donut-ready .donut-leader.label-low { animation-delay: 0.30s; }
.dashboard-severity-donut.donut-ready .donut-leader.label-info { animation-delay: 0.36s; }

@keyframes donut-leader-draw {
    to { stroke-dashoffset: 0; }
}

.dashboard-severity-donut .donut-leader.is-active {
    stroke: rgba(71, 85, 105, 0.95);
    stroke-width: 2;
}

.dashboard-severity-donut .donut-label-text {
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.34, 1.35, 0.48, 1);
    font-size: 14px;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.dashboard-severity-donut.donut-ready .donut-label-text {
    animation: donut-label-pop 0.58s cubic-bezier(0.34, 1.25, 0.48, 1) backwards;
}

.dashboard-severity-donut.donut-ready .donut-label-text.label-critical { animation-delay: 0.2s; }
.dashboard-severity-donut.donut-ready .donut-label-text.label-high { animation-delay: 0.26s; }
.dashboard-severity-donut.donut-ready .donut-label-text.label-medium { animation-delay: 0.32s; }
.dashboard-severity-donut.donut-ready .donut-label-text.label-low { animation-delay: 0.38s; }
.dashboard-severity-donut.donut-ready .donut-label-text.label-info { animation-delay: 0.44s; }

@keyframes donut-label-pop {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-severity-donut .donut-label-text.is-active {
    font-weight: 800;
    transform: translateY(-2px);
}

.dashboard-severity-donut .donut-label-text .donut-label-pct {
    font-weight: 500;
    font-size: 11px;
    fill: var(--text-secondary, #6b7280);
}

.dashboard-severity-donut .donut-label-text .donut-label-name {
    font-size: 12px;
    font-weight: 600;
}

.dashboard-severity-donut .donut-label-text.label-critical { fill: #ef4444; }
.dashboard-severity-donut .donut-label-text.label-high { fill: #f97316; }
.dashboard-severity-donut .donut-label-text.label-medium { fill: #eab308; }
.dashboard-severity-donut .donut-label-text.label-low { fill: #14b8a6; }
.dashboard-severity-donut .donut-label-text.label-info { fill: #3b82f6; }

/* 半环形主体配色由 SVG linearGradient（#donut-grad-*）提供 */

.dashboard-severity-donut .donut-segment.is-empty {
    display: none;
}

@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%);
    }
}

/* 中心数字：纯文字，贴在半圆开口下方（直径线附近），不遮挡彩色弧带 */
.dashboard-severity-center {
    position: absolute;
    left: 50%;
    bottom: 6%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    width: auto;
    max-width: 7rem;
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: transform 0.28s cubic-bezier(0.34, 1.35, 0.48, 1);
    z-index: 2;
}

.dashboard-severity-center.is-hovering {
    transform: translateX(-50%) scale(1.06);
}

.dashboard-severity-center-label.is-severity {
    font-weight: 700;
    letter-spacing: 0.02em;
}

.dashboard-severity-center-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    text-shadow:
        0 0 20px rgba(255, 255, 255, 0.95),
        0 1px 2px rgba(255, 255, 255, 0.8);
}

.dashboard-severity-center-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    letter-spacing: 0.06em;
    font-weight: 500;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.9);
}

.dashboard-severity-center-label[data-severity="critical"] { color: #dc2626; }
.dashboard-severity-center-label[data-severity="high"] { color: #ea580c; }
.dashboard-severity-center-label[data-severity="medium"] { color: #b45309; }
.dashboard-severity-center-label[data-severity="low"] { color: #0f766e; }
.dashboard-severity-center-label[data-severity="info"] { color: #2563eb; }

@media (max-width: 720px) {
    .dashboard-severity-center-value { font-size: 2.1rem; }
    .dashboard-severity-center-label { font-size: 0.6875rem; }
}

.dashboard-severity-legend {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-self: center;
}

.dashboard-severity-legend-item {
    display: grid;
    /* 标签列有上限；末尾 1fr 吸收侧栏余量，空白在百分比右侧而非标签与数字之间 */
    grid-template-columns: 12px minmax(0, 5.5rem) 2.5em 3em minmax(0, 1fr);
    column-gap: 10px;
    align-items: center;
    padding: 10px 4px;
    font-size: 0.9375rem;
    border-bottom: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
    border-radius: 4px;
    cursor: pointer;
}

.dashboard-severity-legend-item:hover,
.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);
}

.dashboard-severity-legend-item.is-zero {
    opacity: 0.55;
}

.dashboard-severity-legend-item:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.45);
    outline-offset: 2px;
}

.dashboard-severity-donut-tooltip {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10000;
    max-width: 280px;
    padding: 8px 12px;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #fff;
    background: rgba(15, 23, 42, 0.94);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    pointer-events: none;
    white-space: nowrap;
}

.dashboard-severity-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dashboard-severity-legend-dot.critical { background: #f87171; }
.dashboard-severity-legend-dot.high { background: #fb923c; }
.dashboard-severity-legend-dot.medium { background: #facc15; }
.dashboard-severity-legend-dot.low { background: #2dd4bf; }
.dashboard-severity-legend-dot.info { background: #60a5fa; }

.dashboard-severity-legend-label {
    color: var(--text-primary);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-severity-legend-value {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.dashboard-severity-legend-pct {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* 漏洞处置状态 + 修复进度（占据 donut 下方留白） */
.dashboard-severity-status {
    grid-column: 1 / -1;
    padding-top: 18px;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
    gap: 16px;
    align-items: center;
}

@media (max-width: 900px) {
    .dashboard-severity-status {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
}

.dashboard-severity-status-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
}

@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));
    }
}

.dashboard-severity-status-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding: 14px 8px 10px;
    border-radius: 10px;
    background: #fafbfc;
    border: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.dashboard-severity-status-cell:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 102, 255, 0.18);
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.dashboard-severity-status-cell:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.5);
    outline-offset: 2px;
}

.dashboard-severity-status-icon {
    display: none;
}

.dashboard-severity-status-cell.s-open       { border-color: rgba(239, 68, 68, 0.20); background: rgba(239, 68, 68, 0.035); }
.dashboard-severity-status-cell.s-confirmed  { border-color: rgba(245, 158, 11, 0.20); background: rgba(245, 158, 11, 0.035); }
.dashboard-severity-status-cell.s-fixed      { border-color: rgba(34, 197, 94, 0.20); background: rgba(34, 197, 94, 0.035); }
.dashboard-severity-status-cell.s-ignored    { border-color: rgba(100, 116, 139, 0.22); background: rgba(100, 116, 139, 0.04); }
.dashboard-severity-status-cell.s-fp         { border-color: rgba(148, 163, 184, 0.22); background: rgba(148, 163, 184, 0.04); }

.dashboard-severity-status-cell.s-open .dashboard-severity-status-value       { color: #ef4444; }
.dashboard-severity-status-cell.s-confirmed .dashboard-severity-status-value  { color: #f59e0b; }
.dashboard-severity-status-cell.s-fixed .dashboard-severity-status-value      { color: #22c55e; }
.dashboard-severity-status-cell.s-ignored .dashboard-severity-status-value    { color: #94a3b8; }
.dashboard-severity-status-cell.s-fp .dashboard-severity-status-value         { color: #cbd5e1; }

.dashboard-severity-status-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    width: 100%;
}

.dashboard-severity-status-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.dashboard-severity-status-label {
    min-width: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    white-space: nowrap;
    line-height: 1.2;
}

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

.dashboard-severity-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-self: end;
    width: 100%;
    max-width: 380px;
    min-width: 0;
}

.dashboard-severity-progress-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.dashboard-severity-progress-title {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.dashboard-severity-progress-value {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.dashboard-severity-progress-value > span:first-child {
    font-size: 1.125rem;
    font-weight: 800;
    color: #16a34a;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.dashboard-severity-progress-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.dashboard-severity-progress-track {
    display: flex;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #f1f5f9;
    overflow: hidden;
}

.dashboard-severity-progress-fixed {
    background: linear-gradient(90deg, #4ade80 0%, #16a34a 100%);
    transition: width 0.4s ease;
}

.dashboard-severity-progress-confirmed {
    background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
    transition: width 0.4s ease;
}

.dashboard-severity-progress-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.dashboard-severity-progress-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.dashboard-severity-progress-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}

.dashboard-severity-progress-legend-dot.legend-fixed     { background: #16a34a; }
.dashboard-severity-progress-legend-dot.legend-confirmed { background: #f59e0b; }
.dashboard-severity-progress-legend-dot.legend-open      { background: #f1f5f9; border: 1px solid #cbd5e1; }

@media (prefers-reduced-motion: reduce) {
    .dashboard-severity-status-cell { transition: none; }
    .dashboard-severity-progress-fixed,
    .dashboard-severity-progress-confirmed { transition: none; }
}

.dashboard-quick-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* 主内容区：快捷入口横向排列，按钮保持自然宽度不拉伸 */
.dashboard-quick-links-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.dashboard-quick-inline .dashboard-quick-link {
    flex: 0 0 auto;
    width: auto;
    min-width: unset;
    padding: 8px 14px;
}

/* 主内容区快捷入口：去掉图标外层的“涂层”，降低按钮高度 */
.dashboard-quick-inline .dashboard-quick-icon {
    width: auto;
    height: auto;
    min-width: unset;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.dashboard-quick-inline .dashboard-quick-link:hover .dashboard-quick-icon {
    background: transparent;
    box-shadow: 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;
    }
}

.dashboard-quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fafbfc 0%, #f8fafc 100%);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.dashboard-quick-link:hover {
    border-color: rgba(0, 102, 255, 0.3);
    background: linear-gradient(135deg, rgba(0,102,255,0.06) 0%, rgba(0,102,255,0.04) 100%);
    color: var(--text-primary);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,102,255,0.08);
}

.dashboard-quick-link:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.5);
    outline-offset: 2px;
}

.dashboard-quick-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #fff;
    color: var(--text-secondary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}

.dashboard-quick-link:hover .dashboard-quick-icon {
    color: #0369a1;
    background: rgba(3, 105, 161, 0.1);
    box-shadow: 0 2px 8px rgba(3, 105, 161, 0.15);
}

/* 工具执行次数（仅柱状图） */
.dashboard-section-tools .dashboard-section-title {
    margin-bottom: 12px;
}

.dashboard-tools-chart-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.dashboard-tools-chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    border: 1px dashed #cbd5e1;
}

.dashboard-tools-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dashboard-tools-bar-item {
    display: grid;
    grid-template-columns: 82px 1fr 36px;
    gap: 12px;
    align-items: center;
    font-size: 0.8125rem;
}

.dashboard-tools-bar-label {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-tools-bar-track {
    height: 18px;
    background: #f1f5f9;
    border-radius: 9px;
    overflow: hidden;
}

.dashboard-tools-bar-fill {
    height: 100%;
    border-radius: 9px;
    min-width: 6px;
    transform-origin: left;
    animation: dashboard-bar-fill-in 0.8s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
    opacity: 0.92;
}

@keyframes dashboard-bar-fill-in {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.dashboard-tools-bar-value {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dashboard-tools-bar-tooltip {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10000;
    max-width: 320px;
    padding: 6px 10px;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #fff;
    background: rgba(15, 23, 42, 0.95);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    word-break: break-all;
}

.dashboard-cta-block {
    position: relative;
    margin-top: 24px;
    padding: 24px 28px;
    background:
        linear-gradient(90deg, rgba(14, 165, 233, 0.12) 0%, rgba(14, 165, 233, 0.04) 22%, transparent 38%),
        linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(241,245,249,0.95) 50%, rgba(226,232,240,0.4) 100%);
    border: 1px solid rgba(2, 132, 199, 0.12);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.8);
    overflow: hidden;
}

/* HTML5 hidden 属性默认 display:none 会被 .dashboard-cta-block 的 display:flex 覆盖，
   补一条同特异性规则确保智能 CTA 隐藏逻辑生效 */
.dashboard-cta-block[hidden] { display: none; }

.dashboard-cta-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.dashboard-cta-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(2, 132, 199, 0.1) 100%);
    color: #0284c7;
    border-radius: 12px;
}

.dashboard-cta-copy {
    min-width: 0;
}

.dashboard-cta-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.dashboard-cta-sub {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
    max-width: 420px;
}

.dashboard-cta-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px 12px 22px;
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 48%, #0ea5e9 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.25s ease, filter 0.2s;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.dashboard-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.45);
    filter: brightness(1.06);
}

.dashboard-cta-btn-arrow {
    display: inline-flex;
    opacity: 0.9;
    transition: transform 0.2s ease;
}

.dashboard-cta-btn:hover .dashboard-cta-btn-arrow {
    transform: translateX(2px);
}

.dashboard-cta-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* 尊重用户“减少动效”偏好（无障碍最佳实践） */
@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;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.vulnerability-controls {
    margin-bottom: 12px;
    padding: 8px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vulnerability-controls.is-filtered {
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: var(--shadow-sm), 0 0 0 1px rgba(59, 130, 246, 0.08);
}

.vulnerability-filter-toolbar {
    display: block;
}

.vulnerability-filter-primary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.vulnerability-filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.vulnerability-search-wrap {
    position: relative;
    gap: 0;
}

.vulnerability-search-wrap .vulnerability-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    flex-shrink: 0;
}

.vulnerability-search-wrap input[type="search"] {
    padding-left: 32px;
}

.vulnerability-more-filters-anchor {
    position: relative;
}

.vulnerability-more-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 0.875rem;
}

.vulnerability-more-filters-btn.is-active {
    border-color: #3b82f6;
    color: #2563eb;
    background: rgba(59, 130, 246, 0.06);
}

.vulnerability-more-filters-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 120;
    width: min(420px, calc(100vw - 32px));
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-md, 0 8px 24px rgba(15, 23, 42, 0.12));
}

.vulnerability-more-filters-popover[hidden] {
    display: none !important;
}

.vulnerability-more-filters-popover-title {
    margin: 0 0 10px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.vulnerability-more-filters-popover-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}

.vulnerability-more-filters-popover-body .vulnerability-filter-field--full {
    grid-column: 1 / -1;
}

.vulnerability-more-filters-popover-body .vulnerability-filter-field {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.vulnerability-more-filters-popover-body .vulnerability-filter-field > span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.vulnerability-more-filters-popover-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 520px) {
    .vulnerability-more-filters-popover-body {
        grid-template-columns: 1fr;
    }

    .vulnerability-more-filters-popover {
        right: auto;
        left: 0;
    }
}

.vulnerability-filter-field {
    display: flex;
    align-items: center;
    min-width: 0;
    margin: 0;
}

.vulnerability-filter-field--grow {
    flex: 1 1 220px;
    min-width: 160px;
}

.vulnerability-filter-field--status {
    flex: 0 0 auto;
}

.vulnerability-filter-field input,
.vulnerability-filter-field select {
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.vulnerability-filter-field--status select {
    min-width: 120px;
    cursor: pointer;
}

.vulnerability-filter-field input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
}

.vulnerability-filter-field input:focus,
.vulnerability-filter-field select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

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

.vulnerability-filter-field--project .vuln-filter-select,
.vulnerability-filter-field--status .vuln-filter-select {
    position: relative;
    width: 100%;
    min-width: 0;
}

.vulnerability-filter-field--project .vuln-filter-select {
    min-width: 132px;
    max-width: 180px;
}

.vulnerability-filter-field--status .vuln-filter-select {
    min-width: 112px;
}

.vuln-filter-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.25;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.vuln-filter-select-trigger:hover:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.45);
}

.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-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.vuln-filter-select-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
}

.vuln-filter-select.open .vuln-filter-select-caret {
    transform: rotate(180deg);
}

.vuln-filter-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.vuln-filter-select.open .vuln-filter-select-dropdown {
    display: block;
}

.vuln-filter-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.vuln-filter-select-option:hover {
    background: var(--bg-secondary);
}

.vuln-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}

.vuln-filter-select-check {
    width: 14px;
    flex-shrink: 0;
    opacity: 0;
    font-size: 0.75rem;
    line-height: 1;
    color: #2563eb;
}

.vuln-filter-select-option.is-selected .vuln-filter-select-check {
    opacity: 1;
}

.vuln-filter-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vuln-filter-select.is-disabled .vuln-filter-select-trigger {
    opacity: 0.55;
    cursor: not-allowed;
}

.vulnerability-filter-clear-btn[hidden] {
    display: none !important;
}

.vulnerability-filter-clear-btn {
    flex-shrink: 0;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

.vulnerability-filter-clear-btn:hover {
    color: #2563eb;
    background: rgba(59, 130, 246, 0.06);
}

/* 更多筛选生效数量：弱提示文字 */
.vulnerability-filter-advanced-badge {
    display: inline;
    margin-left: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    color: #64748b;
    letter-spacing: 0.01em;
}

.vulnerability-filter-advanced-badge[hidden] {
    display: none !important;
}

.vulnerability-filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.vulnerability-filter-chips-label {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.vulnerability-filter-chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.vulnerability-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 10px;
    font-size: 0.75rem;
    line-height: 1.3;
    color: #1e40af;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.vulnerability-filter-chip:hover {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(59, 130, 246, 0.4);
}

.vulnerability-filter-chip-remove {
    font-size: 0.875rem;
    line-height: 1;
    opacity: 0.7;
}

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

.vulnerabilities-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 0;
}

.vulnerability-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.vulnerability-card:hover {
    box-shadow: var(--shadow-md);
}

.vulnerability-card.severity-critical {
    border-left: 4px solid #dc3545;
}

.vulnerability-card.severity-high {
    border-left: 4px solid #fd7e14;
}

.vulnerability-card.severity-medium {
    border-left: 4px solid #ffc107;
}

.vulnerability-card.severity-low {
    border-left: 4px solid #20c997;
}

.vulnerability-card.severity-info {
    border-left: 4px solid #6c757d;
}

.vulnerability-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0;
    padding: 4px 0;
    transition: background-color 0.2s ease;
}

.vulnerability-header:hover {
    background-color: rgba(0, 102, 255, 0.04);
    border-radius: 6px;
}

html[data-theme="dark"] .vulnerability-header:hover {
    background-color: rgba(96, 165, 250, 0.08);
}

html[data-theme="dark"] .vulnerability-card:hover {
    border-color: #334155;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
}

.vulnerability-title-section {
    flex: 1;
}

.vulnerability-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    flex: 1;
}

.vulnerability-expand-icon {
    color: var(--text-secondary);
    transition: transform 0.2s ease, color 0.2s ease;
}

.vulnerability-header:hover .vulnerability-expand-icon {
    color: var(--accent-color);
}

.vulnerability-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.vulnerability-project-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg-tertiary, rgba(99, 102, 241, 0.12));
    color: var(--text-secondary);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vulnerability-project-badge--unbound {
    opacity: 0.75;
    font-style: italic;
}

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

.vuln-detail-select-ui {
    position: relative;
    flex: 1;
    min-width: 0;
}

.vuln-detail-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.vuln-detail-select-trigger:hover:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.45);
}

.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-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.vuln-detail-select-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
}

.vuln-detail-select-ui.open .vuln-detail-select-caret {
    transform: rotate(180deg);
}

.vuln-detail-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.vuln-detail-select-ui.open .vuln-detail-select-dropdown {
    display: block;
}

.vuln-detail-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.vuln-detail-select-option:hover {
    background: var(--bg-secondary);
}

.vuln-detail-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}

.vuln-detail-select-check {
    width: 14px;
    flex-shrink: 0;
    opacity: 0;
    font-size: 0.75rem;
    line-height: 1;
    color: #2563eb;
}

.vuln-detail-select-option.is-selected .vuln-detail-select-check {
    opacity: 1;
}

.vuln-detail-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vuln-detail-select-ui.is-disabled .vuln-detail-select-trigger {
    opacity: 0.55;
    cursor: not-allowed;
}

.severity-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-badge.severity-critical {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.severity-badge.severity-high {
    background: rgba(253, 126, 20, 0.1);
    color: #fd7e14;
}

.severity-badge.severity-medium {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.severity-badge.severity-low {
    background: rgba(32, 201, 151, 0.1);
    color: #20c997;
}

.severity-badge.severity-info {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.status-badge.status-open {
    background: rgba(0, 102, 255, 0.1);
    color: #0066ff;
}

.status-badge.status-confirmed {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.status-badge.status-fixed {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.status-badge.status-false_positive {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.status-badge.status-ignored {
    background: rgba(108, 117, 125, 0.12);
    color: #868e96;
}

.vuln-status-picker {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
    z-index: 1;
}

.vuln-status-picker.open {
    z-index: 120;
}

.vuln-status-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    max-width: 148px;
    transition: opacity 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    background: transparent;
    color: inherit;
}

.vuln-status-picker-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vuln-status-picker-caret {
    flex-shrink: 0;
    opacity: 0.8;
    transition: transform 0.15s ease;
}

.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.status-open .vuln-status-picker-trigger {
    background: rgba(0, 102, 255, 0.1);
    color: #0066ff;
    border-color: rgba(0, 102, 255, 0.22);
}

.vuln-status-picker.status-confirmed .vuln-status-picker-trigger {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border-color: rgba(40, 167, 69, 0.22);
}

.vuln-status-picker.status-fixed .vuln-status-picker-trigger {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
    border-color: rgba(108, 117, 125, 0.22);
}

.vuln-status-picker.status-false_positive .vuln-status-picker-trigger {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.22);
}

.vuln-status-picker.status-ignored .vuln-status-picker-trigger {
    background: rgba(108, 117, 125, 0.12);
    color: #868e96;
    border-color: rgba(108, 117, 125, 0.22);
}

.vuln-status-picker-trigger:hover:not(:disabled) {
    filter: brightness(0.97);
}

.vuln-status-picker.is-disabled .vuln-status-picker-trigger {
    opacity: 0.65;
    cursor: wait;
    pointer-events: none;
}

.vuln-status-picker-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 136px;
    z-index: 200;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vuln-status-picker-menu[hidden] {
    display: none !important;
}

.vuln-status-picker-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.vuln-status-picker-option:hover {
    background: var(--bg-secondary);
}

.vuln-status-picker-option.is-selected {
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-color);
    font-weight: 500;
}

.vuln-status-picker-check {
    width: 14px;
    flex-shrink: 0;
    opacity: 0;
    font-size: 0.75rem;
    line-height: 1;
    color: var(--accent-color);
}

.vuln-status-picker-option.is-selected .vuln-status-picker-check {
    opacity: 1;
}

.vuln-status-picker-label {
    flex: 1;
    min-width: 0;
}

.vulnerability-card--removing {
    opacity: 0;
    transform: scale(0.98);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.vulnerability-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.vulnerability-actions {
    display: flex;
    gap: 8px;
}

.vulnerability-content {
    margin-top: 16px;
    padding-left: 24px;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 5000px;
    }
}

.vulnerability-description {
    margin-bottom: 16px;
    color: var(--text-primary);
    line-height: 1.6;
}

.vulnerability-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    align-items: start;
}

/* 元数据条数为奇数时，最后一项占满一行，长 URL/队列 ID 更易读 */
.vulnerability-details .vuln-detail-field:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .vulnerability-details {
        grid-template-columns: 1fr;
    }

    .vulnerability-details .vuln-detail-field:last-child:nth-child(odd) {
        grid-column: auto;
    }
}

/* 漏洞详情字段：标签与值分行，长 ID/URL 可换行、可选中复制 */
.vuln-detail-field {
    min-width: 0;
    font-size: 0.875rem;
}

.vuln-detail-field__label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 6px;
    text-transform: none;
    letter-spacing: normal;
}

.vuln-detail-field__row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.vuln-detail-field-value {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.8125rem;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    user-select: text;
    -webkit-user-select: text;
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
}

html[data-theme="dark"] .vulnerability-details code.vuln-detail-field-value {
    background: var(--bg-secondary) !important;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.vuln-detail-field__actions {
    display: flex;
    flex-shrink: 0;
    align-items: flex-start;
    gap: 2px;
    margin-top: 2px;
}

.vuln-detail-field__copy,
.vuln-detail-field__action {
    flex-shrink: 0;
    padding: 6px;
    line-height: 0;
    border-radius: 6px;
    color: var(--text-secondary);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
}

.vuln-detail-field__copy:hover,
.vuln-detail-field__action:hover {
    color: var(--accent-color);
    background: var(--bg-primary);
    border-color: var(--border-color);
}

.vuln-detail-field__copy-spacer {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    margin-top: 2px;
}

.vulnerability-repro {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vulnerability-section,
.vulnerability-proof,
.vulnerability-impact,
.vulnerability-recommendation {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.6;
}

.vulnerability-section:first-child {
    margin-top: 0;
}

.vulnerability-proof pre {
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.8rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.vulnerability-section-body {
    margin-top: 8px;
    color: var(--text-primary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.vulnerability-section-body--code {
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.8rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.vulnerability-section strong,
.vulnerability-proof strong,
.vulnerability-impact strong,
.vulnerability-recommendation strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 8px;
}

.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 {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    height: 40px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    white-space: nowrap;
    box-sizing: border-box;
}

.role-selector-btn:hover {
    background: #f8f9fa;
    border-color: rgba(0, 102, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.08);
}

.role-selector-btn:active {
    transform: scale(0.98);
    background: #f0f2f5;
}

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

.role-selector-icon {
    flex-shrink: 0;
}

.agent-mode-logo {
    --agent-logo-a: #858d98;
    --agent-logo-b: #858d98;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--agent-logo-a);
    box-shadow: none;
    overflow: visible;
    flex: 0 0 auto;
}

.agent-mode-logo--deep {
    --agent-logo-a: #858d98;
    --agent-logo-b: #858d98;
}

.agent-mode-logo--plan {
    --agent-logo-a: #858d98;
    --agent-logo-b: #858d98;
}

.agent-mode-logo--supervisor {
    --agent-logo-a: #858d98;
    --agent-logo-b: #858d98;
}

.agent-mode-logo--default {
    --agent-logo-a: #858d98;
    --agent-logo-b: #858d98;
}

.agent-mode-logo__svg {
    width: 100%;
    height: 100%;
    display: block;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.role-selector-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    flex-shrink: 0;
}

.role-selector-arrow {
    width: 10px;
    height: 10px;
    color: rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}

.role-selector-btn:hover .role-selector-arrow {
    color: rgba(0, 102, 255, 0.6);
}

/* 角色选择器包装器 */
.role-selector-wrapper {
    position: relative;
    flex-shrink: 0;
}

.agent-mode-wrapper {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* 与角色选择器共用 .role-selector-btn；此处仅包一层用于定位浮层 */
.agent-mode-inner {
    position: relative;
    flex-shrink: 0;
}

/* 单/多代理面板：与「选择角色」浮层同一视觉语言（白底、圆角、阴影） */
.agent-mode-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 300px;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
}

.agent-mode-panel-header {
    margin-bottom: 8px;
    text-align: left;
}

.agent-mode-panel .role-selection-panel-title {
    text-align: left;
}

.agent-mode-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    overflow: visible;
}

.agent-mode-options > .role-selection-item-main {
    flex-shrink: 0;
}

/* 选项为 <button>，浏览器默认 text-align:center 会继承到文案，强制左对齐与角色列表一致 */
.agent-mode-option.role-selection-item-main {
    text-align: left;
    justify-content: flex-start;
}

.agent-mode-option .role-selection-item-content-main,
.agent-mode-option .role-selection-item-name-main,
.agent-mode-option .role-selection-item-description-main {
    text-align: left;
}

.agent-mode-option::after {
    content: attr(data-agent-mode-detail);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    z-index: 20;
    width: max-content;
    max-width: min(380px, calc(100vw - 40px));
    padding: 9px 11px;
    border-radius: 8px;
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.75rem;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translate(4px, -50%);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.agent-mode-option::before {
    content: "";
    position: absolute;
    left: calc(100% + 6px);
    top: 50%;
    z-index: 21;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translate(4px, -50%) rotate(45deg);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.agent-mode-option:hover::after,
.agent-mode-option:focus-visible::after,
.agent-mode-option:hover::before,
.agent-mode-option:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
}

.agent-mode-option:hover::before,
.agent-mode-option:focus-visible::before {
    transform: translate(0, -50%) rotate(45deg);
}

/* 选项内勾选：未选中时隐藏（与角色列表一致） */
.agent-mode-option .agent-mode-check {
    display: none !important;
}

.agent-mode-option.selected .agent-mode-check {
    display: flex !important;
}

/* 主内容区域角色选择面板样式（下拉菜单形式） */
.role-selection-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 340px;
    max-width: calc(100vw - 32px);
    max-height: min(580px, 60vh);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.role-selection-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 4px 12px 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 10;
}

.role-selection-panel-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    letter-spacing: -0.01em;
}

.role-selection-list-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* 限制显示8个角色：每个角色约70px高度 + gap，8个角色约580px */
    max-height: 580px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
    flex: 1;
}

/* 防止 flex 列容器在高度受限时把列表项纵向压扁（应滚动而非压缩） */
.role-selection-list-main > .role-selection-item-main {
    flex-shrink: 0;
}

.role-selection-list-main::-webkit-scrollbar {
    width: 8px;
}

.role-selection-list-main::-webkit-scrollbar-track {
    background: transparent;
}

.role-selection-list-main::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.16);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.role-selection-list-main::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.24);
    background-clip: padding-box;
}

.role-selection-item-main {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 1.5px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    min-width: 0;
    flex-shrink: 0;
    box-sizing: border-box;
}

.role-selection-item-main:hover {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.04) 0%, rgba(138, 43, 226, 0.02) 100%);
    border-color: rgba(138, 43, 226, 0.2);
    box-shadow: 0 2px 8px rgba(138, 43, 226, 0.08);
    transform: translateY(-1px);
}

.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:active {
    transform: translateY(0) scale(0.98);
}

.role-selection-item-icon-main {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.02) 100%);
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.role-selection-item-main:hover .role-selection-item-icon-main {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.1) 0%, rgba(138, 43, 226, 0.05) 100%);
    border-color: rgba(138, 43, 226, 0.15);
    transform: scale(1.05);
}

.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 .role-selection-item-icon-main.agent-mode-logo,
.role-selection-item-main:hover .role-selection-item-icon-main.agent-mode-logo,
.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-content-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
    padding-top: 2px;
    text-align: left;
}

.role-selection-item-name-main {
    font-weight: 500;
    color: #1a1a1a;
    font-size: 0.875rem;
    line-height: 1.4;
    margin: 0;
    transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow-wrap: anywhere;
}

.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-description-main {
    font-size: 0.75rem;
    color: #666666;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.role-selection-item-main.selected .role-selection-item-description-main {
    color: #8a5ab8;
}

.selection-detail-tooltip {
    position: fixed;
    z-index: 10000;
    max-width: min(380px, calc(100vw - 40px));
    padding: 9px 11px;
    border-radius: 8px;
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.75rem;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(4px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.selection-detail-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.selection-detail-tooltip::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 50%;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transform: translateY(-50%) rotate(45deg);
}

.selection-detail-tooltip.placement-left {
    transform: translateX(-4px);
}

.selection-detail-tooltip.placement-left.visible {
    transform: translateX(0);
}

.selection-detail-tooltip.placement-left::before {
    left: auto;
    right: -5px;
    border-left: none;
    border-bottom: none;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.role-selection-checkmark-main {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8a2be2 0%, #6a1bb2 100%);
    color: white;
    border-radius: 50%;
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(138, 43, 226, 0.4);
    animation: checkmarkPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes checkmarkPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes highlight-flash {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(138, 43, 226, 0.1);
    }
}

.role-select-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.role-select-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.03) 0%, rgba(138, 43, 226, 0.01) 100%);
    opacity: 0;
    transition: opacity 0.25s;
}

.role-select-item:hover {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-color: rgba(138, 43, 226, 0.3);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.1), 0 2px 4px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.role-select-item:hover::before {
    opacity: 1;
}

.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-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    transition: all 0.25s;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.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-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.role-select-item-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.4;
    margin: 0;
    transition: color 0.2s;
}

.role-select-item.selected .role-select-item-name {
    color: #8a2be2;
}

.role-select-item-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 角色管理页面样式 */
.roles-controls {
    margin-bottom: 24px;
}

.roles-stats-bar {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.role-stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.role-stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.role-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.roles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 角色搜索框样式 */
.roles-search-box {
    position: relative;
    margin-bottom: 20px;
}

.roles-search-box input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.roles-search-box input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.roles-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.roles-search-clear:hover {
    color: var(--text-primary);
}

/* 角色卡片网格布局 */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 0;
}

/* 角色卡片样式 */
.role-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
    cursor: default;
}

.role-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.role-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.role-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-card-icon {
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
}

.role-card-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.role-card-badge.enabled {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
}

.role-card-badge.disabled {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error-color);
}

.role-card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
    min-height: 40px;
}

.role-card-tools {
    display: flex;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.role-card-tools-label {
    font-weight: 500;
    white-space: nowrap;
}

.role-card-tools-value {
    color: var(--text-primary);
    flex: 1;
    word-break: break-word;
}

.role-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

.role-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.role-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--accent-color);
}

.role-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.role-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.role-item-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.role-item-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-item-badge.enabled {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
}

.role-item-badge.disabled {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error-color);
}

.role-item-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.role-item-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.role-item-detail {
    display: flex;
    gap: 8px;
    font-size: 0.8125rem;
}

.role-item-detail-label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 80px;
}

.role-item-detail-value {
    color: var(--text-primary);
    flex: 1;
    word-break: break-word;
}

.role-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* 角色MCP选择列表样式 */
.role-mcps-list {
    margin-top: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
}

.role-mcps-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.role-mcp-checkbox-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.role-mcp-checkbox-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    box-shadow: 0 2px 4px rgba(0, 102, 255, 0.1);
}

.role-mcp-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.role-mcp-checkbox-item:has(input[type="checkbox"]:checked) {
    background: rgba(0, 102, 255, 0.08);
    border-color: var(--accent-color);
}

.role-mcp-checkbox-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.role-mcp-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.role-mcp-status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.role-mcp-status.status-connected {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
}

.role-mcp-status.status-disconnected {
    background: rgba(108, 117, 125, 0.12);
    color: var(--text-secondary);
}

.role-mcp-status.status-connecting {
    background: rgba(255, 193, 7, 0.12);
    color: var(--warning-color);
}

.role-mcp-status.status-error {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error-color);
}

.role-mcp-status.status-disabled {
    background: rgba(108, 117, 125, 0.12);
    color: var(--text-muted);
}

.role-mcp-tool-count {
    padding: 2px 6px;
    background: rgba(0, 102, 255, 0.1);
    color: var(--accent-color);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.mcp-loading,
.mcp-empty,
.mcp-error {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.mcp-error {
    color: var(--error-color);
}

/* 角色工具选择列表样式 */
.role-tools-controls {
    margin-bottom: 12px;
}

.role-tools-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.role-tools-search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.role-tools-search-box input {
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.role-tools-search-box input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.role-tools-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.role-tools-search-clear:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.role-tools-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.role-tools-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.role-tools-stats-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
    width: 100%;
}

.role-tool-mcp-disabled-badge {
    padding: 2px 6px;
    background: rgba(108, 117, 125, 0.15);
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    margin-left: 4px;
}

.role-tools-filter-banner {
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    font-size: 0.8125rem;
    line-height: 1.5;
    border: 1px solid var(--border-color);
}
.role-tools-filter-banner-on {
    background: rgba(0, 102, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(0, 102, 255, 0.25);
}
.role-tools-filter-banner-off {
    background: rgba(108, 117, 125, 0.1);
    color: var(--text-secondary);
}

.role-tool-mcp-on-badge {
    padding: 2px 6px;
    background: rgba(25, 135, 84, 0.12);
    color: #198754;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 6px;
}

.role-tools-stats span {
    white-space: nowrap;
}

.role-tools-stats strong {
    color: var(--text-primary);
    font-weight: 600;
}

.role-tools-list {
    margin-top: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
}

.role-tools-list-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.role-tool-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    transition: all 0.2s ease;
}

.role-tool-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    box-shadow: 0 2px 4px rgba(0, 102, 255, 0.1);
}

.role-tool-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--accent-color);
    flex-shrink: 0;
}

.role-tool-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.role-tool-item-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.role-tool-item-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.external-tool-badge {
    padding: 2px 6px;
    background: rgba(0, 102, 255, 0.1);
    color: var(--accent-color);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.role-tools-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-wrap: wrap;
    gap: 12px;
}

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

.tools-loading,
.tools-empty,
.tools-error {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.tools-error {
    color: var(--error-color);
}

/* 默认角色提示信息样式 */
.role-tools-default-hint {
    margin-top: 8px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.role-tools-default-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.role-tools-default-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.role-tools-default-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.role-tools-default-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.role-tools-default-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* 角色选择面板响应式样式 */
@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;
    }
}

/* Skills管理页面样式 */
.skills-controls {
    margin-bottom: 8px;
}

.skills-stats-bar {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 10px;
}

.skill-stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.skill-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.skill-stat-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.skills-filters {
    display: flex;
    gap: 8px;
    align-items: center;
}

.skills-filters input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    box-sizing: border-box;
    height: 32px;
    line-height: 1.4;
}

.skills-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

/* 技能搜索框样式 */
.skills-search-box {
    position: relative;
    margin-bottom: 12px;
}

.skills-search-box input {
    width: 100%;
    padding: 8px 40px 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.skills-search-box input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.skills-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.skills-search-clear:hover {
    color: var(--text-primary);
}

.agents-page-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 12px 0;
    max-width: 960px;
}

.agents-dir-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    word-break: break-all;
}

/* 技能列表布局 */
.skills-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0;
    /* 确保列表可以滚动，不会把分页栏推出视口 */
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* 技能列表项样式 */
.skill-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
    cursor: default;
    box-sizing: border-box;
    width: 100%;
}

.skill-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.skill-card-header {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
    min-width: 0;
}

.skill-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
}

.agent-role-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 8px;
    vertical-align: middle;
}

.agent-role-badge--orchestrator {
    background: rgba(0, 102, 255, 0.12);
    color: var(--accent-color, #0066ff);
}

.agent-role-badge--sub {
    background: var(--bg-tertiary, rgba(0, 0, 0, 0.06));
    color: var(--text-secondary);
}

#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);
}

.skill-card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
    margin: 0;
}

.skill-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* 技能列表响应式布局优化 */
@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-overview {
    display: grid;
    grid-template-columns: minmax(160px, 1.2fr) repeat(3, minmax(110px, 0.55fr));
    gap: 12px;
}

.skills-overview-card {
    min-height: 76px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.58)),
        var(--bg-primary);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.skills-overview-card-primary {
    border-color: rgba(0, 102, 255, 0.28);
    background:
        linear-gradient(135deg, rgba(0, 102, 255, 0.16), rgba(40, 167, 69, 0.10)),
        var(--bg-primary);
}

.skills-overview-label {
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--text-secondary);
    font-weight: 600;
}

.skills-overview-card strong {
    font-size: 1.55rem;
    line-height: 1;
    color: var(--text-primary);
    font-weight: 700;
}

.skills-management-page .skills-controls {
    margin-bottom: 0;
}

.skills-management-page .skills-search-box {
    margin-bottom: 0;
}

.skills-management-page .skills-search-box::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    opacity: 0.58;
    background: currentColor;
    color: var(--text-secondary);
    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='m21 21-4.34-4.34'/%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3C/svg%3E") center / contain no-repeat;
}

.skills-management-page .skills-search-box input {
    height: 44px;
    padding: 10px 44px 10px 44px;
    border-radius: 10px;
    background: var(--bg-primary);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.skills-management-page .skills-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 2px 2px 18px;
}

.skills-management-page .skill-card {
    min-height: 92px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
    gap: 14px 16px;
    padding: 14px 18px;
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 249, 250, 0.88)),
        var(--bg-primary);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    position: relative;
    overflow: hidden;
}

.skills-management-page .skill-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-top: 2px solid rgba(0, 102, 255, 0.38);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.skills-management-page .skill-card:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 102, 255, 0.38);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.12);
}

.skills-management-page .skill-card:hover::after {
    opacity: 1;
}

.skill-card-mark {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.18), rgba(40, 167, 69, 0.14));
    color: var(--accent-color);
    font-size: 1rem;
    font-weight: 800;
    border: 1px solid rgba(0, 102, 255, 0.18);
}

.skill-card-body {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px 18px;
}

.skills-management-page .skill-card-header {
    min-width: 0;
    gap: 8px;
}

.skill-card-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.skills-management-page .skill-card-title {
    font-size: 1.02rem;
    line-height: 1.35;
    word-break: normal;
    overflow-wrap: anywhere;
    flex: 0 1 auto;
}

.skill-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skill-card-meta span {
    max-width: 100%;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(0, 102, 255, 0.08);
    color: var(--accent-color);
    border: 1px solid rgba(0, 102, 255, 0.14);
    font-size: 0.72rem;
    line-height: 1.25;
    font-weight: 600;
}

.skills-management-page .skill-card-description {
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 1.4em;
}

.skills-management-page .skill-card-actions {
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    align-self: center;
}

.skills-management-page .skill-card-actions .btn-secondary {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.66);
}

.skills-management-page .skill-card-actions .btn-danger {
    color: var(--error-color);
}

html[data-theme="dark"] .skills-overview-card,
html[data-theme="dark"] .skills-management-page .skill-card,
html[data-theme="dark"] .skills-management-page .skills-search-box input {
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.92)),
        #111827;
    border-color: #263244;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.20);
}

html[data-theme="dark"] .skills-overview-card-primary {
    border-color: rgba(96, 165, 250, 0.30);
    background:
        linear-gradient(135deg, rgba(96, 165, 250, 0.14), rgba(52, 211, 153, 0.08)),
        #111827;
}

html[data-theme="dark"] .skill-card-mark {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.18), rgba(52, 211, 153, 0.12));
    border-color: rgba(96, 165, 250, 0.22);
}

html[data-theme="dark"] .skill-card-meta span {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.22);
}

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 .skills-overview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.skills-management-page .skills-overview-card,
.skills-management-page .skills-overview-card-primary {
    min-height: 0;
    padding: 12px 14px;
    gap: 6px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-xs);
}

.skills-management-page .skills-overview-card strong {
    font-size: 1.25rem;
    font-weight: 600;
}

.skills-management-page .skills-search-box::before {
    display: none;
}

.skills-management-page .skills-search-box input {
    height: auto;
    padding: 8px 40px 8px 16px;
    border-radius: 8px;
    background: var(--bg-primary);
    box-shadow: none;
}

.skills-management-page .skills-grid {
    gap: 12px;
    padding: 0 0 16px;
}

.skills-management-page .skill-card {
    min-height: 76px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    box-shadow: none;
    overflow: visible;
}

.skills-management-page .skill-card::after {
    display: none;
}

.skills-management-page .skill-card:hover {
    transform: none;
    border-color: var(--accent-color);
    box-shadow: var(--shadow-sm);
}

.skills-management-page .skill-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.skills-management-page .skill-card-header {
    gap: 6px;
}

.skills-management-page .skill-card-title-row {
    flex-wrap: wrap;
    gap: 8px 12px;
}

.skills-management-page .skill-card-meta {
    gap: 8px;
}

.skills-management-page .skill-card-meta span {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 400;
}

.skills-management-page .skill-card-description {
    display: block;
    min-height: 0;
    overflow: visible;
    line-height: 1.45;
}

.skills-management-page .skill-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.skills-management-page .skill-card-tags span {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(15, 23, 42, 0.04);
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1.3;
}

.skills-management-page .skill-card-actions {
    display: flex;
    grid-column: auto;
    grid-row: auto;
    margin: 0;
    align-items: center;
    justify-content: flex-end;
}

.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 .skills-overview-card,
html[data-theme="dark"] .skills-management-page .skills-overview-card-primary,
html[data-theme="dark"] .skills-management-page .skill-card,
html[data-theme="dark"] .skills-management-page .skills-search-box input,
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;
    }
}

.skill-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 12px;
    transition: all 0.2s;
}

.skill-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.1);
}

.skill-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.skill-item-info {
    flex: 1;
}

.skill-item-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.skill-item-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.skill-item-actions {
    display: flex;
    gap: 6px;
}

.btn-icon {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.btn-icon.btn-danger:hover {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
    color: #dc3545;
}

.skill-item-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.skill-meta-item {
    display: flex;
    align-items: center;
}

/* Skills监控页面样式 */
.skills-monitor-controls {
    margin-bottom: 24px;
}

.skills-monitor-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skill-monitor-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s;
}

.skill-monitor-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.1);
}

.skill-monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.skill-monitor-info {
    flex: 1;
}

.skill-monitor-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.skill-monitor-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.skill-monitor-status {
    display: flex;
    align-items: center;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-success {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.skill-monitor-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Skills 状态监控：只保留数据展示所需规则，视觉复用通用页面组件。 */
.skills-monitor-page .monitor-overview {
    gap: 12px;
}

.skills-monitor-page .monitor-stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.skills-monitor-page .monitor-stat-value,
.skills-monitor-page .skills-table-pill,
.skills-monitor-page .skills-table-number,
.skills-monitor-page .skills-rate-cell,
.skills-monitor-page .skills-last-call {
    font-variant-numeric: tabular-nums;
}

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

.skills-monitor-page .skills-monitor-table {
    min-width: 900px;
}

.skills-monitor-page .skills-monitor-table th:first-child,
.skills-monitor-page .skills-monitor-table td:first-child {
    text-align: left;
}

.skills-monitor-page .skills-rate-cell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.skills-monitor-page .skills-rate-track {
    display: block;
    width: 76px;
    height: 6px;
    border-radius: 999px;
    background: var(--border-color);
    overflow: hidden;
}

.skills-monitor-page .skills-rate-track span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: inherit;
    background: var(--success-color);
}

.skills-monitor-page .skills-last-call {
    color: var(--text-secondary);
}

/* ==================== 信息收集（FOFA）页面 ==================== */
.info-collect-panel {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(20, 184, 166, 0.05) 42%, transparent 70%),
        var(--bg-primary);
    border: 1px solid color-mix(in srgb, var(--border-color) 72%, var(--accent-color));
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
}

.info-collect-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.info-collect-form-top {
    display: grid;
    grid-template-columns: minmax(220px, 0.32fr) minmax(420px, 1fr);
    gap: 12px;
}

.info-collect-provider-card,
.info-collect-query-card,
.info-collect-options-card,
.info-collect-fields-card {
    border: 1px solid rgba(15, 23, 42, 0.07);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.info-collect-form .form-group {
    margin-bottom: 0;
}

.info-collect-provider-card,
.info-collect-query-card,
.info-collect-fields-card {
    padding: 14px 16px 16px;
}

.info-collect-query-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.88)),
        var(--bg-primary);
}

.info-collect-options-card {
    padding: 14px 16px;
    background:
        linear-gradient(135deg, rgba(248, 250, 252, 0.94), rgba(239, 246, 255, 0.68));
}

.info-collect-step-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 650;
    line-height: 1.3;
}

.info-collect-step-title span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 22px;
    border-radius: 7px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-color);
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.info-collect-step-title label,
.info-collect-step-title div {
    margin: 0;
}

.info-collect-query-mode-panel[hidden] {
    display: none !important;
}

.info-collect-query-mode-panel + .info-collect-query-mode-panel {
    margin-top: 14px;
}

#info-collect-syntax-panel.is-generated-target {
    padding-top: 12px;
    border-top: 1px dashed color-mix(in srgb, var(--border-color) 76%, var(--text-secondary));
}

html[data-theme="dark"] #info-collect-syntax-panel.is-generated-target {
    border-top-color: color-mix(in srgb, var(--border-color) 58%, var(--accent-color));
}

.info-collect-inner-label {
    display: block;
    margin: 0 0 8px;
    color: var(--text-primary);
    font-weight: 650;
}

.info-collect-provider-select .settings-custom-select-trigger {
    min-height: 46px;
    border-radius: 8px;
    background: var(--bg-primary);
    font-weight: 650;
}

.info-collect-provider-select .settings-custom-select-menu {
    z-index: 3200;
    border-radius: 10px;
}

.info-collect-provider-select .settings-custom-select-option {
    min-height: 36px;
}

/* 覆盖全局 .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);
}

.info-collect-nl-row,
.info-collect-query-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.info-collect-nl-row .info-collect-query-input,
.info-collect-query-row .info-collect-query-input {
    flex: 1 1 auto;
    min-width: 0; /* 允许在 flex 中收缩，避免撑破布局 */
}

.info-collect-nl-row button,
.info-collect-query-row button {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 42px;
    padding-inline: 18px;
}

@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 {
    display: grid;
    grid-template-columns: minmax(160px, 0.7fr) minmax(160px, 0.7fr) minmax(150px, 0.45fr) minmax(280px, 1fr);
    gap: 12px;
    align-items: center;
}

.info-collect-form-row .form-group {
    min-width: 0;
}

.info-collect-form-row #info-collect-full-option {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-self: stretch;
}

.info-collect-form-row #info-collect-full-option::before {
    content: '';
    display: block;
    height: 17px;
    margin-bottom: 8px;
}

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

.info-collect-row-hint {
    grid-column: auto;
    align-self: end;
    margin-bottom: 9px;
}

.info-collect-results {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.info-collect-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.info-collect-results-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 240px;
}

.info-collect-results-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.info-collect-selected {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-secondary);
    margin-right: 4px;
}

.info-collect-results-title {
    font-weight: 600;
    color: var(--text-primary);
}

.info-collect-results-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.info-collect-results-table-wrap {
    --table-scroll-header-height: 41px;
    overflow: auto;
    max-height: 60vh;
    position: relative;
    scrollbar-gutter: stable;
    background: var(--bg-primary);
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--text-muted, #94a3b8) 52%, transparent) var(--bg-primary);
}

.info-collect-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    table-layout: fixed;
}

.info-collect-table th,
.info-collect-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-collect-table th + th,
.info-collect-table td + td {
    border-left: 1px solid rgba(0, 0, 0, 0.04);
}

.info-collect-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    z-index: 1;
}

.info-collect-table tbody tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.012);
}

.info-collect-table tbody tr:hover td {
    background: rgba(0, 102, 255, 0.04);
}

.info-collect-table .muted {
    color: var(--text-secondary);
}

/* 操作列：放到最右侧并固定，避免横向滚动找不到 */
.info-collect-col-actions {
    width: 150px;
    text-align: left;
}

.info-collect-table thead th.info-collect-col-actions,
.info-collect-table tbody td.info-collect-col-actions {
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
}

.info-collect-table thead th.info-collect-col-actions {
    background: var(--bg-secondary);
    z-index: 3;
    text-align: center; /* 表头“操作”居中 */
}

.info-collect-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-start; /* 按钮向左 */
}

.info-collect-actions .btn-icon {
    padding: 6px;
    border-radius: 8px;
}

.info-collect-presets {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.info-collect-syntax-guide {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--border-color) 82%, var(--accent-color));
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-secondary) 86%, var(--accent-color) 5%);
}

.info-collect-syntax-guide.is-expanded {
    padding: 12px;
}

.syntax-guide-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.info-collect-syntax-guide.is-expanded .syntax-guide-header {
    margin-bottom: 10px;
}

.syntax-guide-summary {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    line-height: 1.55;
}

.syntax-guide-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.info-collect-doc-link {
    color: var(--accent-color);
    font-size: 0.8125rem;
    text-decoration: none;
    border-bottom: 1px dashed color-mix(in srgb, var(--accent-color) 52%, transparent);
}

.info-collect-doc-link:hover {
    border-bottom-color: var(--accent-color);
}

.syntax-guide-toggle {
    border: 1px solid color-mix(in srgb, var(--border-color) 70%, var(--accent-color));
    border-radius: 7px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 5px 9px;
    font-size: 0.8125rem;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
}

.syntax-guide-toggle:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 8%, var(--bg-primary));
}

.syntax-guide-section + .syntax-guide-section {
    margin-top: 10px;
}

.syntax-guide-title {
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 650;
}

.syntax-guide-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.syntax-example-chip {
    max-width: 100%;
    border: 1px solid color-mix(in srgb, var(--border-color) 78%, var(--text-secondary));
    border-radius: 7px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 6px 8px;
    font-family: var(--font-mono, "SFMono-Regular", Consolas, "Liberation Mono", monospace);
    font-size: 0.75rem;
    line-height: 1.25;
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.syntax-example-chip:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 8%, var(--bg-primary));
}

.info-collect-query-input {
    min-height: 40px;
    max-height: 110px;
    line-height: 1.45;
    overflow: hidden; /* 配合 JS 自动增高 */
    resize: none;
}

.preset-chip {
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.8125rem;
    line-height: 1;
    transition: all 0.15s ease;
}

.preset-chip:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(0, 102, 255, 0.06);
}

.info-collect-link {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px dashed rgba(0, 102, 255, 0.35);
}

.info-collect-link:hover {
    border-bottom-color: rgba(0, 102, 255, 0.75);
}

/* 勾选列（左侧固定） */
.info-collect-col-select {
    width: 44px;
    text-align: center;
}

.info-collect-col-select .theme-checkbox {
    --theme-checkbox-size: 16px;
}

.info-collect-table thead th.info-collect-col-select,
.info-collect-table tbody td.info-collect-col-select {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
}

.info-collect-table thead th.info-collect-col-select {
    background: var(--bg-secondary);
    z-index: 4;
}

/* 单元格点击展开提示（非强制） */
.info-collect-cell {
    cursor: pointer;
}

.info-collect-cell-text {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

/* 字段显示/隐藏面板 */
.info-collect-columns-panel {
    position: sticky;
    top: 0;
    z-index: 6;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
}

.info-collect-columns-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.info-collect-columns-title {
    font-weight: 600;
    color: var(--text-primary);
}

.info-collect-columns-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.info-collect-columns-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 8px;
}

.info-collect-col-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    cursor: pointer;
    user-select: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    overflow: hidden;
}

.info-collect-col-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 单元格详情弹窗 */
.info-collect-cell-modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 32px;
}

.info-collect-cell-modal-content {
    width: min(760px, 100%);
    max-height: min(78vh, 720px);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 24px 70px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.info-collect-cell-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--border-color);
}

.info-collect-cell-modal-heading {
    min-width: 0;
}

.info-collect-cell-modal-title {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1rem;
    line-height: 1.4;
}

.info-collect-cell-modal-subtitle {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.info-collect-cell-modal-header .btn-icon {
    flex: 0 0 auto;
}

.info-collect-cell-modal-body {
    padding: 18px 20px;
    overflow: auto;
    min-height: 112px;
}

.info-collect-cell-modal-pre {
    margin: 0;
    min-height: 64px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-primary);
    user-select: text;
}

.info-collect-cell-modal-footer {
    padding: 14px 20px 18px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    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-parse-modal-body {
    padding: 18px 28px;
    overflow: auto;
}

.info-collect-parse-form-group {
    margin-top: 14px;
}

.info-collect-parse-nl-text {
    margin-top: 6px;
    white-space: pre-wrap;
}

.info-collect-parse-warnings {
    background: #fff8e1;
    border: 1px solid #ffe8a3;
    border-radius: 10px;
    padding: 10px 12px;
    color: #92400e;
    font-size: 0.875rem;
    line-height: 1.5;
}

.info-collect-parse-warnings-list {
    margin: 8px 0 0 18px;
}

.info-collect-parse-warnings-empty {
    margin-top: 8px;
}

.info-collect-parse-explanation {
    margin-top: 8px;
    white-space: pre-wrap;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-primary);
}

.info-collect-parse-modal-footer {
    padding: 18px 28px;
}

.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:
        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-filters {
    margin-bottom: 16px;
}

.chat-files-source-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 6px;
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.08);
    color: #4f46e5;
    font-size: 0.72rem;
    line-height: 1;
    vertical-align: middle;
}

.chat-files-filter-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;
}

.chat-files-filters .chat-files-filter-select-ui {
    position: relative;
    min-width: 168px;
}

.chat-files-filter-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.25;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-files-filter-select-trigger:hover:not(:disabled) {
    border-color: var(--accent-color);
}

.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-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.chat-files-filter-select-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
}

.chat-files-filter-select-ui.open .chat-files-filter-select-caret {
    transform: rotate(180deg);
}

.chat-files-filter-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.chat-files-filter-select-ui.open .chat-files-filter-select-dropdown {
    display: block;
}

.chat-files-filter-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.chat-files-filter-select-option:hover {
    background: var(--bg-secondary);
}

.chat-files-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}

.chat-files-filter-select-check {
    width: 14px;
    flex-shrink: 0;
    visibility: hidden;
    color: #2563eb;
    font-size: 12px;
    line-height: 1;
}

.chat-files-filter-select-option.is-selected .chat-files-filter-select-check {
    visibility: visible;
}

.chat-files-filter-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-files-table-wrap {
    overflow-x: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.chat-files-pagination {
    margin-top: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.chat-files-pagination[hidden] {
    display: none;
}

.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-table-wrap.chat-files-table-wrap--grouped {
    border: none;
    background: transparent;
    overflow: visible;
}

/* GitHub 式：单表 + 首列缩进，无嵌套子表、无重复表头 */
.chat-files-table-wrap.chat-files-table-wrap--tree {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    overflow-x: auto;
}

.chat-files-browse-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.chat-files-browse-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary, #f8f9fa);
}

.chat-files-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 2px;
    font-size: 0.8125rem;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}

.chat-files-breadcrumb-link {
    border: none;
    background: none;
    padding: 2px 4px;
    margin: 0;
    font: inherit;
    color: var(--accent-color);
    cursor: pointer;
    border-radius: 4px;
    max-width: 100%;
    text-align: left;
    word-break: break-all;
}

.chat-files-breadcrumb-link:hover {
    text-decoration: underline;
}

.chat-files-breadcrumb-sep {
    color: var(--text-secondary);
    user-select: none;
    padding: 0 2px;
}

.chat-files-breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    word-break: break-all;
}

.chat-files-browse-up {
    flex-shrink: 0;
}

.chat-files-browse-up:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.chat-files-tr-folder--nav {
    cursor: pointer;
}

.chat-files-tr-folder--nav:hover {
    background: rgba(0, 102, 255, 0.06);
}

.chat-files-folder-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px 12px !important;
}

.chat-files-table--tree-flat {
    font-size: 0.8125rem;
}

.chat-files-table--tree-flat thead th {
    background: var(--bg-secondary, #f8f9fa);
}

.chat-files-table--tree-flat .chat-files-tr-folder {
    background: var(--bg-primary);
}

.chat-files-table--tree-flat .chat-files-tr-folder .chat-files-tree-name-cell--folder {
    font-weight: 600;
    color: var(--text-primary);
}

.chat-files-table--tree-flat .chat-files-tr-file:hover {
    background: rgba(128, 128, 128, 0.04);
}

.chat-files-tree-icon {
    flex-shrink: 0;
    color: var(--accent-color);
    opacity: 1;
}

.chat-files-tree-icon path {
    fill: var(--bg-primary);
    stroke: var(--accent-color);
}

.chat-files-tree-file-icon {
    flex-shrink: 0;
    color: var(--text-secondary);
    opacity: 0.85;
}

.chat-files-tree-name-cell {
    max-width: min(100%, 560px);
    vertical-align: middle;
}

.chat-files-tree-name-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.chat-files-tree-name-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    word-break: break-all;
    line-height: 1.35;
}

.chat-files-tree-muted {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.chat-files-path-breadcrumb {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 2px;
    line-height: 1.45;
    max-width: 100%;
}

.chat-files-path-sep {
    color: var(--text-secondary);
    font-weight: 500;
    user-select: none;
    padding: 0 2px;
}

.chat-files-path-crumb {
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
}

.chat-files-path-root {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.chat-files-grouped {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-files-group {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    overflow: hidden;
}

.chat-files-group > summary.chat-files-group-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-secondary, #f8f9fa);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    user-select: none;
}

.chat-files-group > summary.chat-files-group-summary::-webkit-details-marker {
    display: none;
}

.chat-files-group > summary.chat-files-group-summary::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-secondary);
    margin-right: 2px;
    transform: rotate(-90deg);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.chat-files-group[open] > summary.chat-files-group-summary::before {
    transform: rotate(0deg);
}

.chat-files-group-title {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
}

.chat-files-group-count {
    flex-shrink: 0;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.chat-files-group-body {
    overflow-x: auto;
    border-top: 1px solid var(--border-color);
}

.chat-files-group-body .chat-files-table {
    border-radius: 0;
}

.chat-files-group-body .chat-files-table th {
    background: var(--bg-primary);
}

.chat-files-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.chat-files-table th,
.chat-files-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
}

.chat-files-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary, #f8f9fa);
}

.chat-files-table tr:last-child td {
    border-bottom: none;
}

.chat-files-cell-name {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-files-cell-conv code {
    font-size: 0.8rem;
    max-width: 160px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.chat-files-cell-subpath {
    max-width: 280px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    vertical-align: middle;
}

.chat-files-group-title--folder {
    white-space: normal;
    word-break: break-all;
    line-height: 1.35;
}

.chat-files-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
    overflow: visible;
    position: relative;
    vertical-align: middle;
}

.chat-files-action-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
}

.chat-files-action-bar .btn-icon {
    min-width: 34px;
    min-height: 34px;
    padding: 6px;
    flex-shrink: 0;
}

.chat-files-dropdown-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.chat-files-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 220px;
    padding: 8px 0;
    margin: 0;
    list-style: none;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 400;
}

/* JS 使用 fixed 定位时覆盖 absolute，避免被表格区域 overflow 裁切 */
.chat-files-dropdown.chat-files-dropdown-fixed {
    position: fixed;
    right: auto;
}

.chat-files-dropdown-item {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 10px 16px;
    box-sizing: border-box;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

button.chat-files-dropdown-item:hover:not(:disabled) {
    background: var(--bg-secondary);
}

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

.chat-files-no-edit {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: help;
    user-select: none;
    padding: 0 4px;
}

.chat-files-modal-path {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    word-break: break-all;
}

.chat-files-edit-textarea {
    width: 100%;
    min-height: 240px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.45;
}

.chat-files-rename-label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* 文件管理：重命名 / 新建文件夹 — 紧凑表单弹窗，无全局紫色标题条 */
/* display 由 .modal（默认 none）与 openAppModal 内联 flex 控制，勿在此写 display:flex */
.modal.chat-files-form-modal {
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.chat-files-form-modal-content {
    width: 100%;
    max-width: 420px;
    margin: 0;
    border-radius: 12px;
    box-shadow:
        0 16px 48px rgba(15, 23, 42, 0.14),
        0 4px 12px rgba(15, 23, 42, 0.06);
}

.chat-files-form-modal-header {
    padding: 18px 24px !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: var(--bg-primary) !important;
}

.chat-files-form-modal-header::after {
    display: none !important;
}

.chat-files-form-modal-header h2 {
    font-size: 1.0625rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    background-clip: unset !important;
    letter-spacing: -0.02em !important;
}

.chat-files-form-modal-header h2::before {
    display: none !important;
}

/* 新建文件夹弹窗：层次清晰、留白舒适，无强装饰 */
.chat-files-mkdir-modal-content {
    max-width: 420px;
}

.chat-files-mkdir-body {
    padding: 26px 28px 28px;
}

.chat-files-mkdir-location {
    margin: 0 0 22px;
}

.chat-files-mkdir-location-caption {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.chat-files-mkdir-path-box {
    padding: 11px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.chat-files-mkdir-path {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--text-primary);
    word-break: break-all;
    background: transparent;
    border: none;
}

.chat-files-mkdir-label {
    gap: 10px;
}

.chat-files-mkdir-field-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.chat-files-mkdir-field-icon {
    flex-shrink: 0;
    color: var(--text-secondary);
    opacity: 0.9;
}

.chat-files-mkdir-input {
    min-height: 40px;
    padding: 9px 12px;
    font-size: 0.875rem;
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-files-mkdir-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.14);
}

.chat-files-mkdir-footer {
    padding: 18px 28px 22px;
    gap: 12px;
}

/* 全局 Toast 须高于模态遮罩 (10050) */
#toast-notification-container {
    z-index: 10100 !important;
}

.chat-files-toast {
    position: fixed;
    z-index: 10100;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    max-width: min(520px, calc(100vw - 32px));
    padding: 12px 18px;
    background: #111827;
    color: #f1f5f9;
    border: 1px solid #334155;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.45;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    text-align: center;
}

.chat-files-toast.chat-files-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.chat-files-toast.chat-toast--error {
    background: #b91c1c;
    color: #fff;
    border-color: #991b1b;
}

html[data-theme="dark"] .chat-files-toast {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .chat-files-toast.chat-toast--error {
    background: #991b1b;
    color: #fecaca;
    border-color: #b91c1c;
}

/* 对话附件读取 / 文件管理上传 进度条 */
/* [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-row--files {
    margin-top: 12px;
    margin-bottom: 0;
}

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

/* 微信 iLink 机器人 */
.robot-wechat-card {
    margin-bottom: 28px;
    padding: 20px 22px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: linear-gradient(145deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    box-shadow: var(--shadow-sm);
}

.robot-wechat-card h4 {
    margin: 0;
    font-size: 1.05rem;
}

.robot-wechat-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.robot-wechat-header-text {
    flex: 1;
    min-width: 0;
}

.robot-wechat-subtitle {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.robot-wechat-badge {
    flex-shrink: 0;
    align-self: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.robot-wechat-badge--idle {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.robot-wechat-badge--bound {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.35);
}

.robot-wechat-badge--scanning {
    background: rgba(0, 102, 255, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(0, 102, 255, 0.25);
}

.robot-wechat-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.robot-wechat-toolbar {
    margin-bottom: 14px;
}

.robot-wechat-action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-bottom: 4px;
}

.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-hint {
    margin: 0;
    flex: 1;
    min-width: 200px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.robot-wechat-card.is-bound .robot-wechat-hint {
    display: none;
}

.robot-wechat-bound-flash {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.35);
    color: var(--success-color);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.robot-wechat-bound-flash[hidden] {
    display: none !important;
}

.robot-wechat-bound-flash.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.robot-wechat-bound-flash-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.robot-wechat-bound-summary {
    margin: 10px 0 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.robot-wechat-bound-summary code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    word-break: break-all;
}

.robot-wechat-panel {
    margin-top: 16px;
    padding: 20px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
}

.robot-wechat-bound-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 8px;
    gap: 10px;
}

/* display:flex 会覆盖 [hidden] 默认 display:none，须显式隐藏 */
.robot-wechat-bound-panel[hidden] {
    display: none !important;
}

.robot-wechat-bound-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(40, 167, 69, 0.12);
    color: var(--success-color);
}

.robot-wechat-bound-msg {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--success-color);
}

.robot-wechat-bound-id {
    margin: 0;
    max-width: 100%;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    word-break: break-all;
}

.robot-wechat-scan-panel {
    text-align: center;
}

.robot-wechat-steps {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.robot-wechat-step {
    position: relative;
    padding: 0 14px;
    white-space: nowrap;
}

.robot-wechat-step:not(:last-child)::after {
    content: '›';
    position: absolute;
    right: -2px;
    color: var(--border-color);
    font-weight: 600;
}

.robot-wechat-step.is-active {
    color: var(--accent-color);
    font-weight: 600;
}

.robot-wechat-step.is-done {
    color: var(--success-color);
}

.robot-wechat-qr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.robot-wechat-qr-loading[hidden] {
    display: none !important;
}

.robot-wechat-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: robot-wechat-spin 0.75s linear infinite;
}

@keyframes robot-wechat-spin {
    to { transform: rotate(360deg); }
}

.robot-wechat-qr-frame {
    position: relative;
    display: inline-block;
    margin: 0 auto 12px;
    padding: 14px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.robot-wechat-qr-frame::before,
.robot-wechat-qr-frame::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid var(--accent-color);
    opacity: 0.5;
    pointer-events: none;
}

.robot-wechat-qr-frame::before {
    top: 6px;
    left: 6px;
    border-right: none;
    border-bottom: none;
    border-radius: 4px 0 0 0;
}

.robot-wechat-qr-frame::after {
    bottom: 6px;
    right: 6px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 4px 0;
}

.robot-wechat-qr-img {
    display: block;
    width: 200px;
    height: 200px;
    border-radius: 4px;
}

.robot-wechat-qr-img[hidden] {
    display: none;
}

.robot-wechat-qr-placeholder {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.robot-wechat-qr-placeholder[hidden] {
    display: none !important;
}

.robot-wechat-qr-fallback {
    margin: 0 0 8px;
    font-size: 0.8125rem;
}

.robot-wechat-qr-fallback a {
    color: var(--accent-color);
    text-decoration: none;
}

.robot-wechat-qr-fallback a:hover {
    text-decoration: underline;
}

.robot-wechat-qr-status {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.robot-wechat-qr-status.is-success {
    color: var(--accent-color);
    font-weight: 500;
}

.robot-wechat-qr-status.is-error {
    color: var(--error-color);
}

.robot-wechat-verify-wrap {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: left;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.robot-wechat-verify-wrap[hidden] {
    display: none !important;
}

.robot-wechat-verify-wrap label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.robot-wechat-verify-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.robot-wechat-verify-row input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.125rem;
    letter-spacing: 0.2em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.robot-wechat-advanced {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.robot-wechat-advanced summary {
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    user-select: none;
}

.robot-wechat-advanced[open] summary {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.settings-collapsible {
    margin-top: 12px;
}

.settings-collapsible summary {
    cursor: pointer;
    color: var(--text-muted, #8b9cb3);
    font-size: 13px;
    user-select: none;
}

.settings-collapsible[open] summary {
    margin-bottom: 12px;
}

/* 通用数据表格（项目管理等） */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}
.data-table thead th {
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0.02em;
    color: var(--text-secondary, #64748b);
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    white-space: nowrap;
}
.data-table thead th:first-child {
    border-top-left-radius: 10px;
}
.data-table thead th:last-child {
    border-top-right-radius: 10px;
}
.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color, #eef2f7);
    color: var(--text-primary, #1e293b);
    vertical-align: middle;
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}
.data-table tbody tr:hover td {
    background: #f8fafc;
}
.data-table tbody tr.is-empty-row td {
    text-align: center;
    color: var(--text-muted, #94a3b8);
    padding: 32px 14px;
    font-size: 0.875rem;
}
.data-table tbody tr.is-empty-row:hover td {
    background: transparent;
}
.data-table .col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}
.data-table code {
    font-size: 0.8125rem;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}
.data-table .cell-summary {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 项目管理 */
#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-card {
    width: clamp(200px, 15vw, 236px);
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    min-height: 420px;
}
.projects-sidebar-head,
.projects-sidebar-search {
    flex-shrink: 0;
}
.projects-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eef2f7;
    background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
}
.projects-sidebar-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
}
.projects-sidebar-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: #0066ff;
    background: rgba(0, 102, 255, 0.1);
    padding: 2px 8px;
    border-radius: 999px;
}
.projects-sidebar-search {
    padding: 8px 10px 4px;
    border-bottom: 1px solid #f1f5f9;
}
.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);
}
.projects-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px 10px;
    min-height: 0;
}
.sidebar-list-pagination {
    flex-shrink: 0;
    border-top: 1px solid #eef2f7;
    background: #fafbfc;
    padding: 6px 8px;
    margin-top: 4px;
}
.sidebar-list-pagination-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
}
.sidebar-list-pagination-inner--compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 4px 6px;
    flex-wrap: nowrap;
}
.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;
}
.sidebar-list-pagination .btn-compact {
    font-size: 0.75rem;
    padding: 4px 8px;
    min-height: 0;
    line-height: 1.2;
}
.sidebar-list-pagination .btn-icon-pagination {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: var(--text-secondary, #64748b);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}
.sidebar-list-pagination .btn-icon-pagination:hover:not(:disabled) {
    border-color: #0066ff;
    color: #0066ff;
}
.sidebar-list-pagination .btn-icon-pagination:disabled {
    opacity: 0.35;
    cursor: default;
}
.recent-conversations-section {
    display: flex;
    flex-direction: column;
}
.conversation-sidebar-pagination {
    flex-shrink: 0;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: #fff;
    padding: 8px 10px;
}
.projects-sidebar-pagination {
    margin-top: auto;
    flex-shrink: 0;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: #fff;
    padding: 8px 10px;
}
.conversation-sidebar.collapsed .conversation-sidebar-pagination {
    display: none;
}
.projects-list-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 8px 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    margin-bottom: 2px;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.projects-list-item::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 3px;
    background: transparent;
    transition: background 0.15s;
}
.projects-list-item:hover {
    background: #f8fafc;
}
.projects-list-item.is-active {
    background: #eff6ff;
    border-color: #bfdbfe;
}
.projects-list-item.is-active::before {
    background: #0066ff;
}
.projects-list-item.is-archived .projects-list-item-name {
    color: #94a3b8;
}
.projects-list-item-body {
    flex: 1;
    min-width: 0;
}
.projects-list-item-menu {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.projects-list-item:hover .projects-list-item-menu,
.projects-list-item.is-active .projects-list-item-menu {
    opacity: 0.75;
}
.projects-list-item-menu:hover,
.projects-list-item-menu:focus-visible {
    opacity: 1;
    background: #e2e8f0;
    color: var(--text-primary, #0f172a);
    outline: none;
}
.projects-list-item.is-active .projects-list-item-menu:hover,
.projects-list-item.is-active .projects-list-item-menu:focus-visible {
    background: #dbeafe;
}
.projects-list-item-name {
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.projects-list-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
}
.projects-list-item-badge {
    font-size: 0.6875rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
    margin-left: 4px;
}
.projects-detail {
    flex: 1;
    min-width: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-height: 420px;
}
/* display:flex 会覆盖 [hidden]，须显式隐藏 */
.projects-detail-placeholder[hidden],
.projects-detail-inner[hidden] {
    display: none !important;
}
.projects-detail.has-project .projects-detail-placeholder {
    display: none !important;
}
.projects-detail:not(.has-project) .projects-detail-inner {
    display: none !important;
}
.projects-detail-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 32px;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    min-height: 420px;
}
.projects-placeholder-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    margin-bottom: 20px;
    color: #3b82f6;
    background: linear-gradient(145deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    border-radius: 22px;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12);
}
.projects-detail-placeholder h3 {
    margin: 0 0 8px;
    font-size: 1.125rem;
    color: var(--text-primary, #0f172a);
}
.projects-detail-placeholder p {
    margin: 0 0 24px;
    max-width: 400px;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary, #64748b);
}
.projects-detail-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    min-height: 0;
    align-self: stretch;
}
.projects-detail-header {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 24px 14px;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
}
.projects-detail-header-main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.projects-detail-headline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
    min-width: 0;
}
.projects-detail-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: min(560px, 100%);
}
.projects-detail-title {
    margin: 0;
    min-width: 0;
    font-size: 1.375rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.projects-status-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    line-height: 1.2;
    border: 1px solid transparent;
}
.projects-status-pill--active {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}
.projects-status-pill--archived {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}
.projects-detail-meta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    margin: 0;
    padding: 5px 10px;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.2;
    white-space: nowrap;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e8edf3;
    font-variant-numeric: tabular-nums;
}
.projects-detail-meta-icon {
    flex-shrink: 0;
    opacity: 0.65;
}
.projects-detail-meta-time {
    font-weight: 500;
    color: #64748b;
}
.projects-detail-desc {
    margin: 0;
    max-width: min(640px, 100%);
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.55;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}
.projects-description-textarea {
    max-height: 200px;
    resize: vertical;
    overflow-y: auto;
}
.projects-detail-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding-left: 12px;
    border-left: 1px solid #e2e8f0;
}
.projects-stat-chip {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.projects-stat-chip--facts {
    color: #1d4ed8;
    background: #dbeafe;
    border-color: #93c5fd;
}
.projects-stat-chip--vulns {
    color: #c2410c;
    background: #ffedd5;
    border-color: #fdba74;
}
.projects-stat-chip--conversations {
    color: #6d28d9;
    background: #ede9fe;
    border-color: #c4b5fd;
}
.projects-stat-chip--warn {
    color: #92400e;
    background: #fef3c7;
    border-color: #fcd34d;
}
.projects-detail-header-actions {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    align-self: center;
}
@media (max-width: 860px) {
    .projects-detail-header {
        flex-direction: column;
        align-items: stretch;
    }
    .projects-detail-header-actions {
        align-self: stretch;
        margin-top: 0;
    }
    .projects-detail-stats {
        padding-left: 0;
        border-left: none;
    }
}
.projects-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
}
.projects-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.projects-tab:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.7);
}
.projects-tab.is-active {
    color: #0066ff;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    font-weight: 600;
}
.projects-panel {
    flex: 1;
    padding: 16px 24px 24px;
    overflow: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.projects-panel--settings {
    overflow: hidden;
    padding: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    background: #fff;
}
/* display:flex 会覆盖 [hidden] 默认 display:none，非激活 Tab 会叠在事实黑板下方 */
.projects-panel[hidden] {
    display: none !important;
}
.projects-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
}
/* —— 事实黑板：说明 + 筛选工具栏 —— */
.projects-fact-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.projects-fact-toolbar-hint {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    margin: 0;
    padding: 8px 10px;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #475569;
    background: #f0f7ff;
    border: 1px solid #dbeafe;
    border-radius: 8px;
}
.projects-fact-toolbar-hint-icon {
    flex-shrink: 0;
    margin-top: 2px;
    color: #3b82f6;
}
.projects-fact-toolbar-hint strong {
    font-weight: 600;
    color: #334155;
}
.projects-fact-toolbar-hint code {
    padding: 1px 5px;
    font-size: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: #1d4ed8;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #bfdbfe;
    border-radius: 4px;
}
.projects-fact-toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}
.projects-fact-filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    min-width: 0;
}
.projects-fact-filter-field--search {
    flex: 1 1 200px;
    min-width: 160px;
    max-width: 360px;
    position: relative;
}
.projects-fact-filter-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #94a3b8;
    line-height: 1.2;
}
.projects-fact-filter-field input,
.projects-fact-filter-field select {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    font-size: 0.8125rem;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

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

.projects-fact-filter-field .projects-filter-select-ui {
    width: 100%;
    min-width: 120px;
}

.projects-filter-select-ui {
    position: relative;
    width: 100%;
    min-width: 0;
}

.projects-filter-select-ui--compact {
    display: inline-flex;
    min-width: 64px;
}

.projects-filter-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: var(--bg-primary, #f8fafc);
    color: var(--text-primary, #0f172a);
    font-size: 0.8125rem;
    line-height: 1.25;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.projects-settings-card .projects-filter-select-trigger {
    height: 38px;
    font-size: 0.875rem;
}

.projects-filter-select-trigger:hover:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.45);
}

.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-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.projects-filter-select-caret {
    flex-shrink: 0;
    color: var(--text-secondary, #94a3b8);
    transition: transform 0.15s ease;
}

.projects-filter-select-ui.open .projects-filter-select-caret {
    transform: rotate(180deg);
}

.projects-filter-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
}

.projects-filter-select-ui.open .projects-filter-select-dropdown {
    display: block;
}

.projects-filter-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary, #0f172a);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.projects-filter-select-option:hover {
    background: var(--bg-secondary, #f1f5f9);
}

.projects-filter-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}

.projects-filter-select-check {
    width: 14px;
    flex-shrink: 0;
    visibility: hidden;
    color: #2563eb;
    font-size: 12px;
    line-height: 1;
}

.projects-filter-select-option.is-selected .projects-filter-select-check {
    visibility: visible;
}

.projects-filter-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.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;
}
.projects-fact-filter-field--search input {
    padding-left: 34px;
    background: #fff;
}
.projects-fact-search-icon {
    position: absolute;
    left: 10px;
    bottom: 9px;
    color: #94a3b8;
    pointer-events: none;
}
.projects-fact-filter-field input:focus,
.projects-fact-filter-field select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
    background: #fff;
}
.projects-fact-filter-field select {
    min-width: 108px;
    cursor: pointer;
}
.projects-fact-filter-toggles {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding-bottom: 1px;
}
.projects-fact-toggle {
    display: inline-flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
    user-select: none;
}
.projects-fact-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.projects-fact-toggle span {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.projects-fact-toggle:hover span {
    border-color: #cbd5e1;
    color: #475569;
}
.projects-fact-toggle input:focus-visible + span {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}
.projects-fact-toggle input:checked + span {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #93c5fd;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}
@media (max-width: 720px) {
    .projects-fact-filter-field--search {
        flex: 1 1 100%;
        max-width: none;
    }
    .projects-fact-filter-toggles {
        width: 100%;
    }
}
.projects-filter-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: #475569;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.projects-pin-toggle {
    margin-top: 4px;
}
.projects-panel-hint {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.45;
}
.projects-table-wrap {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
#project-panel-facts,
#project-panel-assets,
#project-panel-conversations,
#project-panel-vulns {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
#project-panel-facts .projects-fact-toolbar,
#project-panel-vulns .projects-fact-toolbar,
#project-panel-assets .projects-panel-toolbar,
#project-panel-conversations .projects-panel-toolbar {
    flex: 0 0 auto;
}
#project-panel-facts .projects-table-wrap,
#project-panel-assets .projects-table-wrap,
#project-panel-conversations .projects-table-wrap,
#project-panel-vulns .projects-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.projects-panel-pagination {
    flex: 0 0 auto;
    border-top: 0;
    border-radius: 0 0 12px 12px;
}
#project-panel-assets .projects-table-wrap--with-pagination {
    border-radius: 12px 12px 0 0;
}
#project-panel-assets .projects-panel-pagination.pagination-fixed {
    border-color: var(--border-color, #e2e8f0);
    border-top: 0;
    box-shadow: none;
}
#project-panel-assets .projects-panel-pagination.pagination-fixed .pagination {
    border-top: 1px solid var(--border-color, #e2e8f0);
    border-radius: 0 0 12px 12px;
}
#project-panel-conversations .projects-table-wrap,
#project-panel-assets .projects-table-wrap,
#project-panel-vulns .projects-table-wrap {
    overflow-x: hidden;
}
#project-panel-assets .projects-table-wrap {
    overflow: hidden;
}
#project-panel-assets .data-table--projects {
    display: flex;
    height: 100%;
    flex-direction: column;
}
#project-panel-assets .data-table--projects thead {
    display: block;
    flex: 0 0 auto;
}
#project-panel-assets .data-table--projects tbody {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--text-muted, #94a3b8) 52%, transparent) transparent;
}
#project-panel-assets .data-table--projects tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}
#project-panel-assets .data-table--projects tbody::-webkit-scrollbar {
    width: 8px;
}
#project-panel-assets .data-table--projects tbody::-webkit-scrollbar-track {
    background: var(--bg-primary, #fff);
}
#project-panel-assets .data-table--projects tbody::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-muted, #94a3b8) 62%, transparent);
    background-clip: content-box;
}
#project-panel-assets .data-table--projects tbody::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--text-secondary, #64748b) 82%, transparent);
    background-clip: content-box;
}
#project-panel-facts .projects-table-wrap {
    overflow-x: auto;
}
#project-panel-facts .projects-table-wrap .data-table--projects thead th,
#project-panel-conversations .projects-table-wrap .data-table--projects thead th,
#project-panel-vulns .projects-table-wrap .data-table--projects thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 var(--border-color, #e2e8f0);
}
#project-panel-assets .projects-table-wrap .data-table--projects thead th {
    box-shadow: 0 1px 0 var(--border-color, #e2e8f0);
}
.projects-panel-toolbar--hint {
    margin-bottom: 14px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}
.projects-panel-toolbar--hint .projects-fact-toolbar-hint {
    margin: 0;
}
.projects-panel-count { flex-shrink: 0; padding: 4px 9px; border-radius: 999px; color: #2563eb; background: #eff6ff; font-size: .75rem; font-weight: 600; }
html[data-theme="dark"] .projects-panel-count { color: var(--accent-color); background: rgba(96, 165, 250, 0.14); }
.projects-asset-target { display: block; max-width: 100%; padding: 0; border: 0; background: transparent; color: #2563eb; font: inherit; font-weight: 600; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projects-asset-target:hover { text-decoration: underline; }
#project-panel-assets .data-table--projects th:nth-child(1), #project-panel-assets .data-table--projects td:nth-child(1) { width: 24%; }
#project-panel-assets .data-table--projects th:nth-child(2), #project-panel-assets .data-table--projects td:nth-child(2) { width: 12%; }
#project-panel-assets .data-table--projects th:nth-child(3), #project-panel-assets .data-table--projects td:nth-child(3) { width: 22%; }
#project-panel-assets .data-table--projects th:nth-child(4), #project-panel-assets .data-table--projects td:nth-child(4) { width: 10%; }
#project-panel-assets .data-table--projects th:nth-child(5), #project-panel-assets .data-table--projects td:nth-child(5) { width: 16%; }
#project-panel-assets .data-table--projects th:nth-child(6), #project-panel-assets .data-table--projects td:nth-child(6) { width: 8%; }
#project-panel-assets .data-table--projects th:nth-child(7), #project-panel-assets .data-table--projects td:nth-child(7) { width: 8%; }
#project-panel-facts .data-table--projects .cell-fact-key {
    overflow: hidden;
    max-width: 0;
}
#project-panel-facts .data-table--projects .cell-fact-category {
    white-space: nowrap;
}
#project-panel-facts .data-table--projects .cell-summary {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#project-panel-facts .data-table--projects .cell-fact-links {
    text-align: center;
    white-space: nowrap;
}
#project-panel-facts .projects-fact-key-chip {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: top;
    box-sizing: border-box;
}
#project-panel-conversations .data-table--projects th:nth-child(1),
#project-panel-conversations .data-table--projects td:nth-child(1) {
    width: 48%;
}
#project-panel-conversations .data-table--projects th:nth-child(2),
#project-panel-conversations .data-table--projects td:nth-child(2) {
    width: 22%;
}
#project-panel-conversations .data-table--projects th:nth-child(3),
#project-panel-conversations .data-table--projects td:nth-child(3) {
    width: 30%;
}
.projects-vuln-toolbar-filters {
    width: 100%;
}
.projects-vuln-toolbar-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    align-self: flex-end;
    height: 34px;
    padding: 0 14px;
    margin-left: auto;
    max-width: 100%;
    border-radius: 8px;
    white-space: nowrap;
}
@media (max-width: 720px) {
    .projects-vuln-toolbar-action {
        width: auto;
    }
}
#project-panel-vulns .data-table--projects th:nth-child(1),
#project-panel-vulns .data-table--projects td:nth-child(1) {
    width: 46%;
}
#project-panel-vulns .data-table--projects th:nth-child(2),
#project-panel-vulns .data-table--projects td:nth-child(2) {
    width: 14%;
}
#project-panel-vulns .data-table--projects th:nth-child(3),
#project-panel-vulns .data-table--projects td:nth-child(3) {
    width: 14%;
}
#project-panel-vulns .data-table--projects th:nth-child(4),
#project-panel-vulns .data-table--projects td:nth-child(4) {
    width: 26%;
}
.projects-table-wrap .data-table--projects {
    min-width: 0;
    table-layout: fixed;
}
.data-table--projects .col-actions {
    width: auto;
    min-width: 0;
    white-space: normal;
    text-align: left;
}
.data-table--projects thead th.col-actions {
    text-align: left;
}
.projects-table-actions {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
.projects-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.25;
    border-radius: 7px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.projects-action-btn:hover {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.projects-action-btn--edit:hover {
    border-color: #86efac;
    color: #15803d;
    background: #f0fdf4;
}
.projects-action-btn--view:hover {
    border-color: #93c5fd;
    color: #2563eb;
    background: #eff6ff;
}
.projects-action-btn--mute:hover {
    border-color: #fcd34d;
    color: #b45309;
    background: #fffbeb;
}
.projects-action-btn--restore:hover {
    border-color: #86efac;
    color: #15803d;
    background: #f0fdf4;
}
.projects-action-btn--danger {
    color: #dc2626;
    border-color: #fecaca;
    background: #fff;
}
.projects-action-btn--danger:hover {
    border-color: #f87171;
    color: #b91c1c;
    background: #fef2f2;
}
#project-panel-facts .data-table--projects th:nth-child(1),
#project-panel-facts .data-table--projects td:nth-child(1) {
    width: 13%;
}
#project-panel-facts .data-table--projects th:nth-child(2),
#project-panel-facts .data-table--projects td:nth-child(2) {
    width: 7%;
}
#project-panel-facts .data-table--projects th:nth-child(3),
#project-panel-facts .data-table--projects td:nth-child(3) {
    width: 22%;
}
#project-panel-facts .data-table--projects th:nth-child(4),
#project-panel-facts .data-table--projects td:nth-child(4) {
    width: 5%;
}
#project-panel-facts .data-table--projects th:nth-child(5),
#project-panel-facts .data-table--projects td:nth-child(5) {
    width: 8%;
}
#project-panel-facts .data-table--projects th:nth-child(6),
#project-panel-facts .data-table--projects td:nth-child(6) {
    width: 8%;
}
#project-panel-facts .data-table--projects th:nth-child(7),
#project-panel-facts .data-table--projects td:nth-child(7) {
    width: 9%;
}
#project-panel-facts .data-table--projects th.col-actions,
#project-panel-facts .data-table--projects td.col-actions {
    width: 28%;
    min-width: 196px;
    max-width: 240px;
    position: sticky;
    right: 0;
    z-index: 3;
    background: #fff;
    box-shadow: -6px 0 10px rgba(15, 23, 42, 0.05);
}
#project-panel-facts .data-table--projects thead th.col-actions {
    z-index: 6;
    background: #f8fafc;
}
#project-panel-facts .data-table--projects tbody tr:hover td.col-actions {
    background: #f8fafc;
}
#project-panel-facts .data-table--projects .col-actions .projects-table-actions {
    flex-wrap: nowrap;
}

/* 项目事实攻击路径图 */
#project-panel-graph.projects-panel--graph {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding-bottom: 0;
}
#project-panel-graph .projects-graph-toolbar {
    flex: 0 0 auto;
}
#project-panel-graph .project-fact-graph-layout {
    flex: 1 1 0;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}
#project-panel-graph .project-fact-graph-container {
    min-height: 0;
    height: 100%;
}
#project-panel-graph .project-fact-graph-footer {
    flex: 0 0 auto;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
    margin: 0;
    padding: 6px 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}
.projects-graph-toolbar-row {
    align-items: flex-end;
}
.projects-graph-search-field {
    flex: 1 1 180px;
    max-width: 280px;
}
.projects-graph-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 3px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.projects-graph-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 11px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.projects-graph-action-btn svg {
    flex-shrink: 0;
    opacity: 0.75;
}
.projects-graph-action-btn:hover {
    color: #0f172a;
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.projects-graph-action-btn--connect {
    color: #4338ca;
    background: #eef2ff;
    border-color: #c7d2fe;
}
.projects-graph-action-btn--connect:hover,
.projects-graph-action-btn--connect-active {
    color: #fff;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}
.projects-graph-legend {
    display: flex;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 8px 14px;
}
.projects-graph-legend-group {
    display: inline-flex;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px 10px;
}
.projects-graph-legend-heading {
    flex: 0 0 auto;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
    white-space: nowrap;
}
.projects-graph-legend-divider {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: #e2e8f0;
    flex: 0 0 auto;
}
.projects-graph-legend-item {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
}
.projects-graph-legend-item--edge i {
    display: inline-block;
    width: 22px;
    height: 0;
    border-top: 2.5px solid var(--legend-color, #cbd5e1);
    border-radius: 2px;
}
.projects-graph-legend-item--edge.projects-graph-legend-item--dashed i {
    border-top-style: dashed;
    opacity: 0.7;
}
.projects-graph-legend-item--node i {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--legend-color, #cbd5e1);
    border-radius: 4px;
    background: linear-gradient(135deg, #ffffff 0%, var(--legend-bg, #f8fafc) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.projects-graph-legend-item--node-dashed i {
    border-style: dashed;
    opacity: 0.85;
}
.project-fact-graph-layout {
    position: relative;
    display: flex;
    min-height: 0;
    align-items: stretch;
}
.project-fact-graph-container {
    flex: 1 1 auto;
    width: 100%;
    min-height: 240px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    background-color: #f8fafc;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.35) 1px, transparent 0);
    background-size: 20px 20px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 3px rgba(15, 23, 42, 0.04);
}
.project-fact-graph-container::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(241, 245, 249, 0.65) 100%);
    z-index: 1;
}
.project-fact-graph-container .loading-spinner,
.project-fact-graph-container .project-fact-graph-empty,
.project-fact-graph-container .error-message {
    position: relative;
    z-index: 2;
}
.project-fact-graph-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    min-height: 420px;
    padding: 40px 32px;
}
.project-fact-graph-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin-bottom: 18px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}
.project-fact-graph-empty-title {
    margin: 0 0 8px;
    font-size: 1.0625rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.01em;
}
.project-fact-graph-empty-hint {
    margin: 0 0 16px;
    max-width: 420px;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #64748b;
}
.project-fact-graph-empty-steps {
    margin: 0 0 20px;
    padding-left: 1.2rem;
    max-width: 400px;
    text-align: left;
    font-size: 0.8125rem;
    line-height: 1.65;
    color: #475569;
}
.project-fact-graph-empty-steps li {
    margin-bottom: 4px;
}
.project-fact-graph-empty-steps li::marker {
    color: #6366f1;
    font-weight: 600;
}
.project-fact-graph-empty-cta {
    margin-top: 4px;
}
.project-fact-graph-sidebar {
    position: absolute;
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: min(300px, calc(100% - 24px));
    z-index: 12;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
    animation: projectGraphSidebarIn 0.2s ease;
    overflow-x: hidden;
    overflow-y: auto;
}
.project-fact-graph-sidebar[hidden] {
    display: none !important;
}
@keyframes projectGraphSidebarIn {
    from {
        opacity: 0;
        transform: translateX(12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
.project-fact-graph-sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.project-fact-graph-sidebar-title-wrap {
    min-width: 0;
    flex: 1;
}
.project-fact-graph-sidebar-header h4 {
    margin: 4px 0 0;
    font-size: 0.9rem;
    font-weight: 600;
    word-break: break-all;
    color: #0f172a;
    line-height: 1.35;
}
.project-fact-graph-node-category {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}
.project-fact-graph-node-category--target { color: #4338ca; background: #eef2ff; border-color: #c7d2fe; }
.project-fact-graph-node-category--finding { color: #be123c; background: #fff1f2; border-color: #fecdd3; }
.project-fact-graph-node-category--vulnerability { color: #7e22ce; background: #f5f3ff; border-color: #ddd6fe; }
.project-fact-graph-node-category--exploit,
.project-fact-graph-node-category--poc { color: #c2410c; background: #ffedd5; border-color: #fdba74; }
.project-fact-graph-node-category--chain { color: #6d28d9; background: #f5f3ff; border-color: #ddd6fe; }
.project-fact-graph-node-category--auth { color: #0f766e; background: #f0fdfa; border-color: #99f6e4; }
.project-fact-graph-node-category--infra { color: #475569; background: #f1f5f9; border-color: #cbd5e1; }
.project-fact-graph-node-category--business { color: #0369a1; background: #f0f9ff; border-color: #bae6fd; }
.project-fact-graph-node-category--note { color: #64748b; background: #f8fafc; border-color: #e2e8f0; }
.project-fact-graph-node-category--missing { color: #94a3b8; background: #f1f5f9; border-color: #e2e8f0; font-style: italic; }
.project-fact-graph-sidebar-close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.project-fact-graph-sidebar-close:hover {
    color: #0f172a;
    border-color: #cbd5e1;
    background: #f8fafc;
}
.project-fact-graph-node-meta {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: #64748b;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.project-fact-graph-node-summary {
    display: block;
    width: 100%;
    min-width: 0;
    color: #475569;
}
.project-fact-graph-node-vuln-hint {
    display: block;
    width: 100%;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #64748b;
}
.project-fact-graph-edges-wrap {
    flex: 0 0 auto;
    min-height: min-content;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 4px;
    border-top: 1px solid #f1f5f9;
}
.project-fact-graph-edges-title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    letter-spacing: 0.02em;
}
.project-fact-graph-edges-hint {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.45;
    color: #94a3b8;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.project-fact-graph-edges-list {
    flex: 0 1 auto;
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.project-fact-graph-edges-empty {
    margin: 0;
    font-size: 0.8125rem;
    color: #94a3b8;
}
.project-fact-graph-edge-item {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 4px 6px;
    padding: 6px 8px;
    font-size: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.project-fact-graph-edge-item:hover {
    border-color: #cbd5e1;
    background: #fff;
}
.project-fact-graph-edge-item.is-selected {
    border-color: #818cf8;
    background: #eef2ff;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.25);
}
.project-fact-graph-edge-dir {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}
.project-fact-graph-edge-type {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.6875rem;
    color: #4338ca;
    white-space: nowrap;
}
.project-fact-graph-edge-arrow {
    color: #94a3b8;
}
.project-fact-graph-edge-peer {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #334155;
    min-width: 0;
}
.project-fact-graph-edge-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: #fff;
    color: #dc2626;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.project-fact-graph-edge-delete svg {
    display: block;
    flex: 0 0 auto;
    pointer-events: none;
}
.project-fact-graph-edge-delete:hover {
    background: #fef2f2;
    border-color: #f87171;
}
.project-fact-graph-edge-synthetic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    color: #cbd5e1;
    flex-shrink: 0;
}
.projects-incoming-links-readonly {
    margin-top: 4px;
}
.projects-incoming-links-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.projects-incoming-links-item {
    padding: 8px 10px;
    font-size: 0.8125rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    word-break: break-all;
}
.projects-incoming-links-item code {
    font-size: 0.75rem;
}
.projects-incoming-links-empty {
    margin: 0;
    font-size: 0.8125rem;
    color: #94a3b8;
}
.projects-edge-type {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    color: #4338ca;
}
.projects-edge-arrow {
    color: #94a3b8;
}
.project-fact-graph-sidebar-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
    border-top: 1px solid #f1f5f9;
}
.project-fact-graph-footer {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    flex: 0 0 auto;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}
.project-fact-graph-footer::-webkit-scrollbar {
    display: none;
}
.project-fact-graph-stats {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    flex: 0 0 auto;
}
.projects-graph-stat-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
    font-size: 0.8125rem;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
}
.projects-graph-stat-badge strong {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}
#project-panel-graph .projects-fact-toolbar-filters {
    flex-wrap: wrap;
}
.projects-fact-link-badge {
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary, #64748b);
}
.projects-fact-link-badge--empty {
    opacity: 0.45;
}
@media (max-width: 1100px) {
    .project-fact-graph-sidebar {
        width: min(280px, calc(100% - 24px));
    }
    .projects-graph-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
}

@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;
    }
}
@media (max-width: 1680px) {
    #project-panel-facts .data-table--projects th,
    #project-panel-facts .data-table--projects td {
        padding-left: 10px;
        padding-right: 10px;
    }
    #project-panel-facts .data-table--projects th:nth-child(3),
    #project-panel-facts .data-table--projects td:nth-child(3) {
        width: 22%;
    }
    #project-panel-facts .data-table--projects th.col-actions,
    #project-panel-facts .data-table--projects td.col-actions {
        min-width: 188px;
        max-width: 220px;
    }
}
/* —— 项目设置：左右分栏 + 底部危险区，无内层滚动 —— */
.projects-settings-layout {
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    overflow: auto;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
.projects-settings-intro {
    flex-shrink: 0;
    padding: 14px 20px 12px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    background: rgba(255, 255, 255, 0.6);
}
.projects-settings-intro-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
}
.projects-settings-intro-hint {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.5;
}
.projects-settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    grid-template-rows: minmax(min-content, 1fr);
    gap: 14px;
    align-items: stretch;
    padding: 14px 20px;
    flex: 1 1 auto;
    min-height: min-content;
}
.projects-settings-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}
.projects-settings-card--basic {
    min-height: min-content;
}
.projects-settings-card--scope {
    min-height: 0;
}
.projects-settings-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}
.projects-settings-card-head-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}
.projects-settings-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
}
.projects-settings-icon--blue {
    background: #eff6ff;
    color: #2563eb;
}
.projects-settings-icon--violet {
    background: #f5f3ff;
    color: #7c3aed;
}
.projects-settings-icon--red {
    background: #fef2f2;
    color: #dc2626;
}
.projects-settings-card-head .projects-settings-card-title {
    margin: 0;
}
.projects-settings-card-head .projects-settings-card-hint {
    margin: 3px 0 0;
}
.projects-settings-card-body {
    padding: 14px 16px 16px;
}
.projects-settings-card-body--fill {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}
.projects-scope-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.projects-scope-toolbar .btn-ghost {
    border-radius: 8px;
    color: #64748b;
    font-size: 0.75rem;
    padding: 5px 10px;
}
.projects-scope-toolbar .btn-ghost:hover {
    background: #e2e8f0;
    border-color: #e2e8f0;
    color: #0f172a;
}
.projects-scope-editor {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 120px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #1e293b;
    background: #0f172a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.projects-panel--settings .projects-scope-textarea {
    flex: 1 1 auto;
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 132px;
    max-height: none;
    resize: vertical;
    border: none !important;
    border-radius: 0 !important;
    background: #0f172a !important;
    color: #e2e8f0 !important;
    padding: 12px 14px !important;
    font-size: 0.8125rem !important;
    line-height: 1.6 !important;
    box-shadow: none !important;
}
.projects-scope-textarea:focus {
    outline: none;
    box-shadow: none !important;
}
.projects-scope-textarea::placeholder {
    color: #475569;
}
.projects-scope-footnote {
    margin: 0;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.45;
}
.projects-scope-footnote code {
    font-size: 0.6875rem;
    padding: 1px 5px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.projects-status-select-wrap {
    position: relative;
}
.projects-status-select {
    appearance: none;
    padding-right: 32px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}
.projects-settings-card--danger {
    flex-shrink: 0;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    height: auto;
    margin: 0 20px 16px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #fffbfb 0%, #fff 55%);
    border-color: #fecaca;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.06);
}
.projects-settings-danger-main {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.projects-settings-card--danger .projects-settings-icon--red {
    margin-top: 1px;
}
.projects-settings-card--danger .projects-settings-card-title {
    margin: 0 0 6px;
}
.projects-settings-card--danger .projects-settings-card-hint {
    margin: 0;
    max-width: 560px;
    line-height: 1.6;
    color: #64748b;
}
.projects-settings-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.01em;
}
.projects-settings-card-hint {
    font-size: 0.8125rem;
    color: #94a3b8;
    line-height: 1.45;
}
.projects-settings-danger-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    align-self: center;
    padding-top: 2px;
}
.projects-settings-danger-actions .btn-small {
    min-height: 34px;
    padding: 7px 14px;
}
.projects-settings-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    margin: 0;
    border-top: 1px solid #eef2f7;
    background: #fff;
    border-radius: 0 0 14px 14px;
    box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.04);
}
.projects-settings-footer-hint {
    font-size: 0.8125rem;
    color: #94a3b8;
}
.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;
}
.projects-form-row--2 {
    display: grid;
    grid-template-columns: 1fr 168px;
    gap: 16px;
}
.projects-form-field--fill {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0;
}
@media (max-width: 960px) {
    .projects-settings-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        padding: 12px 16px;
    }
    .projects-settings-card {
        height: auto;
    }
    .projects-settings-card--danger {
        flex-direction: column;
        align-items: stretch;
        margin: 0 16px 10px;
        padding: 16px;
    }
    .projects-settings-danger-actions {
        justify-content: flex-end;
    }
    .projects-form-row--2 {
        grid-template-columns: 1fr;
    }
    .projects-settings-footer {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 16px;
    }
    .projects-settings-footer .btn-primary {
        justify-content: center;
        width: 100%;
    }
    .projects-settings-intro {
        padding: 12px 16px 10px;
    }
}
.projects-form-field {
    margin-bottom: 14px;
}
.projects-form-field:last-child {
    margin-bottom: 0;
}
.projects-form-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}
.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);
}
.form-input--mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
}
.projects-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 640px) {
    .projects-form-row {
        grid-template-columns: 1fr;
    }
}
.btn-danger-outline {
    color: #dc2626;
    border-color: #fecaca;
}
.btn-danger-outline:hover {
    background: #fef2f2;
    border-color: #f87171;
}
.projects-empty {
    padding: 24px 12px;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted, #94a3b8);
    line-height: 1.5;
}
.projects-empty-btn {
    margin-top: 12px;
}
.projects-confidence {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: lowercase;
}
.projects-confidence--confirmed {
    background: #dcfce7;
    color: #166534;
}
.projects-confidence--tentative {
    background: #fef3c7;
    color: #92400e;
}
.projects-confidence--deprecated {
    background: #f1f5f9;
    color: #64748b;
}
.projects-category {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: lowercase;
    white-space: nowrap;
}
.projects-category--target {
    background: #dbeafe;
    color: #1e40af;
}
.projects-category--auth {
    background: #ede9fe;
    color: #5b21b6;
}
.projects-category--infra {
    background: #e2e8f0;
    color: #334155;
}
.projects-category--business {
    background: #ccfbf1;
    color: #0f766e;
}
.projects-category--finding {
    background: #ffedd5;
    color: #c2410c;
}
.projects-category--chain {
    background: #fed7aa;
    color: #9a3412;
}
.projects-category--exploit {
    background: #fee2e2;
    color: #991b1b;
}
.projects-category--poc {
    background: #ffe4e6;
    color: #be123c;
}
.projects-category--note {
    background: #f1f5f9;
    color: #64748b;
}
.projects-category--custom {
    background: #e0e7ff;
    color: #4338ca;
}
.projects-severity {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: lowercase;
}
.projects-severity--critical { background: #fee2e2; color: #991b1b; }
.projects-severity--high { background: #ffedd5; color: #9a3412; }
.projects-severity--medium { background: #fef9c3; color: #854d0e; }
.projects-severity--low { background: #dbeafe; color: #1e40af; }
.projects-severity--info { background: #f1f5f9; color: #475569; }
.projects-show-archived-label {
    font-size: 0.8125rem;
    color: var(--text-secondary, #64748b);
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
/* 项目管理弹窗遮罩 */
.modal-overlay.projects-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10050;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.52);
    animation: projectsOverlayIn 0.15s ease-out;
}
@keyframes projectsOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.projects-modal-dialog {
    width: 100%;
    max-width: 480px;
    max-height: min(90vh, 640px);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 16px;
    box-shadow:
        0 24px 48px rgba(15, 23, 42, 0.18),
        0 0 0 1px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    animation: projectsDialogIn 0.18s cubic-bezier(0.22, 1, 0.36, 1);
    contain: layout style paint;
}
.projects-modal-dialog--wide {
    max-width: 640px;
}
@keyframes projectsDialogIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.projects-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid #eef2f7;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    flex-shrink: 0;
}
.projects-modal-header-text {
    min-width: 0;
    flex: 1;
}
.projects-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}
.projects-modal-subtitle {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.45;
    font-weight: 400;
}
.projects-modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.projects-modal-body .projects-form-field {
    margin-bottom: 18px;
}
.projects-modal-body .projects-form-field:last-child {
    margin-bottom: 0;
}
.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-body .projects-form-field label .required {
    color: #dc2626;
    font-weight: 600;
}
.projects-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px 18px;
    border-top: 1px solid #eef2f7;
    background: #fafbfc;
    flex-shrink: 0;
}
.projects-modal-footer .btn-primary {
    min-width: 100px;
}
body.projects-modal-open,
body.app-modal-open {
    overflow: hidden;
}
.fact-detail-prev-wrap {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px dashed #e2e8f0;
}
.fact-detail-prev-title,
.fact-detail-current-title {
    margin: 0 0 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.fact-detail-body--muted {
    opacity: 0.85;
    max-height: 200px;
}
.projects-modal-footer--split {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.projects-modal-footer-left,
.projects-modal-footer-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.vulnerability-related-facts {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8125rem;
}
.vulnerability-related-facts ul {
    margin: 8px 0 0;
    padding-left: 18px;
}
.vulnerability-related-facts li {
    margin: 4px 0;
}
.vulnerability-related-facts a {
    color: #2563eb;
    cursor: pointer;
    text-decoration: underline;
}
.fact-detail-body {
    max-height: 50vh;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.8125rem;
    line-height: 1.55;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    color: #334155;
}
.projects-field-hint {
    margin: 6px 0 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #64748b;
}
.projects-field-hint--warn {
    color: #b45309;
}
.projects-form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.projects-form-label-row > label {
    margin-bottom: 0;
}
.projects-form-label-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.projects-form-label-actions .btn-link {
    font-size: 0.75rem;
    padding: 0;
    border: none;
    background: none;
    color: #2563eb;
    cursor: pointer;
    text-decoration: underline;
}
.fact-modal-body-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
}
.projects-fact-sparse-warn {
    margin: 0 0 10px;
    padding: 10px 12px;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
}
.projects-fact-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}
.projects-fact-badge--ok {
    color: #166534;
    background: #dcfce7;
}
.projects-fact-badge--warn {
    color: #92400e;
    background: #fef3c7;
}
.projects-fact-badge--na {
    color: #64748b;
    background: #f1f5f9;
}
.projects-fact-vuln-link {
    display: block;
    margin-top: 4px;
    font-size: 0.6875rem;
    color: #7c3aed;
}
.vulnerability-filter-field--project select {
    min-width: 120px;
    max-width: 160px;
}
/* 对话区项目选择器（与角色/代理模式共用 role-selector-*） */
.project-selector-wrapper .role-selector-text {
    max-width: 13em;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-project-panel {
    width: 280px;
}
/* 列表 + 底部按钮共用同一内容宽度，避免滚动条缩进导致左右不齐 */
.chat-project-panel-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
}
.chat-project-panel-search {
    flex-shrink: 0;
    padding: 0 0 8px;
    width: 100%;
}
.chat-project-panel-search-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8125rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.chat-project-panel-search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}
.chat-project-panel-search-input::placeholder {
    color: var(--text-muted);
}
.chat-project-panel-hint {
    padding: 10px 4px 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
}
.chat-project-panel .role-selection-list-main {
    flex: 1;
    min-height: 0;
    max-height: min(360px, 50vh);
    padding-right: 0;
    margin: 0;
    width: 100%;
    overflow-x: hidden;
}
.chat-project-panel .role-selection-item-main {
    width: 100%;
    min-width: 0;
}
.chat-project-panel-loading,
.chat-project-panel-empty {
    padding: 16px 0;
    font-size: 0.8125rem;
    color: #64748b;
    text-align: center;
}
.chat-project-panel-footer {
    flex-shrink: 0;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    width: 100%;
}
.chat-project-panel .role-selection-item-main.chat-project-panel-create-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1.5px dashed rgba(99, 102, 241, 0.45);
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.06);
    color: #4f46e5;
    font-size: 0.8125rem;
    font-weight: 600;
    box-shadow: none;
    transform: none;
}
.chat-project-panel .role-selection-item-main.chat-project-panel-create-btn:hover,
.chat-project-panel .role-selection-item-main.chat-project-panel-create-btn:focus-visible,
.chat-project-panel .role-selection-item-main.chat-project-panel-create-btn:active {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.65);
    color: #4338ca;
    box-shadow: none;
    transform: none;
}
.chat-project-panel-create-icon {
    flex-shrink: 0;
    font-size: 1.125rem;
    line-height: 1;
    font-weight: 500;
}
.chat-project-panel-create-label {
    line-height: 1.4;
}
@media (max-width: 900px) {
    #page-projects .page-content.projects-page-layout {
        flex-direction: column;
    }
    .projects-sidebar-card {
        width: 100%;
        max-height: 220px;
    }
}

/* ============================================================================
   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"] .role-selection-panel,
html[data-theme="dark"] .agent-mode-panel,
html[data-theme="dark"] .lang-dropdown,
html[data-theme="dark"] .notification-dropdown,
html[data-theme="dark"] .user-menu-dropdown,
html[data-theme="dark"] .conversation-sort-menu {
    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"] .role-selection-panel-header,
html[data-theme="dark"] .chat-input-primary-row,
html[data-theme="dark"] .conversation-sidebar-header,
html[data-theme="dark"] .sidebar-header,
html[data-theme="dark"] .section-header,
html[data-theme="dark"] .notification-dropdown-header {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

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"] .workflow-form-select-option:hover,
html[data-theme="dark"] .projects-filter-select-option:hover,
html[data-theme="dark"] .chat-files-filter-select-option:hover,
html[data-theme="dark"] #role-modal .role-form-select-option:hover,
html[data-theme="dark"] .monitor-filter-select-option:hover,
html[data-theme="dark"] .batch-form-select-option:hover {
    background: rgba(96, 165, 250, 0.12);
}

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"] .chat-files-filter-select-trigger,
html[data-theme="dark"] .role-form-select-trigger,
html[data-theme="dark"] .batch-form-select-trigger,
html[data-theme="dark"] .monitor-filter-select-trigger,
html[data-theme="dark"] .role-selector-btn,
html[data-theme="dark"] .conversation-project-filter-trigger {
    background: #0f172a;
    color: var(--text-primary);
    border-color: #2b374b;
}

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"] .hitl-page-whitelist-bar,
html[data-theme="dark"] .hitl-page-strategy-bar,
html[data-theme="dark"] .audit-filter-card,
html[data-theme="dark"] .mcp-stats-dist-panel,
html[data-theme="dark"] .mcp-stats-panel,
html[data-theme="dark"] .detail-code-card {
    background: #111827;
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .conversation-reasoning-icon {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(96, 165, 250, 0.26);
}

html[data-theme="dark"] .session-settings-group {
    background: rgba(15, 23, 42, 0.86);
    border-color: rgba(96, 165, 250, 0.22);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.035),
        0 1px 0 rgba(15, 23, 42, 0.32);
}

html[data-theme="dark"] .session-hitl-field.session-settings-group {
    background: rgba(13, 22, 38, 0.92);
    border-color: rgba(96, 165, 250, 0.3);
}

html[data-theme="dark"] .session-settings-group-title {
    color: #cbd5e1;
}

html[data-theme="dark"] .chat-reasoning-select,
html[data-theme="dark"] .conversation-reasoning-card .hitl-config-select,
html[data-theme="dark"] .conversation-reasoning-card .hitl-config-textarea {
    background-color: #0f172a;
    border-color: #2b374b;
    color: var(--text-primary);
}

html[data-theme="dark"] .session-settings-select-trigger,
html[data-theme="dark"] .session-settings-select-menu {
    background: #0f172a;
    border-color: #2b374b;
    color: var(--text-primary);
}

html[data-theme="dark"] .session-settings-select-trigger:hover {
    background: #111827;
    border-color: rgba(96, 165, 250, 0.4);
}

html[data-theme="dark"] .session-settings-select-option {
    color: var(--text-primary);
}

html[data-theme="dark"] .session-settings-select-option:hover {
    background: rgba(59, 130, 246, 0.16);
}

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 {
    background: #0b1120;
    border-color: #263244;
}

html[data-theme="dark"] .conversation-reasoning-card .hitl-reviewer-toggle-btn.is-active {
    background: #1e293b;
}

html[data-theme="dark"] .dashboard-kpi-card:nth-child(1),
html[data-theme="dark"] .dashboard-kpi-card:nth-child(2),
html[data-theme="dark"] .dashboard-kpi-card:nth-child(3),
html[data-theme="dark"] .dashboard-kpi-card:nth-child(4),
html[data-theme="dark"] .dashboard-kpi-card:nth-child(5) {
    background: linear-gradient(145deg, #111827 0%, #172033 100%);
}

html[data-theme="dark"] table,
html[data-theme="dark"] .data-table,
html[data-theme="dark"] .monitor-table,
html[data-theme="dark"] .audit-log-table,
html[data-theme="dark"] .hitl-logs-table,
html[data-theme="dark"] .mcp-stats-tool-table,
html[data-theme="dark"] .info-collect-table,
html[data-theme="dark"] .chat-files-table,
html[data-theme="dark"] .webshell-db-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,
html[data-theme="dark"] .hitl-logs-table th,
html[data-theme="dark"] .mcp-stats-tool-table thead,
html[data-theme="dark"] .info-collect-table thead th,
html[data-theme="dark"] .chat-files-table th,
html[data-theme="dark"] .webshell-db-table thead th {
    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,
html[data-theme="dark"] .hitl-logs-table td,
html[data-theme="dark"] .mcp-stats-tool-table td,
html[data-theme="dark"] .info-collect-table td,
html[data-theme="dark"] .chat-files-table td,
html[data-theme="dark"] .webshell-db-table td {
    border-color: var(--border-color);
}

html[data-theme="dark"] tr:hover td,
html[data-theme="dark"] .data-table tbody tr:hover td,
html[data-theme="dark"] .monitor-table tbody tr:hover,
html[data-theme="dark"] .info-collect-table tbody tr:hover td,
html[data-theme="dark"] .chat-files-table tr:hover td {
    background: rgba(96, 165, 250, 0.08);
}

html[data-theme="dark"] .chat-files-cell-conv code {
    background: var(--bg-secondary) !important;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

html[data-theme="dark"] .chat-files-source-badge {
    border-color: rgba(129, 140, 248, 0.35);
    background: rgba(129, 140, 248, 0.12);
    color: #c7d2fe;
}

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"] .node-detail-item pre,
html[data-theme="dark"] .timeline-item-content pre,
html[data-theme="dark"] .fact-detail-body,
html[data-theme="dark"] .info-collect-cell-modal-pre,
html[data-theme="dark"] .vulnerability-proof 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 .mcp-detail-content {
    background: #111827 !important;
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

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-section {
    background: #111827;
    border-color: rgba(148, 163, 184, 0.14);
    box-shadow: none;
}

html[data-theme="dark"] #mcp-detail-modal .detail-section-overview {
    background: #111827;
    border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] #mcp-detail-modal .detail-info-grid .detail-item {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.14);
}

html[data-theme="dark"] #mcp-detail-modal .detail-item strong {
    color: #94a3b8;
}

html[data-theme="dark"] #mcp-detail-modal .detail-section-header .btn-ghost {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.18);
    color: #94a3b8;
}

html[data-theme="dark"] #mcp-detail-modal .detail-section-header .btn-ghost:hover {
    background: #1f2937;
    border-color: rgba(148, 163, 184, 0.26);
    color: #e5e7eb;
}

html[data-theme="dark"] #mcp-detail-modal .detail-section-header .btn-ghost:disabled {
    background: rgba(20, 83, 45, 0.22);
    border-color: rgba(74, 222, 128, 0.18);
    color: #86efac;
}

html[data-theme="dark"] #mcp-detail-modal .detail-code-card {
    background: #020617;
    border-color: rgba(148, 163, 184, 0.14);
    box-shadow: none;
}

html[data-theme="dark"] #mcp-detail-modal .detail-result-tabs {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.14);
}

html[data-theme="dark"] #mcp-detail-modal .detail-result-tab {
    color: #94a3b8;
}

html[data-theme="dark"] #mcp-detail-modal .detail-result-tab.active {
    background: #1f2937;
    color: #e5e7eb;
    box-shadow: none;
}

html[data-theme="dark"] #mcp-detail-modal .detail-code-card .code-block,
html[data-theme="dark"] #mcp-detail-modal .code-block {
    background: transparent !important;
    border-color: transparent !important;
    color: #dbeafe;
}

html[data-theme="dark"] #mcp-detail-modal .code-block.error {
    color: #fecaca;
}

html[data-theme="dark"] #mcp-detail-modal .code-block::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.42);
    border-color: rgba(2, 6, 23, 0.95);
}

html[data-theme="dark"] #mcp-detail-modal .code-block::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.72);
}

html[data-theme="dark"] #mcp-detail-modal .detail-success-wrapper {
    background: rgba(20, 83, 45, 0.16);
    border-color: rgba(34, 197, 94, 0.28);
}

html[data-theme="dark"] #mcp-detail-modal .detail-error-wrapper {
    background: rgba(127, 29, 29, 0.18);
    border-color: rgba(248, 113, 113, 0.28);
}

html[data-theme="dark"] #mcp-detail-modal .detail-abort-section {
    background: rgba(120, 53, 15, 0.18);
    border-color: rgba(251, 191, 36, 0.24);
}

html[data-theme="dark"] .timeline-item-content .timeline-plain-text {
    background: transparent !important;
    border-color: transparent !important;
    color: inherit;
    padding: 0;
}

html[data-theme="dark"] .timeline-item-content.timeline-stream-plain {
    background: transparent;
}

html[data-theme="dark"] .progress-container {
    background: #0f172a;
    border-color: #243044;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .message.system .message-bubble.progress-container {
    background: #0b1120 !important;
    color: var(--text-primary);
    border-color: #203047 !important;
}

html[data-theme="dark"] .progress-container.completed {
    background: #111827;
    border-color: #263244;
}

html[data-theme="dark"] .chat-turn-rail-marker::before {
    background: #505866;
}

html[data-theme="dark"] .chat-turn-rail-marker:hover::before {
    background: #a0a8b5;
}

html[data-theme="dark"] .chat-turn-rail-marker.is-active::before {
    background: #f4f7fb;
}

html[data-theme="dark"] .chat-turn-rail-preview {
    border-color: rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.97);
    color: #f8fafc;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .chat-turn-rail-preview-title {
    color: #f8fafc;
}

html[data-theme="dark"] .chat-turn-rail-preview-summary {
    color: #9ba5b4;
}

html[data-theme="dark"] .chat-return-latest {
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.96);
    color: #cbd5e1;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38), 0 1px 3px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .chat-return-latest:hover {
    border-color: rgba(148, 163, 184, 0.42);
    background: #172033;
    color: #ffffff;
}

html[data-theme="dark"] .process-details-return-latest {
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.96);
    color: #cbd5e1;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38), 0 1px 3px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .process-details-return-latest:hover {
    border-color: rgba(96, 165, 250, 0.42);
    background: #172033;
    color: #93c5fd;
}

html[data-theme="dark"] .process-details-return-latest.has-pending-new::after,
html[data-theme="dark"] .process-details-return-latest.is-streaming::after {
    border-color: rgba(15, 23, 42, 0.96);
}

html[data-theme="dark"] .process-details-container {
    border-top-color: #263244;
}

html[data-theme="dark"] .progress-header,
html[data-theme="dark"] .progress-footer {
    border-color: #243044;
}

html[data-theme="dark"] .progress-toggle {
    background: #111827;
    border-color: #2b374b;
    color: #a7b0c0;
}

html[data-theme="dark"] .progress-toggle:hover {
    background: #172033;
    border-color: rgba(96, 165, 250, 0.38);
    color: #dbeafe;
}

html[data-theme="dark"] .timeline-item {
    background: #0f172a;
    border-left-color: #334155;
}

html[data-theme="dark"] .timeline-item:hover {
    background: #132036;
}

html[data-theme="dark"] .timeline-item-content {
    border-top-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .timeline-item-iteration,
html[data-theme="dark"] .timeline-item.timeline-item-iteration.timeline-eino-scope-main,
html[data-theme="dark"] .timeline-item.timeline-item-iteration.timeline-eino-scope-sub {
    background: #101a2b !important;
}

html[data-theme="dark"] .timeline-item-thinking {
    background: rgba(139, 92, 246, 0.09);
}

html[data-theme="dark"] .timeline-item-thinking[data-response-stream-placeholder="1"] {
    border-left-color: #60a5fa;
    background: rgba(37, 99, 235, 0.09);
    border-color: rgba(96, 165, 250, 0.2);
}

html[data-theme="dark"] .timeline-item-reasoning_chain {
    background: rgba(124, 58, 237, 0.11);
}

html[data-theme="dark"] .timeline-item-planning {
    background: rgba(45, 212, 191, 0.075);
}

html[data-theme="dark"] .timeline-item-planning[data-orchestration]:not([data-orchestration="plan_execute"]) {
    border-left-color: #60a5fa;
    background: #101c2f;
    border-color: rgba(96, 165, 250, 0.2);
}

html[data-theme="dark"] .timeline-item-tool_call,
html[data-theme="dark"] .timeline-item-tool_calls_detected {
    background: rgba(96, 165, 250, 0.075);
}

html[data-theme="dark"] .timeline-item-tool_result,
html[data-theme="dark"] .timeline-item-progress {
    background: rgba(148, 163, 184, 0.075);
}

html[data-theme="dark"] .timeline-item-eino_usage_summary {
    border-left-color: #2dd4bf;
    background: rgba(45, 212, 191, 0.085);
}

html[data-theme="dark"] .timeline-item-eino_agent_reply {
    background: rgba(168, 85, 247, 0.1);
}

html[data-theme="dark"] .timeline-item-tool_call:has(.tool-result-section.success),
html[data-theme="dark"] .timeline-item-tool_result:has(.tool-result-section.success) {
    background: rgba(52, 211, 153, 0.08);
}

html[data-theme="dark"] .timeline-item-tool_call:has(.tool-result-section.error),
html[data-theme="dark"] .timeline-item-tool_result:has(.tool-result-section.error),
html[data-theme="dark"] .timeline-item-tool_result.error,
html[data-theme="dark"] .timeline-item-error {
    background: rgba(248, 113, 113, 0.1);
}

html[data-theme="dark"] .timeline-item-tool_call.tool-call-running {
    border: 1px solid rgba(96, 165, 250, 0.32);
    border-left: 3px solid #60a5fa;
    background: rgba(37, 99, 235, 0.105);
}

html[data-theme="dark"] .tool-args-hitl-edited {
    background: rgba(245, 158, 11, 0.16);
    color: #fcd34d;
}

html[data-theme="dark"] .timeline-item-tool_call.tool-call-completed {
    border: 1px solid rgba(52, 211, 153, 0.34);
    border-left: 3px solid #34d399;
    background: rgba(16, 185, 129, 0.105);
}

html[data-theme="dark"] .timeline-item-tool_call.tool-call-failed {
    border: 1px solid rgba(248, 113, 113, 0.38);
    border-left: 3px solid #f87171;
    background: rgba(239, 68, 68, 0.115);
}

html[data-theme="dark"] .timeline-item-tool_call.tool-call-running:hover {
    background: rgba(37, 99, 235, 0.14);
}

html[data-theme="dark"] .timeline-item-tool_call.tool-call-completed:hover {
    background: rgba(16, 185, 129, 0.14);
}

html[data-theme="dark"] .timeline-item-tool_call.tool-call-failed:hover {
    background: rgba(239, 68, 68, 0.16);
}

html[data-theme="dark"] .timeline-item-tool_call .tool-args,
html[data-theme="dark"] .timeline-item-tool_call .tool-result,
html[data-theme="dark"] .timeline-item-tool_result .tool-result {
    /* 工具参数与结果沿用外层卡片底色，不再额外铺一层色块。 */
    background: transparent !important;
    border-color: rgba(148, 163, 184, 0.2) !important;
    color: #dbe4f0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

html[data-theme="dark"] .timeline-item-tool_call:has(.tool-result-section.success) .tool-args,
html[data-theme="dark"] .timeline-item-tool_call .tool-result-section.success .tool-result,
html[data-theme="dark"] .timeline-item-tool_result:has(.tool-result-section.success) .tool-result {
    background: rgba(16, 185, 129, 0.13);
    border-color: rgba(52, 211, 153, 0.38);
}

html[data-theme="dark"] .timeline-item-tool_call:has(.tool-result-section.error) .tool-args,
html[data-theme="dark"] .timeline-item-tool_call .tool-result-section.error .tool-result,
html[data-theme="dark"] .timeline-item-tool_result:has(.tool-result-section.error) .tool-result {
    background: rgba(248, 113, 113, 0.13);
    border-color: rgba(248, 113, 113, 0.42);
    color: #dbe4f0;
}

html[data-theme="dark"] .timeline-item-warning,
html[data-theme="dark"] .timeline-item-user_interrupt_continue {
    background: rgba(251, 191, 36, 0.08);
}

html[data-theme="dark"] .timeline-item-finalization_check {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.1), rgba(30, 41, 59, 0.18));
    border-left-color: #fbbf24;
}

html[data-theme="dark"] .timeline-item-finalization_check .timeline-item-title,
html[data-theme="dark"] .webshell-ai-timeline-finalization_check .webshell-ai-timeline-title {
    color: #fbbf24;
}

html[data-theme="dark"] .webshell-ai-timeline-eino_usage_summary,
html[data-theme="dark"] .webshell-ai-process-block .webshell-ai-timeline-eino_usage_summary {
    border-left-color: #2dd4bf;
    background: rgba(45, 212, 191, 0.08);
}

html[data-theme="dark"] .message.assistant:not(.progress-message):not(.assistant-turn-with-process) .message-bubble {
    background: transparent;
    color: var(--text-primary);
    border-color: transparent;
}

html[data-theme="dark"] .message.assistant.assistant-not-finalized .message-bubble {
    border-color: rgba(251, 191, 36, 0.24);
    border-left-color: #fbbf24;
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.08), rgba(17, 24, 39, 0.9));
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .message.assistant.assistant-not-finalized .message-bubble strong:first-child {
    color: #fbbf24;
}

html[data-theme="dark"] .webshell-ai-timeline-finalization_check {
    border-left-color: #fbbf24;
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.08), rgba(17, 24, 39, 0.12));
}

html[data-theme="dark"] .webshell-ai-msg.assistant.webshell-ai-candidate-output {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.08), rgba(17, 24, 39, 0.12));
}

html[data-theme="dark"] .message-copy-btn {
    color: var(--text-secondary);
}

html[data-theme="dark"] .message-copy-btn:hover {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.45);
    color: var(--accent-hover);
}

html[data-theme="dark"] .message-copy-btn:active {
    background: rgba(96, 165, 250, 0.18);
}

html[data-theme="dark"] .message.user .message-bubble {
    background: #1b2638;
    color: #e8eef8;
    border-color: rgba(96, 165, 250, 0.18);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.025) inset,
        0 8px 24px rgba(2, 6, 23, 0.16);
}

html[data-theme="dark"] .message.system .message-bubble,
html[data-theme="dark"] .loading-spinner,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .chat-project-panel-loading,
html[data-theme="dark"] .chat-project-panel-empty {
    color: var(--text-secondary);
}

html[data-theme="dark"] .modal,
html[data-theme="dark"] .modal-overlay,
html[data-theme="dark"] .projects-modal-overlay,
html[data-theme="dark"] .info-collect-cell-modal,
html[data-theme="dark"] .chat-files-form-modal,
html[data-theme="dark"] .login-overlay,
html[data-theme="dark"] #login-overlay {
    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, highly specific light theme block. Keep its dark
   overrides together so the landing view does not flash large white panels. */
html[data-theme="dark"] .dashboard-page {
    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::before {
    background-image: radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.08) 1px, transparent 0);
}

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-overview-item,
html[data-theme="dark"] .dashboard-severity-insight-risk,
html[data-theme="dark"] .dashboard-severity-insight-urgent-item,
html[data-theme="dark"] .dashboard-severity-status-cell,
html[data-theme="dark"] .dashboard-access-stat,
html[data-theme="dark"] .dashboard-webshell-recent-item {
    background: #111827 !important;
    color: var(--text-primary);
    border-color: var(--border-color) !important;
    box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .dashboard-grid .dashboard-section:hover,
html[data-theme="dark"] .dashboard-recommend-item:hover,
html[data-theme="dark"] .dashboard-resource-item:hover,
html[data-theme="dark"] .dashboard-overview-item:hover,
html[data-theme="dark"] .dashboard-recent-vuln-item:hover,
html[data-theme="dark"] .dashboard-recent-fact-item:hover,
html[data-theme="dark"] .dashboard-batch-side-body:hover {
    background: #172033 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .dashboard-batch-side-stat--pending {
    background: rgba(245, 158, 11, 0.07) !important;
    border-color: rgba(245, 158, 11, 0.24) !important;
    border-top-color: #f59e0b !important;
}

html[data-theme="dark"] .dashboard-batch-side-stat--running {
    background: rgba(59, 130, 246, 0.07) !important;
    border-color: rgba(59, 130, 246, 0.24) !important;
    border-top-color: #3b82f6 !important;
}

html[data-theme="dark"] .dashboard-batch-side-stat--done {
    background: rgba(16, 185, 129, 0.07) !important;
    border-color: rgba(16, 185, 129, 0.24) !important;
    border-top-color: #10b981 !important;
}

html[data-theme="dark"] .dashboard-batch-side-stat--pending .dashboard-batch-side-stat-value { color: #f59e0b; }
html[data-theme="dark"] .dashboard-batch-side-stat--running .dashboard-batch-side-stat-value { color: #60a5fa; }
html[data-theme="dark"] .dashboard-batch-side-stat--done .dashboard-batch-side-stat-value    { color: #34d399; }

html[data-theme="dark"] .dashboard-kpi-card,
html[data-theme="dark"] .dashboard-kpi-card:nth-child(1),
html[data-theme="dark"] .dashboard-kpi-card:nth-child(2),
html[data-theme="dark"] .dashboard-kpi-card:nth-child(3),
html[data-theme="dark"] .dashboard-kpi-card:nth-child(4) {
    background: linear-gradient(145deg, #111827 0%, #172033 100%) !important;
    border-color: #2b374b !important;
    box-shadow: 0 10px 24px rgba(0,0,0,0.32), 0 1px 0 rgba(255,255,255,0.04) inset;
}

html[data-theme="dark"] .dashboard-section-title,
html[data-theme="dark"] .dashboard-section-header {
    border-color: #263244 !important;
}

html[data-theme="dark"] .dashboard-feed-tabs {
    background: #0b1120 !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] .dashboard-severity-status-filter-btn {
    background: rgba(15, 23, 42, 0.46);
    border-color: rgba(71, 85, 105, 0.58);
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}

html[data-theme="dark"] .dashboard-severity-status-filter-btn:hover,
html[data-theme="dark"] .dashboard-severity-status-filter.is-open .dashboard-severity-status-filter-btn,
html[data-theme="dark"] .dashboard-severity-status-filter-btn:focus-visible {
    background: rgba(23, 32, 51, 0.72);
    border-color: rgba(96, 165, 250, 0.36);
    box-shadow: 0 8px 18px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.05);
}

html[data-theme="dark"] .dashboard-severity-status-filter-menu {
    background: rgba(15, 23, 42, 0.94);
    border-color: rgba(71, 85, 105, 0.62);
    box-shadow: 0 16px 34px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.04);
}

html[data-theme="dark"] .dashboard-severity-status-filter-option {
    color: var(--text-primary);
}

html[data-theme="dark"] .dashboard-severity-status-filter-option: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 {
    color: var(--text-secondary);
}

html[data-theme="dark"] .dashboard-feed-tab:hover {
    color: var(--text-primary);
}

html[data-theme="dark"] .dashboard-feed-tab.is-active {
    background: #172033 !important;
    color: var(--accent-hover);
    box-shadow: none;
}

html[data-theme="dark"] .dashboard-events-list,
html[data-theme="dark"] .dashboard-batch-side-progress-bar,
html[data-theme="dark"] .dashboard-overview-progress-bar,
html[data-theme="dark"] .dashboard-severity-progress-track,
html[data-theme="dark"] .dashboard-severity-insight-score-track {
    background: #0b1120 !important;
}

html[data-theme="dark"] .dashboard-severity-chart::before {
    opacity: 0.42;
    background:
        radial-gradient(ellipse 82% 64% at 50% 74%, rgba(96, 165, 250, 0.10), transparent 58%),
        radial-gradient(ellipse 52% 42% at 14% 94%, rgba(56, 189, 248, 0.05), transparent 52%),
        radial-gradient(ellipse 48% 38% at 88% 90%, rgba(167, 139, 250, 0.04), transparent 50%);
}

html[data-theme="dark"] .dashboard-severity-chart[data-hover-severity="critical"]::before {
    background: radial-gradient(ellipse 82% 64% at 50% 74%, rgba(239, 68, 68, 0.22), transparent 58%),
                radial-gradient(ellipse 50% 44% at 22% 92%, rgba(249, 115, 22, 0.10), transparent 54%);
}

html[data-theme="dark"] .dashboard-severity-chart[data-hover-severity="high"]::before {
    background: radial-gradient(ellipse 82% 64% at 50% 74%, rgba(249, 115, 22, 0.20), transparent 58%),
                radial-gradient(ellipse 48% 40% at 78% 88%, rgba(234, 179, 8, 0.08), transparent 52%);
}

html[data-theme="dark"] .dashboard-severity-chart[data-hover-severity="medium"]::before {
    background: radial-gradient(ellipse 82% 64% at 50% 74%, rgba(234, 179, 8, 0.18), transparent 58%),
                radial-gradient(ellipse 46% 38% at 18% 88%, rgba(250, 204, 21, 0.08), transparent 52%);
}

html[data-theme="dark"] .dashboard-severity-chart[data-hover-severity="low"]::before {
    background: radial-gradient(ellipse 82% 64% at 50% 74%, rgba(45, 212, 191, 0.18), transparent 58%),
                radial-gradient(ellipse 46% 38% at 86% 88%, rgba(14, 165, 233, 0.08), transparent 52%);
}

html[data-theme="dark"] .dashboard-severity-chart[data-hover-severity="info"]::before {
    background: radial-gradient(ellipse 82% 64% at 50% 74%, rgba(59, 130, 246, 0.18), transparent 58%),
                radial-gradient(ellipse 46% 38% at 30% 86%, rgba(129, 140, 248, 0.08), transparent 52%);
}

html[data-theme="dark"] .dashboard-severity-donut .donut-track-shadow {
    fill: #0f172a;
    opacity: 0.55;
}

html[data-theme="dark"] .dashboard-severity-center-value,
html[data-theme="dark"] .dashboard-severity-center-label {
    text-shadow: none;
}

html[data-theme="dark"] .dashboard-severity-legend-item:hover,
html[data-theme="dark"] .dashboard-severity-legend-item.is-active {
    background: rgba(96, 165, 250, 0.10);
}

html[data-theme="dark"] .dashboard-severity-progress-legend-dot.legend-open {
    background: #334155 !important;
    border-color: #475569 !important;
}

html[data-theme="dark"] .dashboard-severity-status-cell.s-open {
    border-color: rgba(239, 68, 68, 0.26) !important;
    background: rgba(239, 68, 68, 0.07) !important;
}

html[data-theme="dark"] .dashboard-severity-status-cell.s-confirmed {
    border-color: rgba(245, 158, 11, 0.26) !important;
    background: rgba(245, 158, 11, 0.07) !important;
}

html[data-theme="dark"] .dashboard-severity-status-cell.s-fixed {
    border-color: rgba(34, 197, 94, 0.26) !important;
    background: rgba(34, 197, 94, 0.07) !important;
}

html[data-theme="dark"] .dashboard-severity-status-cell.s-ignored {
    border-color: rgba(100, 116, 139, 0.30) !important;
    background: rgba(100, 116, 139, 0.08) !important;
}

html[data-theme="dark"] .dashboard-severity-status-cell.s-fp {
    border-color: rgba(148, 163, 184, 0.30) !important;
    background: rgba(148, 163, 184, 0.08) !important;
}

html[data-theme="dark"] .dashboard-severity-insight-risk[data-level="safe"] {
    border-color: rgba(52, 211, 153, 0.24) !important;
    background: rgba(52, 211, 153, 0.08) !important;
}

html[data-theme="dark"] .dashboard-severity-insight-risk[data-level="low"] {
    border-color: rgba(96, 165, 250, 0.24) !important;
    background: rgba(96, 165, 250, 0.08) !important;
}

html[data-theme="dark"] .dashboard-severity-insight-risk[data-level="medium"] {
    border-color: rgba(234, 179, 8, 0.28) !important;
    background: rgba(234, 179, 8, 0.08) !important;
}

html[data-theme="dark"] .dashboard-severity-insight-risk[data-level="high"] {
    border-color: rgba(249, 115, 22, 0.30) !important;
    background: rgba(249, 115, 22, 0.08) !important;
}

html[data-theme="dark"] .dashboard-severity-insight-risk[data-level="severe"] {
    border-color: rgba(239, 68, 68, 0.32) !important;
    background: rgba(239, 68, 68, 0.08) !important;
}

html[data-theme="dark"] .dashboard-recent-vuln-item,
html[data-theme="dark"] .dashboard-recent-fact-item,
html[data-theme="dark"] .dashboard-resource-item {
    border-bottom-color: #263244 !important;
}

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-recent-vuln-sev,
html[data-theme="dark"] .dashboard-recent-vuln-status,
html[data-theme="dark"] .dashboard-resource-health,
html[data-theme="dark"] .dashboard-overview-total,
html[data-theme="dark"] .dashboard-overview-success-rate,
html[data-theme="dark"] .dashboard-overview-status {
    background-color: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.24);
}

html[data-theme="dark"] .dashboard-alert-banner {
    --dashboard-alert-accent: #60a5fa;
    --dashboard-alert-accent-soft: rgba(96, 165, 250, 0.07);
    --dashboard-alert-accent-border: rgba(96, 165, 250, 0.16);
    background: linear-gradient(105deg, var(--dashboard-alert-accent-soft) 0%, rgba(17, 27, 45, 0.98) 30%, rgba(15, 24, 40, 0.98) 100%);
    color: #f1f5f9;
    border-color: var(--dashboard-alert-accent-border);
    box-shadow: 0 6px 20px rgba(2, 6, 23, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

html[data-theme="dark"] .dashboard-alert-banner.is-warning {
    --dashboard-alert-accent: #fbbf24;
    --dashboard-alert-accent-soft: rgba(251, 191, 36, 0.07);
    --dashboard-alert-accent-border: rgba(251, 191, 36, 0.17);
}

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

html[data-theme="dark"] .dashboard-alert-desc {
    color: #aebbd0;
}

html[data-theme="dark"] .dashboard-alert-icon {
    background: var(--dashboard-alert-accent-soft);
}

html[data-theme="dark"] .dashboard-alert-btn {
    color: var(--dashboard-alert-accent);
    background: var(--dashboard-alert-accent-soft);
    border-color: var(--dashboard-alert-accent-border);
    box-shadow: none;
}

html[data-theme="dark"] .dashboard-alert-btn:hover {
    filter: saturate(1.1) brightness(1.18);
    border-color: var(--dashboard-alert-accent);
}

html[data-theme="dark"] .dashboard-alert-btn-secondary {
    color: var(--dashboard-alert-accent);
    background: transparent;
}

html[data-theme="dark"] .dashboard-recommend-item.lvl-urgent {
    border-left-color: #f87171;
}

html[data-theme="dark"] .dashboard-recommend-item.lvl-urgent .dashboard-recommend-icon {
    background: rgba(248, 113, 113, 0.14);
    color: #f87171;
    box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.28);
}

html[data-theme="dark"] .dashboard-recommend-item.lvl-warning .dashboard-recommend-icon {
    background: rgba(251, 191, 36, 0.14);
    color: #fbbf24;
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.26);
}

html[data-theme="dark"] .dashboard-recommend-item.lvl-setup .dashboard-recommend-icon {
    background: rgba(96, 165, 250, 0.14);
    color: #60a5fa;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.26);
}

html[data-theme="dark"] .dashboard-access-stat--c2,
html[data-theme="dark"] .dashboard-access-stat--webshell {
    background: linear-gradient(145deg, #111827 0%, #172033 100%) !important;
}

html[data-theme="dark"] .dashboard-side .dashboard-section-tools .dashboard-tools-chart-wrap,
html[data-theme="dark"] .dashboard-resource-list,
html[data-theme="dark"] .dashboard-recent-vulns,
html[data-theme="dark"] .dashboard-recent-facts {
    background: transparent;
}

html[data-theme="dark"] .dashboard-tools-chart-placeholder {
    background: #0f172a !important;
    color: var(--text-secondary) !important;
    border-color: #2b374b !important;
}

html[data-theme="dark"] .dashboard-tools-bar-track {
    background: #1f2937 !important;
}

html[data-theme="dark"] .dashboard-empty-action {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #08111f;
}

html[data-theme="dark"] .dashboard-empty-action:hover {
    background: var(--accent-hover);
}

html[data-theme="dark"] .dashboard-cta-block {
    background:
        linear-gradient(90deg, rgba(96, 165, 250, 0.14) 0%, rgba(96, 165, 250, 0.05) 22%, transparent 38%),
        linear-gradient(145deg, #111827 0%, #172033 100%);
    border-color: rgba(96, 165, 250, 0.22);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

html[data-theme="dark"] .dashboard-cta-icon {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.22) 0%, rgba(59, 130, 246, 0.14) 100%);
    color: #60a5fa;
}

html[data-theme="dark"] .dashboard-cta-btn {
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

html[data-theme="dark"] .dashboard-cta-btn:hover {
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5);
}

/* Chat controls are defined after the generic dark layer, so keep a final
   override here for role/agent-mode popovers and conversation pagination. */
html[data-theme="dark"] .role-selector-btn,
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-selector-btn:hover {
    background: #172033 !important;
    border-color: var(--accent-color) !important;
}

html[data-theme="dark"] .role-selector-text,
html[data-theme="dark"] .role-selection-panel-title,
html[data-theme="dark"] .role-selection-item-name-main,
html[data-theme="dark"] .agent-mode-option .role-selection-item-name-main {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .role-selection-item-description-main,
html[data-theme="dark"] .agent-mode-option .role-selection-item-description-main {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .selection-detail-tooltip {
    background: rgba(17, 24, 39, 0.96);
    color: #ffffff;
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .selection-detail-tooltip::before {
    background: rgba(17, 24, 39, 0.96);
    border-color: transparent;
}

html[data-theme="dark"] .agent-mode-option::after {
    background: rgba(17, 24, 39, 0.96);
    color: #ffffff;
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .agent-mode-option::before {
    background: rgba(17, 24, 39, 0.96);
    border-color: transparent;
}

html[data-theme="dark"] .agent-mode-panel,
html[data-theme="dark"] .role-selection-panel,
html[data-theme="dark"] .chat-project-panel {
    background: #111827 !important;
    border-color: #2b374b !important;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(148, 163, 184, 0.08) !important;
}

html[data-theme="dark"] .agent-mode-panel-header,
html[data-theme="dark"] .role-selection-panel-header {
    background: #111827 !important;
    border-bottom-color: #263244 !important;
}

html[data-theme="dark"] .role-selection-item-main,
html[data-theme="dark"] .chat-project-panel .role-selection-item-main {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] .role-selection-item-main:hover,
html[data-theme="dark"] .chat-project-panel .role-selection-item-main:hover {
    background: #172033 !important;
    border-color: rgba(96, 165, 250, 0.46) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22) !important;
}

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"] .role-selection-item-icon-main {
    background: rgba(148, 163, 184, 0.10) !important;
    border-color: rgba(148, 163, 184, 0.12) !important;
}

html[data-theme="dark"] .role-selection-item-icon-main.agent-mode-logo,
html[data-theme="dark"] .project-conversation-preview-mode-icon.agent-mode-logo,
html[data-theme="dark"] .role-selector-icon.agent-mode-logo {
    --agent-logo-a: #94a3b8;
    --agent-logo-b: #94a3b8;
    border-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .sidebar-list-pagination,
html[data-theme="dark"] .sidebar-list-pagination-inner,
html[data-theme="dark"] .conversation-sidebar-pagination,
html[data-theme="dark"] .pagination-fixed,
html[data-theme="dark"] .pagination-fixed .pagination {
    background: #0f172a !important;
    color: var(--text-secondary) !important;
    border-color: #263244 !important;
    box-shadow: none !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"] .sidebar-list-pagination .btn-icon-pagination,
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"] .sidebar-list-pagination .btn-icon-pagination:disabled,
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,
html[data-theme="dark"] .chat-input-primary-row,
html[data-theme="dark"] .chat-input-container .chat-input-with-files,
html[data-theme="dark"] .chat-input-primary-row .chat-input-with-files {
    background: #0f172a !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] .chat-input-field,
html[data-theme="dark"] .chat-input-container .chat-input-field > #chat-input {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}

html[data-theme="dark"] .chat-upload-btn {
    background: #1f2937 !important;
    border-color: #334155 !important;
    color: var(--text-secondary);
}

html[data-theme="dark"] .chat-upload-btn:hover {
    background: #263244 !important;
    border-color: rgba(96, 165, 250, 0.45) !important;
    color: var(--accent-hover);
}

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-fields-card,
html[data-theme="dark"] .info-collect-selected,
html[data-theme="dark"] .info-collect-results-table-wrap,
html[data-theme="dark"] .info-collect-presets,
html[data-theme="dark"] .info-collect-columns-panel,
html[data-theme="dark"] .info-collect-col-item {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .info-collect-options-card {
    background: #0f172a !important;
}

html[data-theme="dark"] .info-collect-step-title {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .info-collect-step-title span {
    background: rgba(96, 165, 250, 0.16) !important;
    color: #93c5fd !important;
}

html[data-theme="dark"] .info-collect-provider-select .settings-custom-select-trigger,
html[data-theme="dark"] .info-collect-provider-select .settings-custom-select-menu {
    background: #0f172a !important;
    border-color: #263244 !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .info-collect-provider-select .settings-custom-select-menu {
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36) !important;
}

html[data-theme="dark"] .info-collect-provider-select .settings-custom-select-option:hover:not(:disabled) {
    background: rgba(30, 41, 59, 0.82) !important;
}

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"] .projects-sidebar-pagination,
html[data-theme="dark"] .projects-graph-toolbar,
html[data-theme="dark"] .projects-graph-legend,
html[data-theme="dark"] .webshell-db-profiles-bar,
html[data-theme="dark"] .webshell-db-output,
html[data-theme="dark"] .webshell-db-sql {
    background: #0b1120 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}

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"] .projects-graph-action-btn,
html[data-theme="dark"] .project-fact-graph-sidebar-close,
html[data-theme="dark"] .project-fact-graph-edge-delete,
html[data-theme="dark"] .webshell-db-profile-menu,
html[data-theme="dark"] .webshell-db-table-item,
html[data-theme="dark"] .info-collect-actions .btn-icon {
    background: transparent !important;
    color: var(--text-secondary) !important;
    border-color: #263244 !important;
}

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"] .projects-action-btn:hover,
html[data-theme="dark"] .projects-graph-action-btn:hover,
html[data-theme="dark"] .project-fact-graph-sidebar-close:hover,
html[data-theme="dark"] .project-fact-graph-edge-delete:hover,
html[data-theme="dark"] .webshell-db-table-item:hover,
html[data-theme="dark"] .webshell-db-column-item:hover {
    background: #172033 !important;
    color: var(--text-primary) !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .hitl-reviewer-toggle-btn.is-active,
html[data-theme="dark"] .hitl-strategy-subtab--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-tab {
    background: transparent !important;
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .hitl-page-tab:hover {
    color: var(--text-primary) !important;
    background: transparent !important;
}

html[data-theme="dark"] .hitl-page-tab--active {
    background: transparent !important;
    color: var(--accent-hover) !important;
    border-bottom-color: var(--accent-color) !important;
    box-shadow: none !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-main,
html[data-theme="dark"] .webshell-db-label,
html[data-theme="dark"] #webshell-db-profile-modal .modal-header h2,
html[data-theme="dark"] .info-collect-results-title,
html[data-theme="dark"] .info-collect-columns-title,
html[data-theme="dark"] .info-collect-cell-modal-title {
    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"] .webshell-db-sidebar-hint,
html[data-theme="dark"] .webshell-db-hint,
html[data-theme="dark"] .webshell-db-table-meta,
html[data-theme="dark"] .info-collect-results-meta,
html[data-theme="dark"] .info-collect-table .muted,
html[data-theme="dark"] .info-collect-cell-text {
    color: var(--text-secondary) !important;
}

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-fact-filter-field select,
html[data-theme="dark"] .projects-form-field .form-input,
html[data-theme="dark"] .projects-modal-body .form-input,
html[data-theme="dark"] .projects-status-select,
html[data-theme="dark"] .webshell-db-toolbar .form-control,
html[data-theme="dark"] .info-collect-query-input {
    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-fact-filter-field input:focus,
html[data-theme="dark"] .projects-fact-filter-field select: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,
html[data-theme="dark"] .info-collect-query-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-info-collect .form-hint,
html[data-theme="dark"] #fofa-parse-modal .form-hint {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #fofa-parse-modal .muted,
html[data-theme="dark"] #fofa-parse-modal .info-collect-parse-nl-text {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .info-collect-parse-warnings {
    background: rgba(251, 191, 36, 0.10) !important;
    border-color: rgba(251, 191, 36, 0.28) !important;
    color: #fde68a !important;
}

html[data-theme="dark"] .info-collect-parse-warnings .muted,
html[data-theme="dark"] .info-collect-parse-warnings-empty {
    color: var(--text-muted) !important;
}

html[data-theme="dark"] .info-collect-parse-explanation {
    background: #0f172a !important;
    border-color: #2b374b !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] #page-info-collect .preset-chip {
    background: #0f172a !important;
    border-color: #2b374b !important;
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #page-info-collect .preset-chip:hover {
    background: rgba(96, 165, 250, 0.12) !important;
    border-color: rgba(96, 165, 250, 0.34) !important;
    color: var(--accent-hover) !important;
}

html[data-theme="dark"] .info-collect-panel {
    background:
        linear-gradient(135deg, rgba(96, 165, 250, 0.1), rgba(45, 212, 191, 0.06) 44%, transparent 70%),
        #0b1120 !important;
    border-color: #263244 !important;
    box-shadow: none;
}

html[data-theme="dark"] .hitl-decision-tag,
html[data-theme="dark"] .projects-category,
html[data-theme="dark"] .projects-confidence,
html[data-theme="dark"] .projects-status-pill,
html[data-theme="dark"] .projects-stat-chip,
html[data-theme="dark"] .projects-fact-badge,
html[data-theme="dark"] .project-fact-graph-node-category,
html[data-theme="dark"] .projects-graph-stat-badge,
html[data-theme="dark"] .webshell-db-count {
    background: rgba(96, 165, 250, 0.12) !important;
    color: #bfdbfe !important;
    border-color: rgba(96, 165, 250, 0.24) !important;
}

html[data-theme="dark"] .projects-status-pill--active {
    background: rgba(34, 197, 94, 0.14) !important;
    color: #86efac !important;
    border-color: rgba(34, 197, 94, 0.34) !important;
}

html[data-theme="dark"] .projects-status-pill--archived {
    background: rgba(148, 163, 184, 0.12) !important;
    color: #cbd5e1 !important;
    border-color: rgba(148, 163, 184, 0.28) !important;
}

html[data-theme="dark"] .projects-stat-chip--facts {
    background: rgba(59, 130, 246, 0.16) !important;
    color: #93c5fd !important;
    border-color: rgba(59, 130, 246, 0.34) !important;
}

html[data-theme="dark"] .projects-stat-chip--vulns {
    background: rgba(249, 115, 22, 0.14) !important;
    color: #fdba74 !important;
    border-color: rgba(249, 115, 22, 0.34) !important;
}

html[data-theme="dark"] .projects-stat-chip--conversations {
    background: rgba(168, 85, 247, 0.14) !important;
    color: #d8b4fe !important;
    border-color: rgba(168, 85, 247, 0.34) !important;
}

html[data-theme="dark"] .projects-stat-chip--warn {
    background: rgba(245, 158, 11, 0.14) !important;
    color: #fcd34d !important;
    border-color: rgba(245, 158, 11, 0.34) !important;
}

html[data-theme="dark"] .projects-confidence--confirmed,
html[data-theme="dark"] .projects-fact-badge--ok {
    background: rgba(34, 197, 94, 0.12) !important;
    color: #6ee7a8 !important;
    border-color: rgba(34, 197, 94, 0.22) !important;
}

html[data-theme="dark"] .projects-confidence--tentative,
html[data-theme="dark"] .projects-fact-badge--warn {
    background: rgba(245, 158, 11, 0.12) !important;
    color: #fbbf24 !important;
    border-color: rgba(245, 158, 11, 0.22) !important;
}

html[data-theme="dark"] .projects-confidence--deprecated,
html[data-theme="dark"] .projects-fact-badge--na {
    background: rgba(148, 163, 184, 0.11) !important;
    color: #aebbd0 !important;
    border-color: rgba(148, 163, 184, 0.20) !important;
}

html[data-theme="dark"] .projects-category--target,
html[data-theme="dark"] .project-fact-graph-node-category--target {
    background: rgba(59, 130, 246, 0.18) !important;
    color: #93c5fd !important;
    border-color: rgba(59, 130, 246, 0.36) !important;
}

html[data-theme="dark"] .projects-category--auth,
html[data-theme="dark"] .projects-category--chain,
html[data-theme="dark"] .projects-category--custom,
html[data-theme="dark"] .project-fact-graph-node-category--chain,
html[data-theme="dark"] .project-fact-graph-node-category--vulnerability {
    background: rgba(168, 85, 247, 0.16) !important;
    color: #d8b4fe !important;
    border-color: rgba(168, 85, 247, 0.34) !important;
}

html[data-theme="dark"] .projects-category--infra,
html[data-theme="dark"] .projects-category--note,
html[data-theme="dark"] .project-fact-graph-node-category--infra,
html[data-theme="dark"] .project-fact-graph-node-category--note,
html[data-theme="dark"] .project-fact-graph-node-category--missing {
    background: rgba(148, 163, 184, 0.14) !important;
    color: #cbd5e1 !important;
    border-color: rgba(148, 163, 184, 0.30) !important;
}

html[data-theme="dark"] .projects-category--business,
html[data-theme="dark"] .project-fact-graph-node-category--auth,
html[data-theme="dark"] .project-fact-graph-node-category--business {
    background: rgba(20, 184, 166, 0.16) !important;
    color: #5eead4 !important;
    border-color: rgba(20, 184, 166, 0.34) !important;
}

html[data-theme="dark"] .projects-category--finding,
html[data-theme="dark"] .projects-category--exploit,
html[data-theme="dark"] .projects-category--poc,
html[data-theme="dark"] .project-fact-graph-node-category--finding,
html[data-theme="dark"] .project-fact-graph-node-category--exploit,
html[data-theme="dark"] .project-fact-graph-node-category--poc {
    background: rgba(249, 115, 22, 0.16) !important;
    color: #fdba74 !important;
    border-color: rgba(249, 115, 22, 0.36) !important;
}

html[data-theme="dark"] .hitl-tool-badge {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

html[data-theme="dark"] .hitl-mode-tag {
    background: rgba(96, 165, 250, 0.14) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(96, 165, 250, 0.28) !important;
    -webkit-text-fill-color: #93c5fd !important;
}

html[data-theme="dark"] .hitl-mode-tag--review_edit {
    background: rgba(251, 191, 36, 0.14) !important;
    color: #fde68a !important;
    border-color: rgba(251, 191, 36, 0.28) !important;
    -webkit-text-fill-color: #fde68a !important;
}

html[data-theme="dark"] .hitl-pending-meta {
    color: var(--text-muted) !important;
}

html[data-theme="dark"] .hitl-context-label {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .hitl-context-block--execution .hitl-context-text {
    background: rgba(52, 211, 153, 0.08) !important;
    border-color: rgba(52, 211, 153, 0.28) !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .hitl-pending-actions {
    border-top-color: #263244 !important;
}

html[data-theme="dark"] .hitl-inline-approval {
    background: #0f172a !important;
    border-color: rgba(96, 165, 250, 0.28) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .hitl-inline-approval--merged {
    background: transparent !important;
    border: 0 !important;
    border-top: 1px dashed rgba(96, 165, 250, 0.28) !important;
}

html[data-theme="dark"] .hitl-inline-approval::before {
    background: #f59e0b !important;
}

html[data-theme="dark"] .hitl-inline-header,
html[data-theme="dark"] .hitl-inline-actions {
    background: #111827 !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] .hitl-inline-approval--merged .hitl-inline-header,
html[data-theme="dark"] .hitl-inline-approval--merged .hitl-inline-actions {
    background: transparent !important;
    border-color: transparent !important;
}

html[data-theme="dark"] .hitl-inline-title {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .hitl-inline-icon {
    background: rgba(245, 158, 11, 0.14) !important;
    color: #fbbf24 !important;
    border-color: rgba(245, 158, 11, 0.32) !important;
}

html[data-theme="dark"] .hitl-inline-summary,
html[data-theme="dark"] .hitl-inline-status {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .hitl-inline-decision {
    border-top-color: rgba(148, 163, 184, 0.22) !important;
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .hitl-inline-decision strong {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .hitl-inline-decision-comment {
    color: var(--text-muted) !important;
}

html[data-theme="dark"] .hitl-inline-note {
    background: #0b1120 !important;
    border-color: #263244 !important;
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .hitl-apply-feedback {
    background: rgba(52, 211, 153, 0.12) !important;
    color: #6ee7b7 !important;
    border-color: rgba(52, 211, 153, 0.28) !important;
}

html[data-theme="dark"] .hitl-apply-feedback.hitl-apply-feedback--error {
    background: rgba(248, 113, 113, 0.12) !important;
    color: #fca5a5 !important;
    border-color: rgba(248, 113, 113, 0.28) !important;
}

html[data-theme="dark"] .hitl-apply-feedback.hitl-apply-feedback--partial {
    background: rgba(251, 191, 36, 0.12) !important;
    color: #fde68a !important;
    border-color: rgba(251, 191, 36, 0.28) !important;
}

html[data-theme="dark"] .hitl-decision-tag.hitl-decision--approve {
    background: rgba(52, 211, 153, 0.14) !important;
    color: #6ee7b7 !important;
    border: 1px solid rgba(52, 211, 153, 0.28) !important;
}

html[data-theme="dark"] .hitl-decision-tag.hitl-decision--reject {
    background: rgba(248, 113, 113, 0.14) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(248, 113, 113, 0.28) !important;
}

html[data-theme="dark"] #page-projects .projects-graph-stat-badge {
    background: rgba(15, 23, 42, 0.6) !important;
    color: var(--text-secondary) !important;
    border-color: #2b374b !important;
}

html[data-theme="dark"] #page-projects .projects-graph-stat-badge strong {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .projects-settings-card--danger,
html[data-theme="dark"] .projects-fact-sparse-warn {
    background: rgba(120, 53, 15, 0.22) !important;
    color: #fed7aa !important;
    border-color: rgba(251, 146, 60, 0.28) !important;
}

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

/* Conversation list items have an inner .conversation-content wrapper; keep it
   transparent so it does not inherit the main chat panel background. */
html[data-theme="dark"] .conversation-item .conversation-content {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .conversation-item .conversation-title,
html[data-theme="dark"] .conversation-item .conversation-time {
    background: transparent !important;
}

html[data-theme="dark"] .conversation-item:hover {
    background: rgba(96, 165, 250, 0.10) !important;
}

html[data-theme="dark"] .conversation-item.active {
    background: rgba(96, 165, 250, 0.16) !important;
    border-color: rgba(96, 165, 250, 0.34) !important;
}

/* Attack chain modal dark theme. */
html[data-theme="dark"] .attack-chain-modal-content {
    background: #0b1120 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
    box-shadow: 0 32px 96px rgba(0, 0, 0, 0.52), 0 0 0 1px rgba(148, 163, 184, 0.10) !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-body {
    background:
        radial-gradient(1000px 520px at 8% -10%, rgba(59, 130, 246, 0.12) 0%, transparent 62%),
        radial-gradient(900px 460px at 100% 110%, rgba(124, 58, 237, 0.10) 0%, transparent 62%),
        linear-gradient(180deg, #0b1120 0%, #111827 100%) !important;
}

html[data-theme="dark"] .attack-chain-toolbar,
html[data-theme="dark"] .attack-chain-sidebar {
    background: rgba(15, 23, 42, 0.88) !important;
    border-color: #263244 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .attack-chain-info {
    background: rgba(96, 165, 250, 0.13) !important;
    color: #dbeafe !important;
    border-color: rgba(96, 165, 250, 0.28) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .attack-chain-container {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%) !important;
    border-color: #263244 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}

html[data-theme="dark"] .attack-chain-container::before {
    background-image: radial-gradient(circle at center, rgba(148, 163, 184, 0.16) 1px, transparent 1.5px) !important;
    opacity: 0.42 !important;
}

html[data-theme="dark"] .attack-chain-container::after {
    background:
        radial-gradient(760px 380px at 15% 12%, rgba(59, 130, 246, 0.10) 0%, transparent 70%),
        radial-gradient(680px 340px at 85% 88%, rgba(168, 85, 247, 0.08) 0%, transparent 70%) !important;
}

html[data-theme="dark"] .legend-section,
html[data-theme="dark"] .attack-chain-details,
html[data-theme="dark"] .node-detail-item {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .legend-title,
html[data-theme="dark"] .attack-chain-details-title span {
    color: var(--text-primary) !important;
    border-bottom-color: #263244 !important;
}

html[data-theme="dark"] .legend-item,
html[data-theme="dark"] .node-detail-item strong {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .node-detail-item div[style*="background"],
html[data-theme="dark"] .node-detail-ai-analysis {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}

html[data-theme="dark"] .legend-item:hover {
    background: rgba(96, 165, 250, 0.10) !important;
}

html[data-theme="dark"] .attack-chain-filters input[type="text"],
html[data-theme="dark"] .attack-chain-filters select,
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 input[type="text"]::placeholder {
    color: var(--text-muted) !important;
}

html[data-theme="dark"] .attack-chain-filters input[type="text"]:hover,
html[data-theme="dark"] .attack-chain-filters select:hover,
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-filters input[type="text"]:focus,
html[data-theme="dark"] .attack-chain-filters select: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"] .attack-chain-details-content::-webkit-scrollbar-thumb,
html[data-theme="dark"] .attack-chain-sidebar-content::-webkit-scrollbar-thumb {
    background: #334155 !important;
}

html[data-theme="dark"] .attack-chain-container .loading-spinner,
html[data-theme="dark"] .attack-chain-container .empty-message {
    color: var(--text-secondary) !important;
}

/* Projects page has ID-scoped light styles; keep its frame dark. */
html[data-theme="dark"] #page-projects,
html[data-theme="dark"] #page-projects.projects-page {
    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-sidebar-card,
html[data-theme="dark"] #page-projects .projects-detail-placeholder,
html[data-theme="dark"] #page-projects .projects-detail-inner {
    background: #111827 !important;
    border-color: #263244 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-projects .projects-sidebar-head,
html[data-theme="dark"] #page-projects .projects-sidebar-search,
html[data-theme="dark"] #page-projects .projects-sidebar-pagination,
html[data-theme="dark"] #page-projects .projects-detail-header,
html[data-theme="dark"] #page-projects .projects-tabs,
html[data-theme="dark"] #page-projects .projects-panel {
    background: #111827 !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] #page-projects .projects-placeholder-icon {
    background: rgba(96, 165, 250, 0.14) !important;
    color: #93c5fd !important;
    border-color: rgba(96, 165, 250, 0.28) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-projects .projects-list-item:hover {
    background: rgba(96, 165, 250, 0.10) !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-menu {
    color: #94a3b8 !important;
}

html[data-theme="dark"] #page-projects .projects-list-item:hover .projects-list-item-menu,
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-menu:hover,
html[data-theme="dark"] #page-projects .projects-list-item-menu:focus-visible {
    background: rgba(148, 163, 184, 0.16) !important;
    color: #e2e8f0 !important;
}

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

html[data-theme="dark"] #page-projects .projects-detail-meta,
html[data-theme="dark"] #page-projects .projects-list-item-badge {
    background: rgba(96, 165, 250, 0.10) !important;
    color: var(--text-secondary) !important;
    border-color: rgba(96, 165, 250, 0.22) !important;
}

/* WebShell page light gradients are page-specific; keep the empty state dark. */
html[data-theme="dark"] #page-webshell,
html[data-theme="dark"] #page-webshell .webshell-page-content {
    background: #0b1120 !important;
}

html[data-theme="dark"] #page-webshell .webshell-layout {
    background: #111827 !important;
    border-color: #263244 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-webshell .webshell-sidebar,
html[data-theme="dark"] #page-webshell .webshell-main,
html[data-theme="dark"] #page-webshell .webshell-workspace {
    background: #111827 !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] #page-webshell .webshell-sidebar-header,
html[data-theme="dark"] #page-webshell .webshell-conn-search,
html[data-theme="dark"] #page-webshell .webshell-sidebar-tools {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] #page-webshell .webshell-sidebar-tools .btn-ghost,
html[data-theme="dark"] #page-webshell .webshell-conn-search-input {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}

html[data-theme="dark"] #page-webshell .webshell-empty,
html[data-theme="dark"] #page-webshell .webshell-workspace-placeholder {
    background: #0f172a !important;
    color: var(--text-secondary) !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] #page-webshell .webshell-resize-handle {
    background: #263244 !important;
}

html[data-theme="dark"] #page-webshell .webshell-resize-handle:hover,
html[data-theme="dark"] #page-webshell .webshell-resize-handle.active {
    background: var(--accent-color) !important;
}

html[data-theme="dark"] #page-webshell .webshell-item {
    background: #0f172a !important;
    border-color: #2b374b !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-webshell .webshell-item:hover {
    background: #172033 !important;
    border-color: rgba(96, 165, 250, 0.48) !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-trigger,
html[data-theme="dark"] #webshell-modal .webshell-form-select-dropdown {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}

html[data-theme="dark"] #webshell-modal .webshell-form-select-trigger:hover:not(:disabled),
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-dropdown {
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.38) !important;
}

html[data-theme="dark"] #webshell-modal .webshell-form-select-option:hover {
    background: rgba(30, 41, 59, 0.82) !important;
}

html[data-theme="dark"] #webshell-modal .webshell-form-select-option.is-selected {
    background: rgba(59, 130, 246, 0.22) !important;
    color: #bfdbfe !important;
}

/* WebShell memo tab dark theme */
html[data-theme="dark"] #page-webshell .webshell-pane-memo {
    background: #111827 !important;
}

html[data-theme="dark"] #page-webshell .webshell-memo-layout {
    background: #0f172a !important;
    border-color: #2b374b !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-webshell .webshell-memo-head {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] #page-webshell .webshell-memo-input {
    background: #0b1120 !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}

html[data-theme="dark"] #page-webshell .webshell-memo-input::placeholder {
    color: var(--text-muted) !important;
}

html[data-theme="dark"] #page-webshell .webshell-memo-input:focus {
    border-color: rgba(96, 165, 250, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16) !important;
}

html[data-theme="dark"] #page-webshell .webshell-memo-status {
    color: var(--text-secondary) !important;
    background: rgba(96, 165, 250, 0.12) !important;
    border-color: rgba(96, 165, 250, 0.22) !important;
}

/* WebShell connection list action buttons */
html[data-theme="dark"] #page-webshell .webshell-conn-actions-btn,
html[data-theme="dark"] #page-webshell .webshell-row-actions-btn,
html[data-theme="dark"] #page-webshell .webshell-toolbar-actions-btn {
    background: #0f172a !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}

html[data-theme="dark"] #page-webshell .webshell-conn-actions-btn:hover,
html[data-theme="dark"] #page-webshell .webshell-row-actions-btn:hover,
html[data-theme="dark"] #page-webshell .webshell-toolbar-actions-btn:hover {
    background: #172033 !important;
    border-color: rgba(96, 165, 250, 0.48) !important;
}

html[data-theme="dark"] #page-webshell .webshell-tabs {
    border-bottom-color: #263244 !important;
}

html[data-theme="dark"] #page-webshell .webshell-tab:hover {
    background: #172033 !important;
    color: var(--text-primary) !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;
}

html[data-theme="dark"] #external-mcp-modal .password-hint {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #external-mcp-modal .password-hint strong {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] #external-mcp-modal .password-hint code {
    background: #0b1120 !important;
    color: #dbeafe !important;
    border: 1px solid #2b374b;
}

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

html[data-theme="dark"] #hitl-log-modal .hitl-context-label,
html[data-theme="dark"] #hitl-log-modal .hitl-log-detail-row dt {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #hitl-log-modal .hitl-context-block--execution .hitl-context-text {
    background: #0f2318 !important;
    border-color: #166534 !important;
    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-form-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;
}

#role-modal .role-form-select-ui {
    position: relative;
    width: 100%;
    min-width: 0;
}

#role-modal .role-form-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.25;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#role-modal .role-form-select-trigger:hover:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.45);
}

#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-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

#role-modal .role-form-select-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
}

#role-modal .role-form-select-ui.open .role-form-select-caret {
    transform: rotate(180deg);
}

#role-modal .role-form-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

#role-modal .role-form-select-ui.open .role-form-select-dropdown {
    display: block;
}

#role-modal .role-form-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

#role-modal .role-form-select-option:hover {
    background: var(--bg-secondary);
}

#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-check {
    width: 14px;
    flex-shrink: 0;
    visibility: hidden;
    color: #2563eb;
    font-size: 12px;
    line-height: 1;
}

#role-modal .role-form-select-option.is-selected .role-form-select-check {
    visibility: visible;
}

#role-modal .role-form-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 批量任务：新建队列 / 详情内联编辑 — 自定义下拉 */
.batch-form-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;
}

#batch-import-modal .batch-form-select-ui,
#batch-queue-detail-modal .batch-form-select-ui {
    position: relative;
    width: 100%;
    min-width: 0;
}

.batch-form-select-ui--inline {
    display: block;
    width: 100%;
    min-width: 220px;
    max-width: none;
}

.batch-form-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.25;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.batch-form-select-ui--inline .batch-form-select-trigger {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.875rem;
    border-radius: 8px;
    border-width: 1.5px;
    border-color: var(--accent-color);
}

.batch-form-select-trigger:hover:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.45);
}

.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-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.batch-form-select-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
}

.batch-form-select-ui.open .batch-form-select-caret {
    transform: rotate(180deg);
}

.batch-form-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: auto;
    min-width: 100%;
    width: max-content;
    max-width: min(420px, calc(100vw - 48px));
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.batch-form-select-ui.open .batch-form-select-dropdown {
    display: block;
}

.batch-form-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.batch-form-select-option:hover {
    background: var(--bg-secondary);
}

.batch-form-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}

.batch-form-select-check {
    width: 14px;
    flex-shrink: 0;
    visibility: hidden;
    color: #2563eb;
    font-size: 12px;
    line-height: 1;
}

.batch-form-select-option.is-selected .batch-form-select-check {
    visibility: visible;
}

.batch-form-select-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

.batch-form-select-ui--inline .batch-form-select-value {
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
}

.batch-form-select-option .batch-form-select-label {
    overflow: visible;
    text-overflow: unset;
    white-space: nowrap;
}

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

.bq-inline-edit-controls .batch-form-native-select {
    position: absolute;
}

.bq-inline-edit-controls .batch-form-select-ui--inline {
    margin: 0;
    flex: 1 1 240px;
}

#batch-queue-detail-modal .bq-kv__v:has(.bq-inline-edit-controls) {
    overflow: visible;
}

#batch-queue-detail-modal .batch-queue-detail-tech__sum {
    white-space: normal;
    line-height: 1.5;
}

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"] #skill-modal .skill-package-tree-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:hover {
    background: rgba(96, 165, 250, 0.12) !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 .role-tools-list,
html[data-theme="dark"] #role-modal .role-tools-stats,
html[data-theme="dark"] #role-modal .role-tools-default-hint,
html[data-theme="dark"] #role-modal .role-tool-item,
html[data-theme="dark"] #role-modal .role-tools-pagination {
    background: #0f172a !important;
    border-color: #2b374b !important;
}

html[data-theme="dark"] #role-modal .role-tool-item:hover {
    background: #172033 !important;
    border-color: rgba(96, 165, 250, 0.48) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #role-modal .role-tools-search-box input {
    background: #0b1120 !important;
    color: var(--text-primary) !important;
    border-color: #2b374b !important;
}

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

/* 概览区保持透明，让 KPI 与工具统计之间的缝隙透出页面底色 */
html[data-theme="dark"] #page-mcp-monitor .monitor-section.monitor-overview,
html[data-theme="dark"] #page-mcp-monitor .mcp-exec-stats-root,
html[data-theme="dark"] #page-mcp-monitor .mcp-exec-stats {
    background: transparent !important;
    border: none !important;
    box-shadow: none !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 .monitor-section,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-kpi,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-combined,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-panel,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-dist-panel,
html[data-theme="dark"] #page-mcp-monitor .monitor-table-container {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-mcp-monitor .mcp-stats-combined__head,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-combined__timeline,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-panel__head,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-panel__body,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-panel__table-wrap {
    background: #111827 !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] #page-mcp-monitor .mcp-stats-kpi__item:not(:last-child)::after,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-combined__body--full .mcp-stats-combined__timeline,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tool-item__metrics {
    border-color: #263244 !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-combined__col-label,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tools-panel__caption,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-timeline__inline-meta,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-timeline__legend,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tool-item__share,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tools-panel__list-head {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #page-mcp-monitor .mcp-stats-kpi__value,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-combined__title,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tool-item__calls,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tool-item__name,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-panel__title {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] #page-mcp-monitor .mcp-stats-timeline__ranges,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tool-item__track,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-proportion-bar {
    background: #0b1120 !important;
}

html[data-theme="dark"] #page-mcp-monitor .mcp-stats-timeline__range {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #page-mcp-monitor .mcp-stats-timeline__range:hover {
    background: rgba(96, 165, 250, 0.10) !important;
    color: var(--text-primary) !important;
}

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:hover,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tool-item.is-highlighted,
html[data-theme="dark"] #page-mcp-monitor tr.mcp-stats-tool-row[data-tool-name]:hover,
html[data-theme="dark"] #page-mcp-monitor tr.mcp-stats-tool-row[data-tool-name].is-highlighted {
    background: rgba(96, 165, 250, 0.10) !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;
}

html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tool-table,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tool-table thead,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tool-table th,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-tool-table td {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] #page-mcp-monitor .mcp-stats-timeline-grid {
    stroke: rgba(148, 163, 184, 0.22) !important;
}

html[data-theme="dark"] #page-mcp-monitor .mcp-stats-timeline-grid--base {
    stroke: rgba(148, 163, 184, 0.34) !important;
}

html[data-theme="dark"] #page-mcp-monitor .mcp-stats-timeline-axis,
html[data-theme="dark"] #page-mcp-monitor .mcp-stats-timeline-y {
    fill: var(--text-secondary) !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,
html[data-theme="dark"] #page-settings .model-pick-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,
html[data-theme="dark"] #page-settings .model-pick-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 .settings-custom-select-trigger,
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 .settings-custom-select-trigger:hover:not(:disabled),
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 .settings-custom-select-menu,
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 .settings-custom-select-option,
html[data-theme="dark"] #page-settings .audit-custom-select-option {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] #page-settings .settings-custom-select-option:hover:not(:disabled),
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"] #page-settings .settings-custom-select-status {
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
}

html[data-theme="dark"] #page-settings .settings-custom-select-status.ready {
    background: rgba(52, 211, 153, 0.14);
    color: #34d399;
}

html[data-theme="dark"] #page-settings .settings-custom-select-status.failed {
    background: rgba(248, 113, 113, 0.14);
    color: #f87171;
}

html[data-theme="dark"] #page-settings .settings-custom-select-status.testing {
    background: rgba(96, 165, 250, 0.14);
    color: #60a5fa;
}

/* Chat @ tool mention panel dark theme. */
html[data-theme="dark"] .mention-suggestions {
    background: #111827 !important;
    border-color: #2b374b !important;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(148, 163, 184, 0.08) !important;
}

html[data-theme="dark"] .mention-suggestions-list {
    background: transparent !important;
}

html[data-theme="dark"] .mention-item {
    background: #0f172a !important;
    border-color: #263244 !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .mention-item:hover,
html[data-theme="dark"] .mention-item.active,
html[data-theme="dark"] .mention-item:focus,
html[data-theme="dark"] .mention-item:focus-visible {
    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-name,
html[data-theme="dark"] .mention-item-text,
html[data-theme="dark"] .mention-item.active .mention-item-name {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .mention-item-desc,
html[data-theme="dark"] .mention-item-meta,
html[data-theme="dark"] .mention-origin,
html[data-theme="dark"] .mention-empty,
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-status.enabled,
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-status.disabled,
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;
}

html[data-theme="dark"] .mention-item-badge,
html[data-theme="dark"] .mention-item-badge.internal {
    background: rgba(148, 163, 184, 0.12) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(148, 163, 184, 0.22) !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);
}

html[data-theme="dark"] #page-vulnerabilities .stat-stacked-bar {
    background: rgba(148, 163, 184, 0.16) !important;
}

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

html[data-theme="dark"] #batch-import-modal .batch-import-stats {
    background: rgba(96, 165, 250, 0.12) !important;
    color: #bfdbfe !important;
    border-color: rgba(96, 165, 250, 0.28) !important;
}

html[data-theme="dark"] #project-panel-facts .data-table--projects th.col-actions,
html[data-theme="dark"] #project-panel-facts .data-table--projects td.col-actions {
    background: #111827 !important;
    border-color: #263244 !important;
    box-shadow: -6px 0 10px rgba(0, 0, 0, 0.20) !important;
}

html[data-theme="dark"] #project-panel-facts .data-table--projects thead th.col-actions {
    background: #1f2937 !important;
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #project-panel-facts .data-table--projects tbody tr:hover td.col-actions {
    background: #172033 !important;
}

/* Project detail tabs dark-mode final pass. */
html[data-theme="dark"] #page-projects .projects-detail-inner,
html[data-theme="dark"] #page-projects .projects-panel,
html[data-theme="dark"] #page-projects .projects-panel--graph,
html[data-theme="dark"] #page-projects .projects-panel--settings,
html[data-theme="dark"] #page-projects .projects-settings-layout,
html[data-theme="dark"] #page-projects .projects-settings-grid {
    background: #0f172a !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] #page-projects .projects-fact-toolbar,
html[data-theme="dark"] #page-projects .projects-panel-toolbar,
html[data-theme="dark"] #page-projects .projects-table-wrap {
    background: #111827 !important;
    border-color: #263244 !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] #page-projects .projects-fact-toolbar-hint {
    background: rgba(96, 165, 250, 0.12) !important;
    color: #bfdbfe !important;
    border: 1px solid rgba(96, 165, 250, 0.24) !important;
}

html[data-theme="dark"] #page-projects .projects-fact-toolbar-hint-icon {
    color: #93c5fd !important;
}

html[data-theme="dark"] #page-projects .projects-fact-filter-label,
html[data-theme="dark"] #page-projects .projects-form-field label {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #page-projects .data-table--projects,
html[data-theme="dark"] #page-projects .data-table--projects tbody,
html[data-theme="dark"] #page-projects .data-table--projects tbody tr {
    background: #111827 !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] #page-projects .data-table--projects thead th {
    background: #1f2937 !important;
    color: var(--text-secondary) !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] #page-projects .data-table--projects tbody td {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] #page-projects .data-table--projects tbody tr:hover td {
    background: #172033 !important;
}

html[data-theme="dark"] #page-projects .data-table--projects tbody tr.is-empty-row td,
html[data-theme="dark"] #page-projects .projects-empty {
    background: #111827 !important;
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #page-projects #project-panel-facts .data-table--projects th.col-actions,
html[data-theme="dark"] #page-projects #project-panel-facts .data-table--projects td.col-actions {
    background: #111827 !important;
}

html[data-theme="dark"] #page-projects #project-panel-facts .data-table--projects thead th.col-actions {
    background: #1f2937 !important;
}

html[data-theme="dark"] #page-projects .projects-graph-actions {
    background: #0b1120 !important;
    border-color: #263244 !important;
}

html[data-theme="dark"] #page-projects .project-fact-graph-container {
    background-color: #0b1120 !important;
    background-image: radial-gradient(circle at 1px 1px, rgba(96, 165, 250, 0.18) 1px, transparent 0) !important;
    border-color: #263244 !important;
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.06) !important;
}

html[data-theme="dark"] #page-projects .project-fact-graph-container::after {
    background: radial-gradient(ellipse at center, transparent 52%, rgba(15, 23, 42, 0.72) 100%) !important;
}

html[data-theme="dark"] #page-projects .project-fact-graph-empty-icon {
    background: rgba(30, 41, 59, 0.92) !important;
    border-color: #334155 !important;
    color: #93c5fd !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-projects .project-fact-graph-empty-steps,
html[data-theme="dark"] #page-projects .projects-graph-legend-item {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #page-projects #project-panel-graph .project-fact-graph-footer {
    background: transparent !important;
    border-top: 1px solid #263244 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-projects #project-panel-graph .projects-graph-legend {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-projects .projects-graph-legend-heading {
    color: var(--text-muted) !important;
}

html[data-theme="dark"] #page-projects .projects-graph-legend-divider {
    background: #334155 !important;
}

html[data-theme="dark"] #page-projects .projects-graph-legend-item--node i {
    background: linear-gradient(135deg, #1e293b 0%, #172033 100%) !important;
    border-color: var(--legend-color, #64748b) !important;
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.06) !important;
}

html[data-theme="dark"] #page-projects .projects-settings-intro,
html[data-theme="dark"] #page-projects .projects-settings-card,
html[data-theme="dark"] #page-projects .projects-settings-card-head,
html[data-theme="dark"] #page-projects .projects-settings-card-body,
html[data-theme="dark"] #page-projects .projects-settings-footer {
    background: #111827 !important;
    color: var(--text-primary) !important;
    border-color: #263244 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-projects .projects-settings-card--danger {
    background: rgba(127, 29, 29, 0.16) !important;
    border-color: rgba(248, 113, 113, 0.32) !important;
}

html[data-theme="dark"] #page-projects .projects-settings-icon--blue {
    background: rgba(96, 165, 250, 0.14) !important;
    color: #93c5fd !important;
}

html[data-theme="dark"] #page-projects .projects-settings-icon--violet {
    background: rgba(167, 139, 250, 0.14) !important;
    color: #c4b5fd !important;
}

html[data-theme="dark"] #page-projects .projects-settings-icon--red {
    background: rgba(248, 113, 113, 0.14) !important;
    color: #fca5a5 !important;
}

html[data-theme="dark"] #page-projects .projects-scope-toolbar .btn-ghost,
html[data-theme="dark"] #page-projects .btn-danger-outline {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] #page-projects .projects-scope-toolbar .btn-ghost:hover {
    background: rgba(96, 165, 250, 0.14) !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #page-projects .btn-danger-outline {
    color: #fca5a5 !important;
    border-color: rgba(248, 113, 113, 0.38) !important;
}

html[data-theme="dark"] #page-projects .btn-danger-outline:hover {
    background: rgba(248, 113, 113, 0.14) !important;
    color: #fecaca !important;
}

html[data-theme="dark"] #page-projects .projects-scope-editor {
    background: #0b1120 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] #page-projects .projects-fact-toggle span {
    background: #0f172a !important;
    color: var(--text-secondary) !important;
    border-color: #2b374b !important;
    box-shadow: none !important;
}

html[data-theme="dark"] #page-projects .projects-fact-toggle:hover span {
    background: rgba(96, 165, 250, 0.12) !important;
    color: #dbeafe !important;
    border-color: rgba(96, 165, 250, 0.36) !important;
}

html[data-theme="dark"] #page-projects .projects-fact-toggle input:checked + span {
    background: rgba(96, 165, 250, 0.18) !important;
    color: #bfdbfe !important;
    border-color: rgba(96, 165, 250, 0.50) !important;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.14) inset !important;
}

/* 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 drag editor */
.workflow-page-content {
    display: grid;
    grid-template-columns:
        clamp(200px, 16vw, 260px)
        minmax(0, 1fr)
        clamp(220px, 20vw, 300px);
    gap: 14px;
    min-height: calc(100vh - 150px);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.workflow-sidebar,
.workflow-properties,
.workflow-main {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.workflow-panel,
.workflow-properties,
.workflow-meta-bar,
.workflow-canvas-wrap {
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 8px;
}

.workflow-panel {
    margin-bottom: 14px;
    overflow: hidden;
}

.workflow-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.workflow-panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.workflow-list {
    display: grid;
    gap: 8px;
    padding: 12px;
    max-height: 330px;
    overflow: auto;
}

.workflow-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 62px;
    padding: 10px 10px 10px 13px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    box-sizing: border-box;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.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-list-item:hover {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.05);
    transform: translateY(-1px);
}

.workflow-list-main {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 3px;
    text-align: left;
    padding: 2px 0;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.workflow-list-actions {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.workflow-list-edit {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    opacity: 0.62;
    transition: color 0.16s ease, background 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.workflow-list-item:hover .workflow-list-edit,
.workflow-list-edit:focus-visible {
    opacity: 1;
}

.workflow-list-edit:hover {
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.10);
    transform: scale(1.04);
}

.workflow-status-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 3px 7px;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-size: 10px;
    line-height: 1;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.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:hover {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
}

.workflow-status-toggle:focus-visible,
.workflow-list-edit:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.38);
    outline-offset: 2px;
}

.workflow-status-dot {
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.10);
}

.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-switch {
    position: relative;
    display: inline-flex;
    width: 34px;
    height: 20px;
    flex-shrink: 0;
}

.workflow-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.workflow-switch-slider {
    position: absolute;
    inset: 0;
    background: rgba(100, 116, 139, 0.35);
    border-radius: 999px;
    transition: background 0.2s ease;
    cursor: pointer;
}

.workflow-switch-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
    transition: transform 0.2s ease;
}

.workflow-switch input:checked + .workflow-switch-slider {
    background: var(--accent-color);
}

.workflow-switch input:checked + .workflow-switch-slider::before {
    transform: translateX(14px);
}

.workflow-switch input:focus-visible + .workflow-switch-slider {
    outline: 2px solid rgba(59, 130, 246, 0.45);
    outline-offset: 2px;
}

.workflow-switch--modal {
    width: 42px;
    height: 24px;
}

.workflow-switch--modal .workflow-switch-slider::before {
    width: 18px;
    height: 18px;
    top: 3px;
    left: 3px;
}

.workflow-switch--modal input:checked + .workflow-switch-slider::before {
    transform: translateX(18px);
}

.workflow-list-title {
    font-weight: 700;
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-list-meta {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-node-palette {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
}

.workflow-node-palette button {
    padding: 10px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: grab;
}

.workflow-node-palette button:active {
    cursor: grabbing;
}

.workflow-main {
    display: grid;
    grid-template-rows: auto minmax(520px, 1fr);
    gap: 14px;
    min-width: 0;
}

.workflow-meta-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0;
    padding: 8px 10px 8px 12px;
    min-height: 44px;
    box-sizing: border-box;
    background: var(--bg-primary);
    box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.06);
}

.workflow-canvas-header {
    min-width: 0;
    padding-right: 12px;
}

.workflow-canvas-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    padding: 5px 12px;
    min-height: 32px;
    box-sizing: border-box;
    border-radius: 7px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.workflow-canvas-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    flex-shrink: 0;
    max-width: 40%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workflow-canvas-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
    min-width: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workflow-canvas-subtitle::before {
    content: '·';
    margin-right: 8px;
    opacity: 0.45;
}

.workflow-canvas-title.is-disabled {
    opacity: 0.7;
}

.workflow-meta-modal-content {
    max-width: 340px;
    width: calc(100vw - 32px);
    margin: 12vh auto auto;
    height: auto !important;
    max-height: none !important;
}

.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 label {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    color: var(--text-secondary);
}

.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-meta-modal-content .workflow-meta-id-hint {
    margin: 1px 0 0;
    font-size: 10px;
    line-height: 1.25;
}

.workflow-meta-modal-content .workflow-meta-id-locked {
    display: flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 8px;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    box-sizing: border-box;
}

.workflow-meta-modal-content .workflow-meta-id-locked[hidden] {
    display: none !important;
}

.workflow-meta-modal-content .workflow-meta-id-input[hidden] {
    display: none !important;
}

.workflow-meta-modal-content .workflow-meta-id-locked code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: var(--text-primary);
    word-break: break-all;
    line-height: 1.2;
}

.workflow-meta-id-group.is-locked .workflow-meta-id-hint {
    display: none;
}

.workflow-meta-modal-content .workflow-meta-enable-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    padding: 4px 0 0;
    border-top: 1px solid var(--border-color);
}

.workflow-meta-modal-content .workflow-meta-enable-label {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

.workflow-meta-modal-content .workflow-switch--modal {
    width: 36px;
    height: 20px;
}

.workflow-meta-modal-content .workflow-switch--modal .workflow-switch-slider::before {
    width: 14px;
    height: 14px;
    top: 3px;
    left: 3px;
}

.workflow-meta-modal-content .workflow-switch--modal input:checked + .workflow-switch-slider::before {
    transform: translateX(16px);
}

.workflow-dry-run-modal-content {
    width: min(420px, calc(100vw - 32px));
    max-width: 420px;
    height: auto !important;
    margin: 14vh auto auto;
    border-radius: 14px;
}

.workflow-dry-run-modal-content .workflow-dry-run-modal-header {
    padding: 14px 18px;
    box-shadow: none;
}

.workflow-dry-run-modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.workflow-dry-run-modal-icon {
    width: 30px;
    height: 30px;
    display: inline-grid;
    flex: 0 0 30px;
    place-items: center;
    color: var(--accent-color);
    border-radius: 9px;
    background: color-mix(in srgb, var(--accent-color) 10%, var(--bg-primary));
}

.workflow-dry-run-modal-content .workflow-dry-run-modal-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.workflow-dry-run-modal-content .workflow-dry-run-modal-body {
    padding: 18px;
    overflow: visible;
}

.workflow-dry-run-modal-field.form-group {
    gap: 7px;
    margin: 0;
}

.workflow-dry-run-modal-field label {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.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: 11px;
    line-height: 1.45;
}

.workflow-dry-run-modal-content .workflow-dry-run-modal-footer {
    gap: 8px;
    padding: 12px 18px;
}

.workflow-ai-modal-content {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    overflow: hidden;
}

.workflow-ai-modal-header {
    align-items: flex-start;
}

.workflow-ai-modal-header h2 {
    margin-bottom: 4px;
}

.workflow-ai-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.workflow-ai-modal-body {
    display: grid;
    gap: 14px;
    max-height: min(66vh, 640px);
    overflow-y: auto;
}

.workflow-ai-prompt-field textarea {
    resize: vertical;
    min-height: 116px;
}

.workflow-ai-examples,
.workflow-ai-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.workflow-ai-options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 13px;
}

.workflow-ai-result {
    display: grid;
    gap: 10px;
}

.workflow-ai-result:empty {
    display: none;
}

.workflow-ai-result-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.workflow-ai-progress {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.workflow-ai-progress[hidden] {
    display: none;
}

.workflow-ai-progress span {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.workflow-ai-progress b {
    display: inline-grid;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 50%;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 12px;
}

.workflow-ai-progress small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.workflow-ai-progress .is-complete b {
    background: #16a34a;
    color: white;
}

.workflow-ai-preview {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.workflow-ai-preview-title {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.workflow-ai-preview-flow {
    display: flex;
    align-items: center;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.workflow-ai-preview-flow i {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-style: normal;
}

.workflow-ai-preview-node {
    display: grid;
    flex: 0 0 auto;
    gap: 2px;
    width: 128px;
    min-height: 48px;
    padding: 7px 9px;
    border: 1px solid color-mix(in srgb, var(--accent-color) 22%, var(--border-color));
    border-radius: 8px;
    background: var(--bg-primary);
}

.workflow-ai-preview-node small {
    color: var(--text-secondary);
    font-size: 11px;
}

.workflow-ai-preview-node strong {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-ai-preview-node.is-risky {
    border-color: rgba(249, 115, 22, 0.62);
    background: rgba(249, 115, 22, 0.08);
}

.workflow-ai-result-grid span,
.workflow-ai-result-section {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.workflow-ai-result-grid span {
    display: grid;
    gap: 4px;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 12px;
}

.workflow-ai-result-grid strong {
    color: var(--text-primary);
    font-size: 16px;
}

.workflow-ai-result-section {
    padding: 10px 12px;
    font-size: 13px;
}

.workflow-ai-result-section p {
    margin: 4px 0 0;
    color: var(--text-secondary);
}

.workflow-ai-result-section ul {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--text-secondary);
}

.workflow-ai-result-section.is-warning {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.08);
}

.workflow-ai-result-section.is-attention {
    border-color: rgba(14, 165, 233, 0.42);
    background: rgba(14, 165, 233, 0.08);
}

.workflow-ai-modal-footer {
    gap: 8px;
}

@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));
    }
}

html[data-theme="dark"] .workflow-dry-run-modal-icon {
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.14);
}

.form-required {
    color: #ef4444;
}

.workflow-toolbar {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    white-space: nowrap;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
    min-height: 32px;
}

.workflow-toolbar .btn-small,
.workflow-more-actions-trigger {
    min-height: 30px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
}

.workflow-toolbar-button,
.workflow-save-button,
.workflow-more-actions-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.workflow-toolbar-button svg,
.workflow-save-button svg,
.workflow-more-actions-trigger svg,
.workflow-more-actions-menu svg {
    flex: 0 0 auto;
}

.workflow-toolbar-group {
    display: inline-flex;
    align-items: center;
}

.workflow-toolbar-group .workflow-toolbar-button {
    border-radius: 0;
}

.workflow-toolbar-group .workflow-toolbar-button:first-child {
    border-radius: 7px 0 0 7px;
}

.workflow-toolbar-group .workflow-toolbar-button:last-child {
    margin-left: -1px;
    border-radius: 0 7px 7px 0;
}

.workflow-toolbar .workflow-run-button {
    color: var(--accent-color);
    border-color: color-mix(in srgb, var(--accent-color) 40%, var(--border-color));
    background: color-mix(in srgb, var(--accent-color) 7%, var(--bg-primary));
}

html[data-theme="dark"] .workflow-toolbar .workflow-run-button {
    color: #bfdbfe;
    border-color: rgba(96, 165, 250, 0.38);
    background: rgba(96, 165, 250, 0.08);
}

.workflow-more-actions {
    position: relative;
    flex: 0 0 auto;
}

.workflow-more-actions > summary {
    list-style: none;
    cursor: pointer;
    box-sizing: border-box;
}

.workflow-more-actions > summary::-webkit-details-marker {
    display: none;
}

.workflow-more-actions[open] .workflow-more-actions-trigger {
    color: var(--accent-color);
    border-color: color-mix(in srgb, var(--accent-color) 45%, var(--border-color));
    background: color-mix(in srgb, var(--accent-color) 9%, var(--bg-primary));
}

.workflow-more-actions-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    width: 158px;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

.workflow-more-actions-menu button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.workflow-more-actions-menu button:hover,
.workflow-more-actions-menu button:focus-visible {
    outline: none;
    background: var(--bg-secondary);
}

.workflow-more-actions-menu .workflow-more-actions-danger {
    color: #dc2626;
}

.workflow-more-actions-menu .workflow-more-actions-danger:hover,
.workflow-more-actions-menu .workflow-more-actions-danger:focus-visible {
    background: rgba(239, 68, 68, 0.09);
}

.workflow-more-actions-divider {
    height: 1px;
    margin: 4px 3px;
    background: var(--border-color);
}

.workflow-more-actions-menu button[hidden] + .workflow-more-actions-divider,
.workflow-more-actions-menu .workflow-more-actions-divider:has(+ button[hidden]) {
    display: none;
}

.workflow-toolbar .workflow-save-button {
    min-width: 72px;
    color: #fff;
    border: 1px solid var(--accent-color);
    background: var(--accent-color);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.18);
}

.workflow-toolbar .workflow-save-button:hover {
    color: #fff;
    border-color: var(--accent-hover);
    background: var(--accent-hover);
}

.workflow-toolbar .active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

html[data-theme="dark"] .workflow-toolbar #workflow-connect-btn[aria-pressed="true"] {
    color: #bfdbfe;
    border-color: rgba(96, 165, 250, 0.58);
    background: rgba(37, 99, 235, 0.18);
    box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.06), 0 0 0 2px rgba(37, 99, 235, 0.05);
}

html[data-theme="dark"] .workflow-toolbar #workflow-connect-btn[aria-pressed="true"]:hover {
    color: #dbeafe;
    border-color: rgba(96, 165, 250, 0.72);
    background: rgba(37, 99, 235, 0.24);
}

@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-wrap {
    position: relative;
    min-height: 520px;
    overflow: hidden;
}

#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-canvas-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    pointer-events: none;
    font-weight: 600;
}

.workflow-ai-canvas-status {
    position: absolute;
    top: 14px;
    left: 50%;
    z-index: 2;
    transform: translateX(-50%);
    padding: 9px 14px;
    border: 1px solid color-mix(in srgb, var(--accent-color) 35%, var(--border-color));
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-primary) 92%, var(--accent-color));
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    pointer-events: none;
}

.workflow-ai-canvas-status[hidden] {
    display: none;
}

.workflow-properties {
    display: flex;
    flex-direction: column;
    min-height: 0;
    align-self: stretch;
    padding-bottom: 12px;
    overflow: hidden;
}

.workflow-properties > .workflow-panel-header {
    flex-shrink: 0;
}

.workflow-properties > .workflow-property-empty,
.workflow-properties > .workflow-property-form {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.workflow-properties > .workflow-dry-run-panel {
    flex: 0 0 auto;
    max-height: 42%;
    overflow-y: auto;
}

.workflow-property-empty {
    margin: 14px;
    padding: 18px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    text-align: center;
}

.workflow-property-empty--compact {
    margin: 0;
    padding: 12px;
}

.workflow-property-form {
    padding: 14px;
}

.workflow-config-hint {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.workflow-config-hint code {
    font-size: 11px;
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--bg-secondary, rgba(127, 127, 127, 0.12));
}

.workflow-custom-fields-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 14px 0 8px;
    font-weight: 700;
}

.workflow-dry-run-panel {
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.workflow-dry-run-head {
    margin-top: 0;
}

.workflow-dry-run-close {
    flex-shrink: 0;
}

.workflow-dry-run-step {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.workflow-dry-run-step:last-child {
    border-bottom: none;
}

.workflow-dry-run-step span {
    color: var(--text-secondary);
    font-size: 12px;
}

.workflow-custom-fields {
    display: grid;
    gap: 8px;
}

.workflow-custom-field {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) 32px;
    gap: 6px;
}

.workflow-custom-field input {
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.workflow-custom-field button {
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
}

.workflow-tool-native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

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

.workflow-form-select-ui {
    position: relative;
    width: 100%;
    min-width: 0;
}

.workflow-binding-row .workflow-form-select-ui {
    flex: 1;
    min-width: 0;
}

.workflow-form-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.workflow-form-select-trigger:hover:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.45);
}

.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-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-form-select-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
}

.workflow-form-select-ui.open .workflow-form-select-caret {
    transform: rotate(180deg);
}

.workflow-form-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.workflow-form-select-ui.open .workflow-form-select-dropdown {
    display: block;
}

.workflow-form-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.workflow-form-select-option:hover {
    background: var(--bg-secondary);
}

.workflow-form-select-option.is-selected {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    font-weight: 500;
}

.workflow-form-select-check {
    width: 14px;
    flex-shrink: 0;
    visibility: hidden;
    color: #2563eb;
    font-size: 12px;
    line-height: 1;
}

.workflow-form-select-option.is-selected .workflow-form-select-check {
    visibility: visible;
}

.workflow-form-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-tool-select {
    position: relative;
    width: 100%;
    min-width: 0;
}

.workflow-tool-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.workflow-tool-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-tool-select-caret {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1;
    transition: transform 0.2s ease;
}

.workflow-tool-select.open .workflow-tool-select-caret {
    transform: rotate(180deg);
}

.workflow-tool-select-trigger:hover:not(:disabled) {
    border-color: var(--accent-color);
}

.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-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 300;
    max-height: 280px;
    overflow: hidden;
    padding: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    flex-direction: column;
}

.workflow-tool-select.open .workflow-tool-select-dropdown {
    display: flex;
}

.workflow-tool-select-search {
    flex-shrink: 0;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.workflow-tool-select-search-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8125rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.workflow-tool-select-search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.workflow-tool-select-search-input::placeholder {
    color: var(--text-muted);
}

.workflow-tool-select-options {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 4px;
}

.workflow-tool-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
}

.workflow-tool-select-option:hover {
    background: var(--bg-secondary);
}

.workflow-tool-select-option.is-selected {
    color: var(--accent-color);
    font-weight: 600;
    background: rgba(0, 102, 255, 0.08);
}

.workflow-tool-select-check {
    flex: 0 0 14px;
    width: 14px;
    color: var(--accent-color);
    opacity: 0;
    font-size: 0.75rem;
    line-height: 1;
}

.workflow-tool-select-option.is-selected .workflow-tool-select-check {
    opacity: 1;
}

.workflow-tool-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-tool-select-empty {
    padding: 10px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.4;
}

@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-page-subtitle { margin: 5px 0 0; color: var(--text-secondary); font-size: 0.8125rem; }

.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 {
    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-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 {
    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-assignment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.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-assignment-toolbar {
    margin-bottom: 0;
}

.rbac-assignment-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 160px;
}

.rbac-assignment-field label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
}

.rbac-assignment-field--id {
    flex: 1;
    min-width: 280px;
}

.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 {
    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-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-button-count {
    min-width: 18px;
    margin-left: 5px;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 0.6875rem;
}

.rbac-assignment-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0 9px;
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.rbac-assignment-list-head span {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.rbac-assignment-row {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--bg-primary);
}

.rbac-resource-selection-bar {
    display: none !important;
}

.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: column;
    gap: 6px;
    min-width: 0;
}

.rbac-audit-filter > span {
    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-resource {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.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-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-user-meta {
    width: 100%;
    max-width: none;
}

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

/* 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 {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 0;
}

.rbac-assignment-toolbar-main {
    display: grid;
    grid-template-columns: minmax(140px, 180px) minmax(280px, 1fr);
    align-items: end;
    gap: 10px;
}

.rbac-assignment-field--search,
.rbac-assignment-field--id {
    min-width: 0;
}

.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-field .settings-custom-select-trigger,
#rbac-role-modal .settings-custom-select-trigger {
    min-height: 40px;
    height: 40px;
}

.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-assignment-list-head {
    padding-top: 3px;
}

.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 management */
.asset-page-subtitle { margin: 5px 0 0; color: var(--text-secondary, #6b7280); font-size: 13px; font-weight: 400; }
.asset-content { display: flex; flex-direction: column; gap: 20px; }
#page-asset-library .asset-content { overflow: visible; }
#page-asset-library .asset-toolbar { flex: 0 0 auto; }
.asset-overview-summary { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(270px, .75fr); gap: 16px; }
.asset-total-card,.asset-recent-card,.asset-panel { border: 1px solid var(--border-color, #e5e7eb); border-radius: 16px; background: var(--card-bg, #fff); box-shadow: 0 8px 24px rgba(15,23,42,.035); }
.asset-total-card { min-width: 0; padding: 22px 24px 20px; }
.asset-total-card__layout { display: grid; grid-template-columns: minmax(300px,.92fr) minmax(360px,1.08fr); align-items: stretch; gap: 24px; }
.asset-inventory-summary { display: flex; min-width: 0; flex-direction: column; }
.asset-total-card__heading { display: flex; align-items: center; gap: 12px; }
.asset-total-card__heading p { margin: 4px 0 0; color: var(--text-secondary, #6b7280); font-size: 12px; }
.asset-overview-icon { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border-radius: 11px; }
.asset-overview-icon svg { width: 21px; height: 21px; }
.asset-overview-icon--blue { background: rgba(37,99,235,.11); color: #3b82f6; }
.asset-overview-icon--violet { background: rgba(99,102,241,.11); color: #6366f1; }
.asset-eyebrow { color: var(--text-primary, #111827); font-size: 14px; font-weight: 650; }
.asset-total-value { display: block; margin: 24px 0 22px; color: var(--text-primary, #111827); font-size: clamp(42px, 4vw, 58px); font-weight: 720; letter-spacing: -.045em; line-height: .9; }
.asset-type-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); overflow: hidden; border: 1px solid var(--border-color, #e5e7eb); border-radius: 11px; background: var(--bg-secondary, #f8fafc); }
.asset-type-item { display: grid; grid-template-columns: auto minmax(0,1fr); grid-template-areas: "dot label" "value value"; align-items: center; gap: 8px; min-width: 0; padding: 11px 14px; }
.asset-type-item + .asset-type-item { border-left: 1px solid var(--border-color, #e5e7eb); }
.asset-type-item > span:not(.asset-type-dot) { grid-area: label; overflow: hidden; color: var(--text-secondary, #64748b); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.asset-type-item strong { grid-area: value; color: var(--text-primary, #111827); font-size: 18px; }
.asset-type-dot { grid-area: dot; width: 7px; height: 7px; border-radius: 50%; background: #3b82f6; box-shadow: 0 0 0 4px rgba(59,130,246,.10); }
.asset-type-item--domain .asset-type-dot { background: #8b5cf6; box-shadow: 0 0 0 4px rgba(139,92,246,.10); }
.asset-type-item--port .asset-type-dot { background: #14b8a6; box-shadow: 0 0 0 4px rgba(20,184,166,.10); }
.asset-protocol-compact { min-width: 0; padding-left: 24px; border-left: 1px solid var(--border-color,#e5e7eb); }
.asset-protocol-compact__header { display: flex; min-height: 40px; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.asset-protocol-compact__header h3 { margin: 0; color: var(--text-primary,#111827); font-size: 14px; }
.asset-protocol-compact__header p { margin: 4px 0 0; color: var(--text-secondary,#64748b); font-size: 11px; }
.asset-protocol-compact .asset-protocol-columns { grid-template-columns: 94px minmax(90px,1fr) 46px 42px; padding-right: 6px; padding-left: 6px; }
.asset-protocol-compact .asset-bar-row { grid-template-columns: 94px minmax(90px,1fr) 46px 42px; min-height: 28px; padding: 2px 6px; }
.asset-protocol-compact .asset-bar-chart { min-height: 142px; }
.asset-protocol-empty { display: grid; min-height: 142px; place-content: center; text-align: center; }
.asset-protocol-empty span { color: var(--text-muted,#94a3b8); font-size: 24px; line-height: 1; }
.asset-protocol-empty p { margin: 7px 0 0; color: var(--text-secondary,#64748b); font-size: 11px; }
.asset-recent-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; padding: 22px; color: var(--text-primary,#111827); }
.asset-recent-card__top { display: flex; align-items: center; justify-content: space-between; }
.asset-recent-badge { padding: 5px 8px; border: 1px solid var(--border-color,#e5e7eb); border-radius: 999px; background: var(--bg-secondary,#f8fafc); color: var(--text-secondary,#64748b); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.asset-recent-card__body { display: flex; margin-top: 28px; flex-direction: column; gap: 7px; padding: 0; }
.asset-recent-card__body span { color: var(--text-secondary,#64748b); font-size: 13px; }
.asset-recent-card__body strong { font-size: clamp(38px,3.5vw,52px); font-weight: 720; letter-spacing: -.04em; line-height: 1; }
.asset-recent-progress { height: 5px; margin-top: auto; overflow: hidden; border-radius: 999px; background: var(--bg-secondary,#eef2f7); }
.asset-recent-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#3b82f6,#8b5cf6); transition: width .35s ease; }
.asset-recent-caption { margin: 9px 0 0; color: var(--text-secondary,#64748b); font-size: 11px; }
.asset-insight-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 2px 0; }
.asset-insight-heading h3 { margin: 0; color: var(--text-primary,#111827); font-size: 17px; }
.asset-insight-heading p { margin: 5px 0 0; color: var(--text-secondary,#64748b); font-size: 12px; }
.asset-period-switch { display: inline-flex; padding: 3px; border: 1px solid var(--border-color,#e5e7eb); border-radius: 9px; background: var(--card-bg,#fff); }
.asset-period-switch button { min-width: 54px; height: 29px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text-secondary,#64748b); cursor: pointer; font: inherit; font-size: 11px; }
.asset-period-switch button:hover { color: var(--text-primary,#111827); }
.asset-period-switch button.active { background: rgba(59,130,246,.12); color: #2563eb; font-weight: 650; }
.asset-trend-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.asset-trend-panel { min-width: 0; }
.asset-trend-panel .asset-panel-header { min-height: 42px; margin-bottom: 14px; }
.asset-trend-header { display: grid; grid-template-columns: minmax(190px,1fr) auto; grid-template-areas: "heading legend" "heading summary"; align-items: center; column-gap: 24px; row-gap: 8px; }
.asset-trend-heading { grid-area: heading; min-width: 0; }
.asset-trend-header .asset-chart-legend { grid-area: legend; }
.asset-trend-header .asset-chart-summary { grid-area: summary; justify-content: flex-end; }
.asset-chart-legend { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.asset-chart-legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--text-secondary,#64748b); font-size: 10px; white-space: nowrap; }
.asset-chart-legend span::before { width: 7px; height: 7px; border-radius: 50%; background: #3b82f6; content: ''; }
.asset-chart-legend .asset-legend-inactive::before { background: #8b5cf6; }
.asset-chart-legend .asset-legend-risk::before { background: #f59e0b; }
.asset-chart-legend .asset-legend-high::before { background: #ef4444; }
.asset-line-chart { min-height: 220px; }
.asset-line-chart svg { display: block; width: 100%; height: 220px; overflow: visible; color: var(--text-muted,#94a3b8); }
.asset-chart-grid line { stroke: var(--border-color,#e5e7eb); stroke-width: 1; stroke-dasharray: 3 4; }
.asset-chart-grid text { fill: currentColor; font-size: 9px; }
.asset-chart-summary { display: flex; align-items: center; gap: 18px; padding: 0; }
.asset-chart-summary div { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.asset-chart-summary span { color: var(--text-secondary,#64748b); font-size: 10px; }
.asset-chart-summary strong { font-size: 17px; line-height: 1; }
.asset-coverage-layout { display: grid; grid-template-columns: 230px minmax(0,1fr); align-items: center; gap: 24px; }
.asset-coverage-overview { min-width: 0; padding: 6px 24px 6px 4px; border-right: 1px solid var(--border-color,#e5e7eb); }
.asset-coverage-gauge { --asset-coverage-value: 0%; --asset-coverage-color: #3b82f6; width: 100%; }
.asset-coverage-gauge.is-critical { --asset-coverage-color: #ef4444; }
.asset-coverage-gauge.is-warning { --asset-coverage-color: #f59e0b; }
.asset-coverage-gauge.is-healthy { --asset-coverage-color: #10b981; }
.asset-coverage-gauge::after { display: block; width: 100%; height: 5px; margin-top: 16px; border-radius: 999px; background: linear-gradient(90deg,var(--asset-coverage-color) 0 var(--asset-coverage-value),var(--bg-secondary,#eef2f7) var(--asset-coverage-value) 100%); content: ''; transition: background .3s ease; }
.asset-coverage-gauge strong,.asset-coverage-gauge span { display: block; }
.asset-coverage-gauge strong { color: var(--text-primary,#111827); font-size: 32px; letter-spacing: -.04em; line-height: 1; }
.asset-coverage-gauge span { margin-top: 7px; color: var(--text-secondary,#64748b); font-size: 11px; }
.asset-coverage-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); overflow: hidden; border: 1px solid var(--border-color,#e5e7eb); border-radius: 12px; }
.asset-coverage-metrics > div { box-sizing: border-box; min-width: 0; min-height: 104px; padding: 14px 16px; }
.asset-coverage-metrics > div + div { border-left: 1px solid var(--border-color,#e5e7eb); }
.asset-coverage-metrics span,.asset-coverage-metrics strong,.asset-coverage-metrics small { display: block; }
.asset-coverage-metrics span { color: var(--text-secondary,#64748b); font-size: 11px; }
.asset-coverage-metrics strong { margin-top: 11px; color: var(--text-primary,#111827); font-size: 24px; letter-spacing: -.025em; line-height: 1; }
.asset-coverage-metrics small { margin-top: 8px; color: var(--text-muted,#94a3b8); font-size: 9px; line-height: 1.4; }
.asset-coverage-metric--never.has-gap strong { color: #f59e0b; }
.asset-coverage-metric--stale.has-gap strong { color: #ef4444; }
.asset-panel { padding: 22px 24px 24px; }
.asset-panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.asset-panel-header h3 { margin: 0; font-size: 16px; }
.asset-panel-header p { margin: 6px 0 0; color: var(--text-secondary, #64748b); font-size: 12px; }
.asset-panel-meta { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: var(--bg-secondary, #f1f5f9); color: var(--text-secondary, #64748b); font-size: 11px; }
.asset-panel-meta.is-critical { background: rgba(239,68,68,.10); color: #dc2626; }
.asset-panel-meta.is-warning { background: rgba(245,158,11,.12); color: #d97706; }
.asset-panel-meta.is-healthy { background: rgba(16,185,129,.11); color: #059669; }
.asset-protocol-columns { display: grid; grid-template-columns: 26px 94px minmax(140px,1fr) 46px 42px; align-items: center; gap: 12px; margin-bottom: 7px; padding: 0 12px 9px; border-bottom: 1px solid var(--border-color,#e5e7eb); color: var(--text-muted,#94a3b8); font-size: 9px; }
.asset-protocol-columns span:nth-last-child(-n+2) { text-align: right; }
.asset-bar-chart { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.asset-bar-row { display: grid; grid-template-columns: 26px 94px minmax(140px,1fr) 46px 42px; min-height: 35px; align-items: center; gap: 12px; padding: 3px 12px; border-radius: 7px; transition: background .15s; }
.asset-bar-row:hover { background: var(--bg-secondary,#f8fafc); }
.asset-bar-rank { color: var(--text-muted, #94a3b8); font: 10px ui-monospace,SFMono-Regular,Menlo,monospace; }
.asset-bar-label { display: flex; align-items: center; gap: 7px; color: var(--text-primary,#111827); font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.asset-bar-label::before { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 2px; background: var(--protocol-color,#3b82f6); content: ''; }
.asset-bar-track { height: 6px; overflow: hidden; border-radius: 999px; background: var(--bg-secondary, #eef2f7); }
.asset-bar-track i { display: block; height: 100%; border-radius: inherit; background: var(--protocol-color,#3b82f6); }
.asset-bar-row strong,.asset-bar-row small { text-align: right; }
.asset-bar-row strong { font-size: 11px; }
.asset-bar-row small { color: var(--text-secondary, #6b7280); font-size: 11px; }
.asset-toolbar { display: flex; align-items: stretch; gap: 12px; flex-direction: column; padding: 14px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 12px; background: var(--card-bg, #fff); }
.asset-toolbar-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.asset-toolbar-main > input { min-width: 300px; flex: 1; }
.asset-toolbar select { min-width: 130px; }
.asset-toolbar input,.asset-toolbar select { height: 38px; padding: 0 12px; border: 1px solid var(--border-color, #d8dee8); border-radius: 8px; background: var(--input-bg, #fff); color: var(--text-primary, #111827); }
.asset-advanced-filters { display: grid; grid-template-columns: repeat(5,minmax(140px,1fr)); gap: 12px; padding-top: 14px; border-top: 1px solid var(--border-color,#e5e7eb); }
.asset-advanced-filters[hidden] { display: none; }
.asset-advanced-filters label { display: flex; min-width: 0; flex-direction: column; gap: 6px; color: var(--text-secondary,#64748b); font-size: 11px; font-weight: 600; }
.asset-advanced-filters input,.asset-advanced-filters select { box-sizing: border-box; width: 100%; min-width: 0; font-size: 12px; font-weight: 400; }
.asset-saved-views { display: flex; align-items: center; gap: 9px; padding-top: 12px; border-top: 1px dashed var(--border-color,#e5e7eb); }
.asset-saved-views select { min-width: 220px; }
.asset-custom-select { width: 100%; min-width: 0; font-weight: 400; }
.asset-custom-select--filter { width: auto; min-width: 150px; flex: 0 0 auto; }
.asset-advanced-filters .asset-custom-select--filter { width: 100%; min-width: 0; }
.asset-custom-select--saved-view { width: 220px; min-width: 220px; flex: 0 0 220px; }
.asset-custom-select .settings-custom-select-trigger { height: 42px; min-height: 42px; border-color: var(--border-color, #d8dee8); border-radius: 8px; background: var(--input-bg, #fff); color: var(--text-primary, #111827); font-size: 13px; font-weight: 400; }
.asset-custom-select .settings-custom-select-caret { width: 16px; height: 16px; color: var(--text-secondary, #64748b); font-size: 0; }
.asset-custom-select .settings-custom-select-caret::before { display: block; width: 7px; height: 7px; margin: 2px auto 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; content: ''; transform: rotate(45deg); }
.asset-custom-select.open .settings-custom-select-caret { transform: rotate(180deg); }
.asset-custom-select .settings-custom-select-menu { min-width: 100%; padding: 5px; border-color: var(--border-color, #d8dee8); border-radius: 9px; background: var(--input-bg, #fff); color: var(--text-primary, #111827); box-shadow: 0 12px 28px rgba(15,23,42,.16); }
.asset-custom-select .settings-custom-select-option { min-height: 34px; border-radius: 6px; color: var(--text-primary, #111827); font-size: 13px; }
.asset-custom-select .settings-custom-select-option:hover:not(:disabled) { background: var(--bg-secondary, #f4f6f8); }
.asset-custom-select .settings-custom-select-option.is-selected { background: rgba(59,130,246,.12); color: var(--accent-color,#2563eb); }
.asset-custom-select--filter .settings-custom-select-trigger { height: 38px; min-height: 38px; padding: 7px 11px; }
.asset-custom-select--pagination { width: 88px; flex: 0 0 88px; }
.asset-custom-select--pagination .settings-custom-select-trigger { height: 32px; min-height: 32px; padding: 5px 9px; }
.asset-custom-select--pagination .settings-custom-select-menu { top: auto; bottom: calc(100% + 6px); }
.asset-custom-select--pagination .settings-custom-select-label { overflow: visible; text-overflow: clip; }
.asset-batch-actions { position: relative; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border: 1px solid rgba(37,99,235,.32); border-radius: 10px; background: rgba(37,99,235,.07); }
.asset-batch-actions[hidden] { display: none; }
.asset-batch-selection { display: flex; min-width: 0; align-items: center; gap: 9px; color: var(--text-primary, #111827); font-size: 13px; }
.asset-batch-selection-mark { position: relative; width: 20px; height: 20px; flex: 0 0 20px; border-radius: 6px; background: var(--accent-color, #2563eb); }
.asset-batch-selection-mark::after { position: absolute; top: 4px; left: 7px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; content: ''; transform: rotate(45deg); }
.asset-batch-selection strong { flex: 0 0 auto; font-size: 13px; font-weight: 700; white-space: nowrap; }
.asset-batch-text-action { padding: 2px 0; border: 0; background: transparent; color: var(--text-secondary, #64748b); cursor: pointer; font: inherit; font-size: 12px; white-space: nowrap; }
.asset-batch-text-action:hover { color: var(--accent-color, #2563eb); }
.asset-batch-text-action:focus-visible { border-radius: 4px; outline: 2px solid rgba(37,99,235,.45); outline-offset: 2px; }
.asset-batch-select-all { padding-left: 10px; border-left: 1px solid rgba(37,99,235,.22); color: var(--accent-color, #2563eb); font-weight: 600; }
.asset-batch-all-selected { overflow: hidden; color: var(--accent-color, #2563eb); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.asset-batch-primary-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.asset-batch-more { position: relative; }
.asset-batch-more > summary { display: inline-flex; min-width: 72px; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box; list-style: none; cursor: pointer; user-select: none; }
.asset-batch-more > summary::-webkit-details-marker { display: none; }
.asset-batch-more > summary::after { width: 6px; height: 6px; margin-top: -3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; content: ''; transform: rotate(45deg); transition: transform .15s ease; }
.asset-batch-more[open] > summary::after { margin-top: 3px; transform: rotate(225deg); }
.asset-batch-more[open] > summary { border-color: var(--accent-color, #2563eb); color: var(--accent-color, #2563eb); }
.asset-batch-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 210px; padding: 6px; border: 1px solid var(--border-color, #d8dee8); border-radius: 10px; background: var(--card-bg, #fff); box-shadow: 0 16px 36px rgba(15,23,42,.18); }
.asset-batch-menu button { display: flex; box-sizing: border-box; width: 100%; min-height: 36px; align-items: center; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-primary, #111827); cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.asset-batch-menu button:hover:not(:disabled),.asset-batch-menu button:focus-visible { outline: none; background: var(--bg-secondary, #f4f6f8); }
.asset-batch-menu button:disabled { cursor: not-allowed; opacity: .42; }
.asset-batch-menu-label { padding: 5px 10px 3px; color: var(--text-muted, #94a3b8); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.asset-batch-menu-separator { height: 1px; margin: 5px 4px; background: var(--border-color, #e5e7eb); }
.asset-batch-menu .asset-batch-menu-danger { color: #dc2626; }
.asset-batch-menu .asset-batch-menu-danger:hover:not(:disabled),.asset-batch-menu .asset-batch-menu-danger:focus-visible { background: rgba(220,38,38,.08); }
.asset-batch-permission-action { display: contents; }
.asset-list-meta { margin-left: auto; }
.asset-list-card { overflow: hidden; border: 1px solid var(--border-color, #e5e7eb); border-radius: 12px; background: var(--card-bg, #fff); box-shadow: 0 1px 3px rgba(15,23,42,.03); }
#page-asset-library .asset-list-card { overflow: hidden; }
#page-asset-library .asset-list-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.asset-table-wrap { overflow: auto; border: 1px solid var(--border-color, #e5e7eb); border-radius: 12px; background: var(--card-bg, #fff); }
.asset-list-card .asset-table-wrap { border: 0; border-radius: 0; }
#page-asset-library .asset-list-card .asset-table-wrap { --table-scroll-header-height: 41px; --asset-table-header-bg: var(--card-bg, #fff); flex: 1 1 auto; min-height: 0; overflow: hidden; scrollbar-gutter: auto; }
#page-asset-library .asset-table { display: flex; height: 100%; flex-direction: column; }
#page-asset-library .asset-table thead { display: block; flex: 0 0 auto; }
#page-asset-library .asset-table tbody { display: block; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text-muted, #94a3b8) 52%, transparent) transparent; }
#page-asset-library .asset-table tr { display: table; width: 100%; table-layout: fixed; }
#page-asset-library .asset-table tbody::-webkit-scrollbar,
.info-collect-results-table-wrap::-webkit-scrollbar { width: 8px; }
#page-asset-library .asset-table tbody::-webkit-scrollbar-track { background: var(--card-bg, #fff); }
.info-collect-results-table-wrap::-webkit-scrollbar-track {
    background: linear-gradient(
        to bottom,
        var(--bg-secondary) 0 var(--table-scroll-header-height),
        var(--bg-primary) var(--table-scroll-header-height) 100%
    );
}
#page-asset-library .asset-table tbody::-webkit-scrollbar-thumb,
.info-collect-results-table-wrap::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-muted, #94a3b8) 62%, transparent);
    background-clip: content-box;
}
#page-asset-library .asset-table tbody::-webkit-scrollbar-thumb:hover,
.info-collect-results-table-wrap::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--text-secondary, #64748b) 82%, transparent);
    background-clip: content-box;
}
.asset-list-card #asset-pagination.pagination-fixed { overflow: visible; border: 0; border-top: 1px solid var(--border-color, #e5e7eb); border-radius: 0; box-shadow: none; }
#page-asset-library .asset-list-card #asset-pagination { position: relative; z-index: 30; flex: 0 0 auto; }
.asset-list-card #asset-pagination.pagination-fixed .pagination { border-radius: 0; }
.asset-table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; }
.asset-table th,.asset-table td { padding: 13px 14px; border-bottom: 1px solid var(--border-color, #edf0f4); text-align: left; vertical-align: middle; }
.asset-table th { box-sizing: border-box; height: var(--table-scroll-header-height, auto); background: var(--asset-table-header-bg, var(--card-bg, #fff)); color: var(--text-secondary, #64748b); font-size: 12px; font-weight: 600; z-index: 1; }
.asset-table td { font-size: 13px; }
.asset-table td:nth-child(2) { width: 220px; max-width: 280px; }
.asset-table th:nth-child(2),.asset-table td:nth-child(2) { width: auto; }
.asset-table th:nth-child(3),.asset-table td:nth-child(3) { width: 112px; }
.asset-table th:nth-child(4),.asset-table td:nth-child(4) { width: 126px; }
.asset-table th:nth-child(5),.asset-table td:nth-child(5) { width: 132px; }
.asset-table th:nth-child(6),.asset-table td:nth-child(6) { width: 160px; }
.asset-table th:nth-child(7),.asset-table td:nth-child(7) { width: 96px; }
.asset-table th:nth-child(8),.asset-table td:nth-child(8) { width: 84px; }
.asset-table th:nth-child(9),.asset-table td:nth-child(9) { width: 84px; }
.asset-table th:nth-child(10),.asset-table td:nth-child(10) { width: 166px; }
.asset-ownership { display: flex; min-width: 0; flex-direction: column; gap: 3px; line-height: 1.2; }
.asset-ownership__primary,.asset-ownership__secondary { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-ownership__primary { color: var(--text-primary, #111827); font-weight: 600; }
.asset-ownership__secondary { color: var(--text-secondary, #64748b); font-size: 11px; }
.asset-ownership-empty { color: var(--text-muted, #94a3b8); }
.asset-check-cell { width: 42px; min-width: 42px; text-align: center !important; }
.theme-checkbox {
    width: var(--theme-checkbox-size, 16px);
    height: var(--theme-checkbox-size, 16px);
    margin: 0;
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--bg-primary, #fff);
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    vertical-align: middle;
    transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.theme-checkbox:hover { border-color: var(--accent-color, #2563eb); }
.theme-checkbox:focus-visible {
    outline: none;
    border-color: var(--accent-color, #2563eb);
    box-shadow: 0 0 0 3px rgba(37,99,235,.18);
}
.theme-checkbox:checked {
    border-color: var(--accent-color, #2563eb);
    background-color: var(--accent-color, #2563eb);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.5 8.2 2.8 2.8 6.2-6.2' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.theme-checkbox:indeterminate {
    border-color: var(--accent-color, #2563eb);
    background-color: var(--accent-color, #2563eb);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
input.theme-checkbox:disabled {
    opacity: .5;
    cursor: not-allowed;
}
.asset-table td strong,.asset-table td small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-target-link { display: block; max-width: 100%; padding: 0; border: 0; background: transparent; color: #2563eb; font: inherit; font-weight: 650; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-target-link:hover { text-decoration: underline; }
.asset-table td small { margin-top: 4px; color: var(--text-secondary, #64748b); }
.asset-tag { display: inline-block; margin: 5px 4px 0 0; padding: 2px 7px; border-radius: 999px; background: rgba(37,99,235,.1); color: #2563eb; font-size: 11px; }
.asset-project-badge { display: inline-flex; max-width: 180px; padding: 3px 8px; border-radius: 6px; background: rgba(99,102,241,.1); color: #4f46e5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-service { display: block; max-width: 100%; overflow: hidden; color: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.asset-status { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 12px; background: rgba(16,185,129,.12); color: #059669; }
.asset-status--inactive { background: rgba(100,116,139,.12); color: #64748b; }
.asset-risk { display: inline-flex; justify-content: center; min-width: 46px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 650; background: rgba(100,116,139,.12); color: #64748b; }
.asset-risk--critical { background: rgba(190,24,93,.16); color: #be185d; }
.asset-risk--high { background: rgba(239,68,68,.15); color: #dc2626; }
.asset-risk--medium { background: rgba(245,158,11,.16); color: #d97706; }
.asset-risk--low { background: rgba(59,130,246,.14); color: #2563eb; }
.asset-risk--info { background: rgba(99,102,241,.13); color: #4f46e5; }
.asset-risk--normal { background: rgba(16,185,129,.13); color: #059669; }
.asset-row-actions { white-space: nowrap; }
.asset-row-actions .btn-link { margin-right: 8px; }
.asset-row-actions .asset-delete { color: #dc2626; }
.asset-vulnerability-link { min-width: 28px; padding: 3px 8px; border: 1px solid rgba(239,68,68,.28); border-radius: 999px; background: rgba(239,68,68,.10); color: #dc2626; font-weight: 700; cursor: pointer; }
.asset-scan-content { width: min(700px, calc(100vw - 32px)); }
.asset-bulk-edit-content { width: min(760px, calc(100vw - 32px)); }
.asset-import-content { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); margin: 24px auto; }
.asset-import-body { display: flex; flex-direction: column; gap: 14px; }
.asset-import-step { padding: 16px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 12px; background: var(--card-bg, #fff); }
.asset-import-step-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 13px; }
.asset-import-step-heading > span { display: grid; width: 25px; height: 25px; flex: 0 0 25px; place-items: center; border-radius: 50%; background: rgba(37,99,235,.11); color: #2563eb; font-size: 12px; font-weight: 700; }
.asset-import-step-heading > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.asset-import-step-heading strong { color: var(--text-primary, #111827); font-size: 13px; }
.asset-import-step-heading small { color: var(--text-secondary, #64748b); font-size: 12px; font-weight: 400; }
.asset-import-template-actions { display: flex; align-items: center; gap: 12px; padding-left: 36px; }
.asset-import-dropzone { display: flex; box-sizing: border-box; width: 100%; min-height: 118px; align-items: center; justify-content: center; flex-direction: column; gap: 6px; border: 1.5px dashed var(--border-color, #cbd5e1); border-radius: 10px; background: var(--bg-secondary, #f8fafc); color: var(--text-primary, #111827); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.asset-import-dropzone:hover,.asset-import-dropzone.is-dragging { border-color: #2563eb; background: rgba(37,99,235,.055); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.asset-import-dropzone:disabled { cursor: wait; opacity: .65; }
.asset-import-dropzone-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; background: rgba(37,99,235,.11); color: #2563eb; font-size: 18px; font-weight: 700; }
.asset-import-dropzone strong { font-size: 13px; }
.asset-import-dropzone small { max-width: 90%; overflow: hidden; color: var(--text-secondary, #64748b); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.asset-import-preview-section { min-height: 0; }
.asset-import-preview-wrap { max-height: 260px; overflow: auto; border: 1px solid var(--border-color, #e5e7eb); border-radius: 9px; }
.asset-import-preview-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.asset-import-preview-table th,.asset-import-preview-table td { padding: 9px 11px; border-bottom: 1px solid var(--border-color, #edf0f4); text-align: left; font-size: 12px; }
.asset-import-preview-table th { position: sticky; top: 0; z-index: 1; background: var(--card-bg, #fff); color: var(--text-secondary, #64748b); font-weight: 650; }
.asset-import-preview-table th:first-child,.asset-import-preview-table td:first-child { width: 52px; text-align: center; }
.asset-import-preview-table th:nth-child(2),.asset-import-preview-table td:nth-child(2) { width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-import-preview-table th:nth-child(3),.asset-import-preview-table td:nth-child(3) { width: 18%; }
.asset-import-preview-table th:nth-child(4),.asset-import-preview-table td:nth-child(4) { width: 72px; }
.asset-import-preview-table tr.has-error td { background: rgba(220,38,38,.035); }
.asset-import-result { display: inline-flex; max-width: 100%; align-items: center; gap: 5px; font-size: 12px; overflow-wrap: anywhere; }
.asset-import-result::before { flex: 0 0 auto; font-weight: 800; content: '✓'; }
.asset-import-result--ok { color: #059669; }
.asset-import-result--error { color: #dc2626; }
.asset-import-result--error::before { content: '!'; }
.asset-import-preview-section .form-hint { margin: 9px 0 0; color: var(--text-secondary, #64748b); font-size: 11px; }
#asset-project-modal { align-items: center; justify-content: center; box-sizing: border-box; padding: 24px; }
.asset-project-content { width: min(680px, 100%); min-height: min(620px, calc(100vh - 48px)); max-height: calc(100vh - 48px); margin: 0 auto; overflow: visible; contain: layout style; }
.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 .asset-editor-field { gap: 9px; font-size: 14px; }
.asset-project-content .settings-custom-select-trigger { height: 48px; padding: 0 15px; border-radius: 8px; background: var(--input-bg, var(--bg-primary)); font-size: 14px; }
.asset-project-content .settings-custom-select-menu { z-index: 2700; max-height: min(360px, calc(100vh - 280px)); overflow-y: auto; padding: 7px; }
.asset-project-content .settings-custom-select-option { min-height: 44px; padding: 10px 12px; font-size: 14px; }
.asset-project-content .settings-custom-select-option.is-disabled { display: none; }
.asset-editor-field > .asset-custom-select { width: 100%; }
.asset-editor-field > .asset-custom-select .settings-custom-select-trigger { width: 100%; }
.asset-scan-targets { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 18px; padding: 12px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 10px; background: var(--bg-secondary, #f8fafc); }
.asset-scan-target-chip { max-width: 220px; padding: 4px 9px; border-radius: 999px; background: rgba(37,99,235,.11); color: #2563eb; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-scan-prompt-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 650; }
.asset-scan-prompt { width: 100%; min-height: 150px; padding: 12px; resize: vertical; border: 1px solid var(--border-color, #d8dee8); border-radius: 9px; background: var(--input-bg, #fff); color: var(--text-primary, #111827); font: inherit; line-height: 1.6; }
.asset-scan-modal .form-hint { display: block; margin: 8px 0 14px; color: var(--text-secondary, #64748b); }
.asset-scan-modal #asset-scan-execute-wrap[hidden] { display: none !important; }
.asset-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.asset-editor-content { width: min(840px, calc(100vw - 32px)); max-height: calc(100vh - 48px); margin: 24px auto; }
.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-subtitle { margin: 5px 0 0; color: var(--text-secondary, #64748b); font-size: 13px; font-weight: 400; }
.asset-editor-body { padding: 22px 24px 24px; overscroll-behavior: contain; scrollbar-gutter: stable; }
.asset-editor-content .modal-footer { position: relative; background: var(--bg-primary, #fff); box-shadow: 0 -8px 24px rgba(15,23,42,.04); }
.asset-editor-primary { padding: 18px; border: 1px solid rgba(37,99,235,.16); border-radius: 12px; background: rgba(37,99,235,.025); }
.asset-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.asset-editor-primary-grid { margin-top: 18px; }
.asset-editor-field { display: flex; min-width: 0; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 600; }
.asset-editor-field > span { display: flex; align-items: center; gap: 4px; }
.asset-editor-field > span b { color: #dc2626; font-size: 15px; }
.asset-editor-field input,.asset-editor-field select { box-sizing: border-box; width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border-color, #d8dee8); border-radius: 8px; outline: none; background: var(--input-bg, #fff); color: var(--text-primary, #111827); font: inherit; font-weight: 400; transition: border-color .15s, box-shadow .15s, background .15s; }
#asset-edit-protocol { appearance: none; -webkit-appearance: none; }
#asset-edit-protocol::-webkit-calendar-picker-indicator { display: none !important; opacity: 0; pointer-events: none; }
.asset-editor-field input:focus,.asset-editor-field select:focus,.asset-tag-editor:focus-within { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.asset-editor-field input[aria-invalid="true"] { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.09); }
.asset-editor-target-field input { height: 48px; font-size: 15px; }
.asset-field-hint { color: var(--text-secondary, #64748b); font-size: 12px; font-weight: 400; line-height: 1.45; }
.asset-field-error { color: #dc2626; font-size: 12px; font-weight: 500; line-height: 1.45; }
.asset-form-error { margin-top: 14px; padding: 10px 12px; border: 1px solid rgba(220,38,38,.24); border-radius: 8px; background: rgba(220,38,38,.07); color: #b91c1c; font-size: 13px; line-height: 1.45; }
.asset-tag-editor { display: flex; min-height: 42px; align-items: center; flex-wrap: wrap; gap: 6px; padding: 5px 8px; border: 1px solid var(--border-color, #d8dee8); border-radius: 8px; background: var(--input-bg, #fff); transition: border-color .15s, box-shadow .15s; }
.asset-tag-chips { display: contents; }
.asset-tag-chip { display: inline-flex; max-width: 160px; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 999px; background: rgba(37,99,235,.11); color: #1d4ed8; font-size: 12px; font-weight: 500; }
.asset-tag-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-tag-chip button { width: 16px; height: 16px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; font-size: 14px; line-height: 14px; }
.asset-tag-chip button:hover { background: rgba(37,99,235,.14); }
.asset-tag-editor #asset-edit-tags { width: 130px; min-width: 90px; height: 30px; flex: 1; padding: 0 3px; border: 0; box-shadow: none; background: transparent; }
.asset-editor-details { margin-top: 24px; }
.asset-editor-section-group + .asset-editor-section-group { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border-color, #e5e7eb); }
.asset-editor-group-heading { display: flex; min-width: 0; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.asset-editor-group-heading::after { content: ''; height: 1px; min-width: 24px; flex: 1; background: var(--border-color, #e5e7eb); }
.asset-editor-group-heading h3 { flex: 0 0 auto; margin: 0; color: var(--text-primary, #111827); font-size: 13px; font-weight: 650; line-height: 1.45; }
.asset-editor-group-heading p { min-width: 0; margin: 0; color: var(--text-secondary, #64748b); font-size: 12px; font-weight: 400; line-height: 1.45; }
.asset-editor-wide { grid-column: 1 / -1; }
.asset-editor-submit-busy { pointer-events: none; opacity: .7; }
.asset-detail-modal { overflow: hidden; background: rgba(15,23,42,.48); }
.asset-detail-modal .asset-detail-content {
    position: absolute;
    top: 0;
    right: 0;
    width: min(680px, 94vw);
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    border-width: 0 0 0 1px;
    border-color: var(--border-color, #e5e7eb);
    border-radius: 16px 0 0 16px;
    background: var(--bg-primary, #fff);
    box-shadow: -12px 0 32px rgba(15,23,42,.14);
    animation: assetDrawerIn .20s ease-out;
}
.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);
}
@keyframes assetDrawerIn { from { opacity: .7; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.asset-detail-grid { display: flex; flex-direction: column; gap: 14px; }
.asset-detail-overview {
    padding: 16px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    box-shadow: none;
}
.asset-detail-overview-main { min-width: 0; }
.asset-detail-target { color: var(--text-primary, #111827); font-size: 18px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.asset-detail-meta-line { margin-top: 6px; color: var(--text-secondary, #64748b); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.asset-detail-overview-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.asset-detail-overview-badge {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-primary, #111827);
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.asset-detail-overview-badge span { color: var(--text-secondary, #64748b); font-weight: 500; }
.asset-detail-overview-badge--success { color: #047857; }
.asset-detail-overview-badge--neutral { color: #475569; }
.asset-detail-overview-badge--critical,.asset-detail-overview-badge--high { color: #b91c1c; }
.asset-detail-overview-badge--medium { color: #b45309; }
.asset-detail-overview-badge--low,.asset-detail-overview-badge--info,.asset-detail-overview-badge--normal { color: #2563eb; }
.asset-detail-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.asset-detail-item { min-width: 0; padding: 14px 15px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px; background: var(--card-bg, #fff); box-shadow: none; }
.asset-detail-item:hover { border-color: var(--border-color, #e5e7eb); box-shadow: none; transform: none; }
.asset-detail-item--wide { grid-column: 1 / -1; }
.asset-detail-item > span { display: block; margin-bottom: 7px; color: var(--text-secondary, #64748b); font-size: 12px; font-weight: 650; }
.asset-detail-item > div { min-height: 20px; color: var(--text-primary, #111827); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.asset-detail-item .muted { color: var(--text-muted, #94a3b8); }
.asset-detail-item--code { background: var(--card-bg, #fff); }
.asset-detail-item code { display: block; max-height: 170px; padding: 10px; overflow: auto; border: 1px solid var(--border-color, #e5e7eb); border-radius: 6px; background: var(--bg-secondary, #f4f6f8); color: var(--text-primary, #111827); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }

/* 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-table-wrap,
html[data-theme="dark"] .asset-table th,
html[data-theme="dark"] .asset-scan-targets,
html[data-theme="dark"] .asset-import-step,
html[data-theme="dark"] .asset-import-preview-table th,
html[data-theme="dark"] .asset-detail-item {
    background: var(--card-bg);
    border-color: var(--border-color);
    box-shadow: none;
}

html[data-theme="dark"] .asset-overview-icon--violet {
    background: rgba(129, 140, 248, .14);
    color: #a5b4fc;
}

html[data-theme="dark"] .asset-type-grid,
html[data-theme="dark"] .asset-coverage-metrics {
    background: rgba(15, 23, 42, .38);
    border-color: var(--border-color);
}

html[data-theme="dark"] .asset-panel-meta.is-critical { color: #fca5a5; }
html[data-theme="dark"] .asset-panel-meta.is-warning { color: #fcd34d; }
html[data-theme="dark"] .asset-panel-meta.is-healthy { color: #6ee7b7; }

html[data-theme="dark"] .asset-period-switch button.active {
    background: rgba(96,165,250,.16);
    color: #93c5fd;
}

html[data-theme="dark"] .asset-stat-card--accent {
    border-color: rgba(96, 165, 250, .38);
    background: linear-gradient(135deg, rgba(37, 99, 235, .20), rgba(124, 58, 237, .10));
}

html[data-theme="dark"] .asset-stat-card--accent strong,
html[data-theme="dark"] .asset-target-link,
html[data-theme="dark"] .asset-row-actions .btn-link {
    color: #60a5fa;
}

html[data-theme="dark"] .asset-toolbar input,
html[data-theme="dark"] .asset-toolbar select,
html[data-theme="dark"] .asset-editor-field input,
html[data-theme="dark"] .asset-editor-field select,
html[data-theme="dark"] .asset-editor-grid input,
html[data-theme="dark"] .asset-editor-grid select {
    background: var(--input-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

html[data-theme="dark"] .asset-toolbar input::placeholder,
html[data-theme="dark"] .asset-editor-field input::placeholder,
html[data-theme="dark"] .asset-editor-grid input::placeholder {
    color: var(--text-muted);
}

html[data-theme="dark"] .asset-table tbody tr:hover td {
    background: rgba(96, 165, 250, .06);
}

html[data-theme="dark"] .asset-tag {
    background: rgba(96, 165, 250, .16);
    color: #93c5fd;
}

html[data-theme="dark"] .asset-project-badge {
    background: rgba(167, 139, 250, .16);
    color: #c4b5fd;
}

html[data-theme="dark"] .asset-status {
    background: rgba(52, 211, 153, .14);
    color: #6ee7b7;
}

html[data-theme="dark"] .asset-status--inactive {
    background: rgba(148, 163, 184, .14);
    color: #cbd5e1;
}
html[data-theme="dark"] .asset-risk--critical { color: #f9a8d4; }
html[data-theme="dark"] .asset-risk--high { color: #fca5a5; }
html[data-theme="dark"] .asset-risk--medium { color: #fcd34d; }
html[data-theme="dark"] .asset-risk--low { color: #93c5fd; }
html[data-theme="dark"] .asset-risk--info { color: #c4b5fd; }
html[data-theme="dark"] .asset-risk--normal { color: #6ee7b7; }

html[data-theme="dark"] .asset-row-actions .asset-delete {
    color: #f87171;
}

html[data-theme="dark"] .asset-batch-actions { border-color: rgba(96,165,250,.36); background: rgba(37,99,235,.13); }
html[data-theme="dark"] .asset-batch-selection-mark::after { border-color: #0b1120; }
html[data-theme="dark"] .asset-batch-menu { background: #0f172a; border-color: var(--border-color); box-shadow: 0 16px 36px rgba(0,0,0,.38); }
html[data-theme="dark"] .asset-batch-menu button:hover:not(:disabled),html[data-theme="dark"] .asset-batch-menu button:focus-visible { background: rgba(30,41,59,.9); }
html[data-theme="dark"] .asset-batch-menu .asset-batch-menu-danger:hover:not(:disabled),html[data-theme="dark"] .asset-batch-menu .asset-batch-menu-danger:focus-visible { background: rgba(248,113,113,.1); }
html[data-theme="dark"] .asset-import-dropzone { border-color: var(--border-color); background: rgba(15,23,42,.38); color: var(--text-primary); }
html[data-theme="dark"] .asset-import-dropzone:hover,
html[data-theme="dark"] .asset-import-dropzone.is-dragging { border-color: #60a5fa; background: rgba(37,99,235,.12); }
html[data-theme="dark"] .asset-import-preview-table tr.has-error td { background: rgba(248,113,113,.055); }
html[data-theme="dark"] .asset-scan-prompt { background: var(--input-bg); border-color: var(--border-color); color: var(--text-primary); }
html[data-theme="dark"] .asset-vulnerability-link { color: #fca5a5; border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.12); }
html[data-theme="dark"] .asset-custom-select .settings-custom-select-trigger,
html[data-theme="dark"] .asset-custom-select .settings-custom-select-menu { background: #0f172a; border-color: var(--border-color); color: var(--text-primary); }
html[data-theme="dark"] .asset-custom-select .settings-custom-select-menu { box-shadow: 0 14px 32px rgba(0,0,0,.34); }
html[data-theme="dark"] .asset-custom-select .settings-custom-select-option:hover:not(:disabled) { background: rgba(30,41,59,.78); }
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"] .theme-checkbox {
    background-color: var(--bg-primary);
}
html[data-theme="dark"] .theme-checkbox:focus-visible {
    box-shadow: 0 0 0 3px rgba(96,165,250,.22);
}
html[data-theme="dark"] .theme-checkbox:checked {
    background-color: var(--accent-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.5 8.2 2.8 2.8 6.2-6.2' fill='none' stroke='%230b1120' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .theme-checkbox:indeterminate {
    background-color: var(--accent-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' fill='none' stroke='%230b1120' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .asset-detail-grid {
    background: transparent;
}

html[data-theme="dark"] .asset-detail-modal {
    background: rgba(2,6,23,.62);
}

html[data-theme="dark"] .asset-detail-modal .asset-detail-content {
    border-color: var(--border-color);
    background: var(--bg-primary);
    box-shadow: -12px 0 34px rgba(0,0,0,.32);
}

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-detail-overview {
    border-color: var(--border-color);
    background: var(--card-bg);
    box-shadow: none;
}

html[data-theme="dark"] .asset-detail-overview-badge {
    border-color: var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

html[data-theme="dark"] .asset-detail-overview-badge span {
    color: #94a3b8;
}

html[data-theme="dark"] .asset-detail-overview-badge--success { color: #6ee7b7; }
html[data-theme="dark"] .asset-detail-overview-badge--neutral { color: #cbd5e1; }
html[data-theme="dark"] .asset-detail-overview-badge--critical,
html[data-theme="dark"] .asset-detail-overview-badge--high { color: #fca5a5; }
html[data-theme="dark"] .asset-detail-overview-badge--medium { color: #fcd34d; }

html[data-theme="dark"] .asset-detail-item {
    border-color: var(--border-color);
    background: var(--card-bg);
    box-shadow: none;
}

html[data-theme="dark"] .asset-detail-item:hover {
    border-color: var(--border-color);
    box-shadow: none;
}

html[data-theme="dark"] .asset-detail-item--code {
    background: var(--card-bg);
}

html[data-theme="dark"] .asset-detail-item code {
    border-color: var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}
html[data-theme="dark"] .asset-editor-primary { border-color: rgba(96,165,250,.20); background: rgba(96,165,250,.035); }
html[data-theme="dark"] .asset-tag-editor { border-color: var(--border-color); background: var(--card-bg); }
html[data-theme="dark"] .asset-editor-content .modal-footer { background: var(--bg-primary); box-shadow: 0 -8px 24px rgba(0,0,0,.12); }
html[data-theme="dark"] .asset-tag-chip { background: rgba(96,165,250,.16); color: #93c5fd; }
html[data-theme="dark"] .asset-form-error { color: #fca5a5; }
@media (max-width: 1180px) {
    .asset-overview-summary { grid-template-columns: 1fr; }
    .asset-recent-card { min-height: 210px; }
    .asset-coverage-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .asset-coverage-metrics > div:nth-child(3) { border-top: 1px solid var(--border-color,#e5e7eb); border-left: 0; }
    .asset-coverage-metrics > div:nth-child(4) { border-top: 1px solid var(--border-color,#e5e7eb); }
}
@media (max-width: 1050px) {
    .asset-table th:nth-child(4),.asset-table td:nth-child(4) { display: none; }
}
@media (max-width: 820px) {
    .asset-table th:nth-child(3),.asset-table td:nth-child(3) { display: none; }
    .asset-table th:nth-child(5),.asset-table td:nth-child(5) { width: 145px; }
    .asset-table th:nth-child(10),.asset-table td:nth-child(10) { width: 150px; }
    .asset-batch-actions { align-items: stretch; flex-direction: column; }
    .asset-batch-selection { min-height: 30px; }
    .asset-batch-primary-actions { width: 100%; }
    .asset-batch-primary-actions > button { flex: 1 1 auto; }
}
@media (max-width: 760px) {
    .asset-overview-summary { grid-template-columns: 1fr; }
    .asset-total-card__layout { grid-template-columns: 1fr; }
    .asset-protocol-compact { padding-top: 20px; padding-left: 0; border-top: 1px solid var(--border-color,#e5e7eb); border-left: 0; }
    .asset-trend-grid { grid-template-columns: 1fr; }
    .asset-insight-heading { align-items: flex-start; flex-direction: column; }
    .asset-coverage-layout { grid-template-columns: 1fr; }
    .asset-coverage-overview { padding: 0 0 20px; border-right: 0; border-bottom: 1px solid var(--border-color,#e5e7eb); }
    .asset-recent-card { min-height: 230px; }
}
@media (max-width: 1100px) { .asset-advanced-filters { grid-template-columns: repeat(3,minmax(140px,1fr)); } }
@media (max-width: 760px) {
    .asset-detail-modal .asset-detail-content {
        width: 100%;
        border-left: 0;
        border-radius: 0;
    }
    .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;
    }
    .asset-detail-target {
        font-size: 19px;
    }
    .asset-detail-fields {
        grid-template-columns: 1fr;
    }
    .asset-detail-item--wide {
        grid-column: auto;
    }
}
@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-sidebar-card,
html[data-theme="dark"] #page-projects .projects-detail-inner,
html[data-theme="dark"] #page-asset-library .asset-toolbar,
html[data-theme="dark"] #page-asset-library .asset-list-card {
    background: #0f172a !important;
    border-color: #223047 !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18) !important;
}

html[data-theme="dark"] #page-projects .projects-sidebar-head,
html[data-theme="dark"] #page-projects .projects-sidebar-search,
html[data-theme="dark"] #page-projects .projects-sidebar-pagination,
html[data-theme="dark"] #page-projects .projects-detail-header,
html[data-theme="dark"] #page-projects .projects-tabs {
    background: #101b2d !important;
    border-color: #223047 !important;
}

html[data-theme="dark"] #page-projects .projects-list-item:hover {
    background: rgba(96, 165, 250, 0.08) !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-list-item-menu:hover,
html[data-theme="dark"] #page-projects .projects-list-item-menu:focus-visible {
    background: rgba(96, 165, 250, 0.14) !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] #page-projects .projects-detail-meta,
html[data-theme="dark"] #page-projects .projects-stat-chip,
html[data-theme="dark"] #page-projects .projects-panel-count {
    background: rgba(15, 23, 42, 0.72) !important;
    border-color: #2b3a55 !important;
}

html[data-theme="dark"] #page-projects .projects-panel {
    background: #0d1526 !important;
}

html[data-theme="dark"] #page-projects .projects-fact-toolbar,
html[data-theme="dark"] #page-projects .projects-panel-toolbar,
html[data-theme="dark"] #page-projects .projects-table-wrap,
html[data-theme="dark"] #page-asset-library .asset-table-wrap {
    background: #0f172a !important;
    border-color: #223047 !important;
}

html[data-theme="dark"] #page-asset-library .asset-table-wrap {
    --asset-table-header-bg: #172033;
}

html[data-theme="dark"] #page-asset-library .asset-table tbody::-webkit-scrollbar-track {
    background: #0f172a;
}

html[data-theme="dark"] #project-panel-assets .data-table--projects tbody::-webkit-scrollbar-track {
    background: #0f172a;
}

html[data-theme="dark"] #page-projects .projects-panel-toolbar--hint {
    background: transparent !important;
    border-color: transparent !important;
}

html[data-theme="dark"] #page-projects .projects-fact-toolbar-hint {
    background: rgba(59, 130, 246, 0.13) !important;
    border-color: rgba(96, 165, 250, 0.34) !important;
    color: #cfe3ff !important;
}

html[data-theme="dark"] #page-projects .projects-tab {
    border: 1px solid transparent !important;
    color: #aeb9ca !important;
}

html[data-theme="dark"] #page-projects .projects-tab:hover {
    background: rgba(96, 165, 250, 0.09) !important;
    border-color: rgba(96, 165, 250, 0.24) !important;
    color: #e5e7eb !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;
}

html[data-theme="dark"] #page-projects .data-table,
html[data-theme="dark"] #page-asset-library .asset-table {
    background: #0f172a !important;
    color: #dbe4f0 !important;
}

html[data-theme="dark"] #page-projects .data-table thead th,
html[data-theme="dark"] #page-asset-library .asset-table th {
    background: #172033 !important;
    color: #b7c2d3 !important;
    border-bottom-color: #2a3a55 !important;
    box-shadow: inset 0 -1px 0 #2a3a55 !important;
}

html[data-theme="dark"] #page-projects .data-table tbody td,
html[data-theme="dark"] #page-asset-library .asset-table td {
    background: #0f172a !important;
    color: #dbe4f0 !important;
    border-bottom-color: #1f2c42 !important;
}

html[data-theme="dark"] #page-projects .data-table tbody tr:nth-child(even) td,
html[data-theme="dark"] #page-asset-library .asset-table tbody tr:nth-child(even) td {
    background: #10192b !important;
}

html[data-theme="dark"] #page-projects .data-table tbody tr:hover td,
html[data-theme="dark"] #page-asset-library .asset-table tbody tr:hover td {
    background: #16243a !important;
    box-shadow: inset 0 1px 0 rgba(96, 165, 250, 0.16), inset 0 -1px 0 rgba(96, 165, 250, 0.16) !important;
}

html[data-theme="dark"] #page-projects .data-table tbody tr.is-empty-row td,
html[data-theme="dark"] #page-asset-library .asset-table tbody td.muted {
    background: #0f172a !important;
    color: #8fa0b8 !important;
}

html[data-theme="dark"] #page-projects .data-table code {
    background: #0a1221 !important;
    border-color: #2b3a55 !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] #page-projects .projects-action-btn {
    background: #111c2f !important;
    border-color: #2b3a55 !important;
    color: #cbd5e1 !important;
}

html[data-theme="dark"] #page-projects .projects-action-btn:hover {
    background: #172942 !important;
    border-color: rgba(96, 165, 250, 0.5) !important;
    color: #e5f0ff !important;
}

html[data-theme="dark"] #page-projects #project-panel-facts .data-table--projects th.col-actions,
html[data-theme="dark"] #page-projects #project-panel-facts .data-table--projects td.col-actions {
    background: #0f172a !important;
    box-shadow: inset 1px 0 0 #1f2c42 !important;
}

html[data-theme="dark"] #page-projects #project-panel-facts .data-table--projects thead th.col-actions {
    background: #172033 !important;
    box-shadow: inset 1px 0 0 #2a3a55, inset 0 -1px 0 #2a3a55 !important;
}

html[data-theme="dark"] #page-projects #project-panel-facts .data-table--projects tbody tr:nth-child(even) td.col-actions {
    background: #10192b !important;
}

html[data-theme="dark"] #page-projects #project-panel-facts .data-table--projects tbody tr:hover td.col-actions {
    background: #16243a !important;
    box-shadow: inset 1px 0 0 rgba(96, 165, 250, 0.18), inset 0 1px 0 rgba(96, 165, 250, 0.16), inset 0 -1px 0 rgba(96, 165, 250, 0.16) !important;
}

html[data-theme="dark"] #page-asset-library .asset-toolbar input,
html[data-theme="dark"] #page-asset-library .asset-toolbar select {
    background: #0b1324 !important;
    border-color: #2b3a55 !important;
    color: #e5e7eb !important;
}

html[data-theme="dark"] #page-asset-library .asset-list-card #asset-pagination.pagination-fixed,
html[data-theme="dark"] #project-panel-assets .projects-panel-pagination.pagination-fixed .pagination {
    background: #0f172a !important;
    border-color: #223047 !important;
}

/* --------------------------------------------------------------------------
   Project-centric conversation sidebar
   The primary folder list reuses the real chat project selector data; groups
   and recent conversations remain secondary navigation below it.
   -------------------------------------------------------------------------- */
.conversation-sidebar {
    width: 280px;
    background: #ffffff;
}

.conversation-sidebar-header {
    padding: 12px;
    background: #ffffff;
}

.conversation-sidebar .sidebar-content {
    padding: 12px 12px 16px;
}

.conversation-sidebar .conversation-search-box {
    margin: 8px 0 16px;
}

.conversation-sidebar .conversation-search-box input {
    min-height: 42px;
    padding-left: 36px;
    border-color: #dfe3e8;
    border-radius: 9px;
    background: #ffffff;
}

.conversation-sidebar .conversation-search-box::before {
    content: '';
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    z-index: 1;
    pointer-events: none;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2377818f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E");
}

.conversation-sidebar .conversation-project-filter {
    display: none !important;
}

.project-folders-section {
    margin-bottom: 16px;
    min-width: 0;
}

.project-folders-header {
    min-height: 26px;
    margin-bottom: 5px !important;
}

.project-folders-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.project-folders-load-more {
    width: calc(100% - 12px);
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 5px 6px 1px;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #657080;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 560;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease;
}

.project-folders-load-more:hover,
.project-folders-load-more:focus-visible {
    background: #f1f3f5;
    color: #273142;
    outline: none;
}

.project-folders-load-more-count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #e8ebef;
    color: #697382;
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
}

.project-folder-row {
    position: relative;
    min-width: 0;
}

.project-folder-item {
    position: relative;
    width: 100%;
    min-height: 38px;
    display: grid;
    grid-template-columns: 15px 19px minmax(0, 1fr);
    align-items: center;
    padding: 6px 68px 6px 6px;
    column-gap: 7px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #303846;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.project-folder-actions {
    position: absolute;
    top: 50%;
    right: 5px;
    display: flex;
    align-items: center;
    gap: 1px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%);
    transition: opacity 0.14s ease;
}

.project-folder-row:hover .project-folder-actions,
.project-folder-row:focus-within .project-folder-actions {
    opacity: 1;
    pointer-events: auto;
}

.project-folder-action,
.project-conversation-menu {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #59616d;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.project-folder-action:hover,
.project-folder-action:focus-visible,
.project-conversation-menu:hover,
.project-conversation-menu:focus-visible {
    background: rgba(255, 255, 255, 0.86);
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(21, 28, 38, 0.08);
    outline: none;
}

.project-folder-item:hover {
    background: #f3f4f5;
}

.project-folder-item:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.42);
    outline-offset: -2px;
}

.project-folder-item:disabled {
    cursor: wait;
    opacity: 0.72;
}

.project-folder-disclosure {
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #727a85;
}

.project-folder-icon {
    width: 19px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #505965;
}

.project-folder-icon.is-open {
    color: #343b44;
}

.project-folder-label,
.project-conversation-label {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
}

.project-folder-title {
    min-width: 0;
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 520;
    line-height: 1.35;
}

.project-folder-pinned {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    color: var(--accent-color);
    font-size: 0.72rem;
    line-height: 1;
}

.project-folder-preview {
    position: fixed;
    z-index: 1200;
    width: min(326px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid rgba(30, 41, 59, 0.16);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.985);
    color: #20242a;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14), 0 2px 7px rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(16px);
}

.project-folder-preview[hidden] {
    display: none !important;
}

.project-folder-preview-header {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding: 14px 14px 8px;
}

.project-folder-preview-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #252b33;
}

.project-folder-preview-icon svg {
    width: 18px;
    height: 18px;
}

.project-folder-preview-title {
    min-width: 0;
    overflow: hidden;
    color: #171b20;
    font-size: 0.98rem;
    font-weight: 650;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-folder-preview-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px 11px;
    color: #515862;
    font-size: 0.82rem;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

.project-folder-preview-stats svg,
.project-folder-preview-detail svg {
    flex: 0 0 auto;
    color: #89909a;
}

.project-folder-preview-stats svg {
    width: 15px;
    height: 15px;
}

.project-folder-preview-details {
    padding: 3px 0;
    border-top: 1px solid #e7e9ed;
    border-bottom: 1px solid #e7e9ed;
}

.project-folder-preview-detail {
    display: grid;
    grid-template-columns: 15px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    padding: 8px 14px;
    color: #4b525c;
    font-size: 0.82rem;
    line-height: 1.45;
}

.project-folder-preview-detail[hidden] {
    display: none !important;
}

.project-folder-preview-detail svg {
    width: 14px;
    height: 14px;
    margin-top: 2px;
}

.project-folder-preview-detail span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.project-folder-preview-detail.is-empty {
    color: #8a919b;
}

.project-folder-preview-edit {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 0;
    background: transparent;
    color: #2e343c;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 560;
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease;
}

.project-folder-preview-edit[hidden],
.project-folder-preview.is-unassigned .project-folder-preview-edit {
    display: none !important;
}

.project-folder-preview.is-unassigned .project-folder-preview-details {
    border-bottom: 0;
}

.project-folder-preview-edit svg {
    width: 16px;
    height: 16px;
}

.project-folder-preview-edit:hover,
.project-folder-preview-edit:focus-visible {
    background: #f1f3f5;
    color: #171b20;
    outline: none;
}

html[data-theme="dark"] .project-folder-preview {
    border-color: rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.985);
    color: #f8fafc;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.44);
}

html[data-theme="dark"] .project-folder-preview-icon,
html[data-theme="dark"] .project-folder-preview-title {
    color: #f8fafc;
}

html[data-theme="dark"] .project-folder-preview-stats,
html[data-theme="dark"] .project-folder-preview-detail,
html[data-theme="dark"] .project-folder-preview-edit {
    color: #cbd5e1;
}

html[data-theme="dark"] .project-folder-preview-details {
    border-color: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .project-folder-preview-edit:hover,
html[data-theme="dark"] .project-folder-preview-edit:focus-visible {
    background: rgba(148, 163, 184, 0.13);
    color: #ffffff;
}

@media (max-width: 900px), (hover: none) {
    .project-folder-preview,
    .project-conversation-preview {
        display: none !important;
    }
}

.project-conversation-row {
    position: relative;
    min-width: 0;
    border-radius: 9px;
}

.project-conversation-item {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 7px 38px 7px 55px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #3f4650;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.project-conversation-menu {
    position: absolute;
    top: 50%;
    right: 5px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%);
}

.project-conversation-row:hover .project-conversation-menu,
.project-conversation-row:focus-within .project-conversation-menu {
    opacity: 1;
    pointer-events: auto;
}

.project-conversation-row:hover .project-conversation-item {
    background: #f3f4f5;
}

.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:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.42);
    outline-offset: -2px;
}

.project-conversation-title {
    min-width: 0;
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.35;
}

.project-conversation-item.is-selected .project-conversation-title {
    font-weight: 650;
}

.project-conversation-preview {
    position: fixed;
    z-index: 1200;
    width: min(340px, calc(100vw - 32px));
    padding: 12px 14px 11px;
    border: 1px solid rgba(30, 41, 59, 0.15);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.985);
    color: #20242a;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.13), 0 2px 6px rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(16px);
    pointer-events: none;
}

.project-conversation-preview[hidden] {
    display: none !important;
}

.project-conversation-preview-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    margin-bottom: 8px;
    min-width: 0;
}

.project-conversation-preview-title {
    min-width: 0;
    overflow: hidden;
    color: #171b20;
    font-size: 0.9rem;
    font-weight: 650;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow-wrap: anywhere;
}

.project-conversation-preview-age {
    color: #8b929c;
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.project-conversation-preview-age[hidden] {
    display: none !important;
}

.project-conversation-preview-meta {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 22px;
    color: #343b44;
    font-size: 0.82rem;
    line-height: 1.35;
}

.project-conversation-preview-meta svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    color: #858d98;
}

.project-conversation-preview-mode-icon.agent-mode-logo {
    width: 16px;
    height: 16px;
    margin-right: 0;
    color: #858d98;
}

.project-conversation-preview-project,
.project-conversation-preview-mode {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-conversation-preview-mode {
    flex: 0 1 auto;
}

.project-conversation-preview-separator {
    color: #a0a6ae;
}

.project-conversation-preview-status {
    flex: 0 0 auto;
    color: #7a818c;
    font-size: 0.76rem;
    white-space: nowrap;
}

.project-conversation-preview-status.is-running,
.project-conversation-preview-status.is-unread {
    color: #2563eb;
}

html[data-theme="dark"] .project-conversation-preview {
    border-color: rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.985);
    color: #f8fafc;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .project-conversation-preview-title {
    color: #f8fafc;
}

html[data-theme="dark"] .project-conversation-preview-meta {
    color: #d7dee8;
}

html[data-theme="dark"] .project-conversation-preview-status.is-running,
html[data-theme="dark"] .project-conversation-preview-status.is-unread {
    color: #60a5fa;
}

.project-task-status-group {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.project-task-status {
    display: inline-block;
    flex: 0 0 auto;
    border-radius: 50%;
}

.project-task-status--running {
    width: 11px;
    height: 11px;
    border: 1.5px solid #2563eb;
    border-top-color: rgba(37, 99, 235, 0.18);
    animation: project-task-status-spin 0.9s linear infinite;
}

.project-task-status--unread {
    width: 6px;
    height: 6px;
    background: #2563eb;
}

.project-task-status--approval {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: auto;
    min-height: 22px;
    padding: 2px 8px 4px;
    overflow: hidden;
    border-radius: 999px;
    background: #dcfce7;
    color: #16804a;
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 18px;
    white-space: nowrap;
}

.project-approval-time {
    font-size: 0.66rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.78;
}

.project-approval-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: color-mix(in srgb, currentColor 16%, transparent);
}

.project-approval-progress-value {
    display: block;
    width: 100%;
    height: 100%;
    background: currentColor;
    transition: width 0.25s linear;
}

.project-task-status--approval.is-expired {
    background: #fee2e2;
    color: #b42318;
}

.project-task-status--approval-summary {
    padding-bottom: 2px;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.project-task-status--approval.is-urgency-normal {
    background: #dcfce7;
    color: #16804a;
}

.project-task-status--approval.is-urgency-warning {
    background: #fef9c3;
    color: #9a6700;
}

.project-task-status--approval.is-urgency-critical {
    background: #fee2e2;
    color: #b42318;
}

html[data-theme="dark"] .project-task-status--running {
    border-color: #60a5fa;
    border-top-color: rgba(96, 165, 250, 0.2);
}

html[data-theme="dark"] .project-task-status--unread {
    background: #60a5fa;
}

html[data-theme="dark"] .project-task-status--approval {
    background: rgba(52, 211, 153, 0.16);
    color: #6ee7b7;
}

html[data-theme="dark"] .project-task-status--approval.is-expired {
    background: rgba(248, 113, 113, 0.16);
    color: #fca5a5;
}

html[data-theme="dark"] .project-task-status--approval.is-urgency-normal {
    background: rgba(52, 211, 153, 0.16);
    color: #6ee7b7;
}

html[data-theme="dark"] .project-task-status--approval.is-urgency-warning {
    background: rgba(250, 204, 21, 0.17);
    color: #fde047;
}

html[data-theme="dark"] .project-task-status--approval.is-urgency-critical {
    background: rgba(248, 113, 113, 0.16);
    color: #fca5a5;
}

.project-conversation-preview-status.is-approval,
html[data-theme="dark"] .project-conversation-preview-status.is-approval {
    color: #22a06b;
}

html[data-theme="dark"] .project-folders-load-more {
    color: #94a3b8;
}

html[data-theme="dark"] .project-folders-load-more:hover,
html[data-theme="dark"] .project-folders-load-more:focus-visible {
    background: rgba(148, 163, 184, 0.1);
    color: #d7dee9;
}

html[data-theme="dark"] .project-folders-load-more-count {
    background: rgba(148, 163, 184, 0.14);
    color: #aeb9c9;
}

@keyframes project-task-status-spin {
    to { transform: rotate(360deg); }
}

.project-folders-empty {
    padding: 12px 8px;
    color: #9aa1ad;
    font-size: 0.8125rem;
    text-align: center;
}

.conversation-sidebar .recent-conversations-section {
    margin: 0;
    padding: 8px 0 13px;
}

.recent-conversations-toggle {
    width: 100%;
    min-height: 30px;
    margin: 0 !important;
    padding: 0 8px !important;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.recent-conversations-toggle:hover {
    background: #f3f4f6;
}

.recent-conversations-toggle-meta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    color: #7c8592;
}

.recent-conversations-count {
    min-width: 1.5em;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.recent-conversations-chevron {
    transition: transform 0.16s ease;
}

.recent-conversations-toggle[aria-expanded="true"] .recent-conversations-chevron {
    transform: rotate(90deg);
}

.recent-conversations-body[hidden] {
    display: none !important;
}

.conversation-sidebar-pagination[hidden] {
    display: none !important;
}

.conversation-sidebar:has(.recent-conversations-section.is-collapsed) .conversation-sidebar-pagination {
    display: none !important;
}

.recent-conversations-actions {
    justify-content: flex-end;
    min-height: 28px;
    margin: 5px 5px 3px;
}

.recent-conversations-body .conversation-group-title {
    padding-top: 7px;
}

.recent-conversations-body .conversation-item {
    padding: 8px;
}

html[data-theme="dark"] .conversation-sidebar,
html[data-theme="dark"] .conversation-sidebar-header {
    background: var(--bg-primary);
}

html[data-theme="dark"] .conversation-sidebar .conversation-search-box input {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

html[data-theme="dark"] .project-folder-item,
html[data-theme="dark"] .project-conversation-item {
    color: var(--text-primary);
}

html[data-theme="dark"] .project-folder-item:hover,
html[data-theme="dark"] .project-conversation-item:hover,
html[data-theme="dark"] .project-conversation-row:hover .project-conversation-item,
html[data-theme="dark"] .recent-conversations-toggle:hover {
    background: var(--bg-tertiary);
}

html[data-theme="dark"] .project-folder-action:hover,
html[data-theme="dark"] .project-folder-action:focus-visible,
html[data-theme="dark"] .project-conversation-menu:hover,
html[data-theme="dark"] .project-conversation-menu:focus-visible {
    background: rgba(71, 85, 105, 0.28);
    color: var(--text-primary);
    box-shadow: none;
}

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

/* ============================================================================
   Layered chat composer: Codex-style hierarchy with CyberStrikeAI controls
   ============================================================================ */

.chat-input-container {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding: 0 22px 14px;
    border-top: 0;
    background: transparent;
    box-sizing: border-box;
    container-name: chat-composer;
    container-type: inline-size;
}

/* The composer is an isolated stacking context. Lift that whole context while the
   settings popover is open so the turn rail and its preview cannot paint above it. */
.chat-input-container.is-session-settings-open {
    z-index: 121;
}

.chat-composer-context {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    min-height: 52px;
    margin: 0 30px -9px;
    padding: 0 15px 9px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    background: #f5f6f7;
    box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.035);
    box-sizing: border-box;
}

.chat-composer-context .chat-input-leading {
    align-items: center;
    gap: 0;
    min-width: 0;
}

.chat-composer-context .chat-input-leading > * {
    position: relative;
    min-width: 0;
}

.chat-composer-context .chat-input-leading > *:not(:last-child) {
    margin-right: 4px;
    padding-right: 5px;
}

.chat-composer-context .chat-input-leading > *:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 11px;
    right: 0;
    bottom: 11px;
    width: 1px;
    background: rgba(15, 23, 42, 0.09);
}

.chat-composer-context .role-selector-btn {
    height: 40px;
    padding: 0 12px;
    gap: 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
    color: #20242a;
    font-size: 14px;
    font-weight: 560;
}

.chat-composer-context .role-selector-btn:hover,
.chat-composer-context .role-selector-btn.active {
    border: 0;
    background: rgba(15, 23, 42, 0.055);
    box-shadow: none;
}

.chat-composer-context .role-selector-btn:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.38);
    outline-offset: -2px;
}

.chat-composer-context .role-selector-icon {
    width: 20px;
    min-width: 20px;
    height: 20px;
    font-size: 18px;
}

.chat-composer-context .role-selector-icon svg {
    display: block;
}

.chat-composer-context .role-selector-text {
    color: #20242a;
    font-size: 14px;
    font-weight: 560;
}

.chat-composer-context .role-selector-arrow {
    color: #737b87;
}

.chat-composer-surface.chat-input-primary-row {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    min-width: 0;
    min-height: 118px;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08), 0 2px 7px rgba(15, 23, 42, 0.05);
    box-sizing: border-box;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.chat-composer-surface.chat-input-primary-row:focus-within {
    border-color: rgba(0, 102, 255, 0.38);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.09), 0 0 0 3px rgba(0, 102, 255, 0.07);
}

.chat-input-container .chat-composer-surface .chat-input-with-files {
    flex: 1;
    gap: 0;
    width: 100%;
    padding: 0;
}

.chat-composer-surface .chat-file-list:not(:empty) {
    padding: 18px 22px 0;
}

.chat-composer-surface .chat-upload-progress-row:not([hidden]) {
    margin: 12px 22px 0;
}

.chat-composer-surface .chat-input-field {
    min-height: 58px;
}

.chat-input-container .chat-composer-surface .chat-input-field > #chat-input {
    width: 100%;
    height: 58px;
    min-height: 58px;
    max-height: 180px;
    padding: 17px 22px 6px;
    border: 0;
    border-radius: 22px 22px 8px 8px;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 450;
    line-height: 1.55;
    box-shadow: none;
    resize: none;
    box-sizing: border-box;
}

.chat-input-container .chat-composer-surface .chat-input-field > #chat-input:focus {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.chat-input-container .chat-composer-surface .chat-input-field > #chat-input::placeholder {
    color: #a0a6af;
    opacity: 1;
}

.chat-composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 50px;
    padding: 2px 12px 9px 14px;
}

.chat-composer-footer-leading,
.chat-composer-footer-trailing {
    display: flex;
    align-items: center;
    min-width: 0;
}

.chat-composer-footer-leading {
    gap: 5px;
}

.chat-composer-footer-trailing {
    justify-content: flex-end;
    gap: 5px;
}

.chat-input-container .chat-upload-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #31363d;
    box-shadow: none;
}

.chat-input-container .chat-upload-btn:hover {
    border: 0;
    background: rgba(15, 23, 42, 0.055);
    color: #111827;
}

.chat-session-shortcut {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #767d87;
    font-family: inherit;
    font-size: 13px;
    font-weight: 520;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.chat-session-shortcut:hover {
    background: rgba(15, 23, 42, 0.055);
    color: #272c33;
}

.chat-session-shortcut:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.35);
    outline-offset: -2px;
}

.chat-hitl-shortcut {
    color: #777e88;
}

.chat-hitl-shortcut > span {
    display: block;
    min-width: 0;
    padding-block: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.chat-session-shortcut-chevron {
    flex-shrink: 0;
    color: #8f96a0;
}

.chat-session-meta {
    padding-right: 8px;
    padding-left: 8px;
    color: #666d77;
    font-size: 13px;
}

.chat-model-shortcut-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.chat-model-shortcut-effort {
    color: #9299a3;
    font-weight: 470;
}

.chat-system-model-caret {
    flex: 0 0 auto;
    transition: transform 0.16s ease;
}

#chat-model-shortcut.active .chat-system-model-caret {
    transform: rotate(180deg);
}

.chat-system-model-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    z-index: 2200;
    display: flex;
    width: min(320px, calc(100vw - 32px));
    max-height: 320px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color, #dbe1ea);
    border-radius: 14px;
    background: var(--bg-primary, #fff);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18), 0 3px 10px rgba(15, 23, 42, 0.08);
    animation: chat-system-model-menu-in 0.16s ease-out;
}

.chat-system-model-menu[hidden] {
    display: none;
}

.chat-system-model-main[hidden],
.chat-system-model-subview[hidden] {
    display: none;
}

@keyframes chat-system-model-menu-in {
    from {
        opacity: 0;
        transform: translateY(5px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-system-model-menu-header {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    min-height: 52px;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 8px 8px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    color: var(--text-primary, #111827);
    font-size: 13px;
}

.chat-system-model-main {
    position: relative;
    padding: 10px;
}

.chat-system-model-setting-row {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary, #111827);
    font-family: inherit;
    cursor: pointer;
}

.chat-system-model-setting-row:hover {
    background: rgba(15, 23, 42, 0.055);
}

.chat-system-model-setting-label {
    font-size: 15px;
    font-weight: 650;
}

.chat-system-model-setting-value {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary, #727984);
    font-size: 14px;
    font-weight: 500;
}

.chat-system-model-setting-value > span {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-system-model-back {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary, #727984);
    cursor: pointer;
}

.chat-system-model-back:hover {
    background: rgba(15, 23, 42, 0.065);
    color: var(--text-primary, #111827);
}

.chat-system-model-subview {
    display: flex;
    min-height: 128px;
    flex-direction: column;
}

.chat-system-model-status {
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted, #8a929d);
    font-size: 11px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-system-model-status[data-tone="success"] {
    color: var(--success-color, #16a067);
}

.chat-system-model-status[data-tone="error"] {
    color: var(--error-color, #dc3545);
}

.chat-system-model-status-live {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.chat-system-model-list {
    min-height: 46px;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
}

.chat-system-model-option,
.chat-system-model-retry {
    display: flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-primary, #111827);
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.chat-system-model-option:hover:not(:disabled),
.chat-system-model-option.is-selected,
.chat-system-model-retry:hover {
    background: rgba(0, 102, 255, 0.08);
}

.chat-system-model-option:disabled {
    opacity: 0.55;
    cursor: wait;
}

.chat-system-model-option-label {
    min-width: 0;
    overflow: hidden;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-system-effort-option-label {
    font-family: inherit;
}

.chat-system-channel-option-label {
    font-family: inherit;
}

.chat-system-model-section-divider {
    height: 1px;
    margin: 5px 10px;
    background: var(--border-color, #e5e7eb);
}

.chat-system-model-current {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(0, 102, 255, 0.12);
    color: var(--accent-color, #0666ee);
    font-size: 10px;
    font-weight: 700;
}

.chat-system-model-retry {
    justify-content: center;
    color: var(--accent-color, #0666ee);
    font-weight: 650;
}

.chat-composer-meta-divider {
    width: 1px;
    height: 18px;
    margin: 0 1px;
    background: rgba(15, 23, 42, 0.1);
}

.chat-input-container .send-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, #1b7aff 0%, #0666ee 100%);
    box-shadow: 0 6px 15px rgba(0, 102, 255, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.chat-input-container .send-btn:hover {
    background: linear-gradient(145deg, #126fe8 0%, #005bd8 100%);
    box-shadow: 0 8px 18px rgba(0, 102, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.chat-input-container .send-btn svg {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
    transition: transform 0.18s ease;
}

.chat-input-container .send-btn:hover svg {
    transform: translate(-50%, -50%);
}

.chat-input-container .send-btn:active svg {
    transform: translate(-50%, -50%);
}

.chat-input-container .send-btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

html[data-theme="dark"] .chat-input-container {
    background: transparent !important;
}

html[data-theme="dark"] .chat-composer-context {
    border-color: #263244;
    background: #172033;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.15);
}

html[data-theme="dark"] .chat-composer-context .role-selector-btn {
    border: 0 !important;
    background: transparent !important;
    color: var(--text-primary);
}

html[data-theme="dark"] .chat-composer-context .role-selector-btn:hover,
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-composer-context .role-selector-text {
    color: var(--text-primary);
}

html[data-theme="dark"] .chat-composer-context .chat-input-leading > *:not(:last-child)::after,
html[data-theme="dark"] .chat-composer-meta-divider {
    background: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .chat-composer-surface.chat-input-primary-row {
    border-color: #2b374b !important;
    background: #0f172a !important;
}

/* Keep the rounded surface as the sole dark background painter. Rectangular
   child backgrounds otherwise cover the color exposed by its top corners. */
html[data-theme="dark"] .chat-input-container .chat-composer-surface .chat-input-with-files,
html[data-theme="dark"] .chat-input-container .chat-composer-surface .chat-input-field {
    background: transparent !important;
}

html[data-theme="dark"] .chat-input-container .chat-composer-surface .chat-input-field > #chat-input {
    border: 0 !important;
    background: transparent !important;
}

html[data-theme="dark"] .chat-input-container .chat-upload-btn {
    border: 0 !important;
    background: transparent !important;
    color: var(--text-secondary);
}

html[data-theme="dark"] .chat-input-container .chat-upload-btn:hover,
html[data-theme="dark"] .chat-session-shortcut:hover {
    background: rgba(148, 163, 184, 0.11) !important;
    color: var(--text-primary);
}

html[data-theme="dark"] .chat-session-shortcut {
    color: var(--text-secondary);
}

html[data-theme="dark"] .chat-system-model-menu {
    border-color: #334155;
    background: #111a2b;
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.45), 0 3px 10px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .chat-system-model-menu-header {
    border-color: #263244;
}

html[data-theme="dark"] .chat-system-model-setting-row:hover,
html[data-theme="dark"] .chat-system-model-back:hover {
    background: rgba(148, 163, 184, 0.11);
}

html[data-theme="dark"] .chat-system-model-option:hover:not(:disabled),
html[data-theme="dark"] .chat-system-model-option.is-selected,
html[data-theme="dark"] .chat-system-model-retry:hover {
    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, reasoning and approval configuration keep one shared source of truth. */
.chat-composer-surface > .chat-session-settings-popover {
    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;
}

.chat-composer-surface > .chat-session-settings-popover.conversation-reasoning-collapsed {
    display: block !important;
    width: min(360px, calc(100% - 32px));
    height: auto;
    min-height: 0;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px) scale(0.985);
}

.chat-composer-surface > .chat-session-settings-popover .conversation-reasoning-card-header {
    min-height: 40px;
}

.chat-composer-surface > .chat-session-settings-popover .conversation-reasoning-body {
    max-height: calc(min(68vh, 620px) - 62px);
    padding: 8px 2px 2px;
    overflow-x: hidden;
    overflow-y: auto;
}

.chat-composer-surface > .chat-session-settings-popover .conversation-reasoning-chevron {
    transform: rotate(90deg);
}

.chat-input-container .send-btn .send-btn-stop-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    display: none;
    width: 13px;
    height: 13px;
    border-radius: 2px;
    background: #fff;
    transform: translate(-50%, -50%);
}

.chat-input-container .send-btn.is-task-running,
.chat-input-container .send-btn.is-task-running:hover,
.chat-input-container .send-btn.is-task-running:active {
    background: #1f2227;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.chat-input-container .send-btn.is-task-running svg {
    display: none;
}

.chat-input-container .send-btn.is-task-running .send-btn-stop-icon {
    display: block;
}

html[data-theme="dark"] .chat-composer-surface > .chat-session-settings-popover {
    border-color: #334155;
    background: rgba(15, 23, 42, 0.99);
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.42), 0 4px 12px rgba(0, 0, 0, 0.24);
}

@media (prefers-reduced-motion: reduce) {
    .chat-composer-surface > .chat-session-settings-popover {
        transition: none;
    }
}

/* Codex-style assistant turn: execution narrative first, durable answer second. */
.message.assistant-turn-with-process,
.message.progress-message {
    margin-bottom: 32px;
}

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

.message.assistant-turn-with-process .mcp-call-section {
    order: 0;
}

.message.assistant-turn-with-process .assistant-final-result {
    order: 1;
    width: 100%;
    max-width: none;
    margin-top: 18px;
    padding: 0 0 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow-x: visible;
    font-size: 0.975rem;
    line-height: 1.72;
}

.message.assistant-turn-with-process .message-time,
.message.assistant-turn-with-process .message-meta-footer {
    order: 2;
}

.message.assistant-turn-with-process .assistant-final-result > :first-child {
    margin-top: 0;
}

.message.assistant-turn-with-process .assistant-final-result > :last-child:not(.message-copy-btn) {
    margin-bottom: 0;
}

.message.assistant-turn-with-process .mcp-call-section {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
}

.turn-process-summary.mcp-call-label,
.progress-summary-toggle.turn-process-summary {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 8px 2px 11px;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 72%, transparent);
    border-radius: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.91rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
}

.turn-process-summary.mcp-call-label::before {
    display: none;
}

.turn-process-summary:hover,
.turn-process-summary:focus-visible {
    color: var(--text-secondary);
}

.turn-process-summary:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent-color) 58%, transparent);
    outline-offset: 3px;
    border-radius: 4px;
}

.turn-process-leading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.turn-process-status-dot {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 50%;
    background: #a8adb5;
}

.turn-process-status-dot.is-running {
    background: var(--accent-color, #0b6cff);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-color, #0b6cff) 10%, transparent);
    animation: codex-turn-pulse 1.55s ease-in-out infinite;
}

.turn-process-token-chip {
    display: inline;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    opacity: 0.72;
    white-space: nowrap;
}

.turn-process-token-chip::before {
    content: "· ";
    color: inherit;
    font-weight: inherit;
}

@keyframes codex-turn-pulse {
    0%, 100% { opacity: 0.55; transform: scale(0.88); }
    50% { opacity: 1; transform: scale(1); }
}

.turn-process-chevron {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: #a4a8ae;
    transition: transform 0.18s ease;
}

.turn-process-summary.is-expanded .turn-process-chevron {
    transform: rotate(90deg);
}

.message.assistant-turn-with-process .mcp-call-toolbar {
    display: none;
}

.message.assistant-turn-with-process .mcp-tool-list,
.message.assistant-turn-with-process .mcp-tool-list.expanded {
    display: none;
}

.message.assistant-turn-with-process .process-details-container {
    margin: 0;
    padding: 0;
    border: 0;
}

.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-container {
    width: 100%;
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.message.progress-message .progress-header {
    margin: 0;
    padding: 0;
    border: 0;
}

.message.progress-message .progress-actions,
.message.progress-message .progress-footer {
    display: none;
}

.message.progress-message .progress-stage {
    margin: 10px 0 3px 24px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
}

.message.progress-message .progress-timeline.expanded {
    max-height: min(64vh, 720px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: auto;
    scrollbar-gutter: stable;
}

/* Open-document execution timeline. */
.message.assistant-turn-with-process .progress-timeline,
.message.progress-message .progress-timeline {
    position: relative;
    padding: 5px 0 7px 22px;
}

.message.assistant-turn-with-process .progress-timeline::before,
.message.progress-message .progress-timeline::before {
    content: "";
    position: absolute;
    top: 11px;
    bottom: 12px;
    left: 7px;
    width: 1px;
    background: color-mix(in srgb, var(--border-color) 82%, transparent);
}

.message.assistant-turn-with-process .timeline-item,
.message.progress-message .timeline-item {
    position: relative;
    margin: 0;
    padding: 7px 0 7px 13px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    content-visibility: auto;
    contain-intrinsic-size: auto 38px;
}

.message.assistant-turn-with-process .timeline-item::before,
.message.progress-message .timeline-item::before {
    content: "";
    position: absolute;
    top: 16px;
    left: -18px;
    width: 7px;
    height: 7px;
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
    background: #a7adb5;
    box-sizing: border-box;
    z-index: 1;
}

.message.assistant-turn-with-process .timeline-item-tool_call::before,
.message.progress-message .timeline-item-tool_call::before {
    background: var(--accent-color, #0b6cff);
}

.message.assistant-turn-with-process .timeline-item-tool_call.tool-call-completed::before,
.message.progress-message .timeline-item-tool_call.tool-call-completed::before {
    background: var(--success-color, #36a854);
}

.message.assistant-turn-with-process .timeline-item-tool_call.tool-call-failed::before,
.message.progress-message .timeline-item-tool_call.tool-call-failed::before,
.message.assistant-turn-with-process .timeline-item-error::before,
.message.progress-message .timeline-item-error::before {
    background: var(--error-color, #dc3545);
}

.message.assistant-turn-with-process .timeline-item-header,
.message.progress-message .timeline-item-header {
    min-height: 24px;
    margin: 0;
    gap: 8px;
}

.message.assistant-turn-with-process .timeline-item-time,
.message.progress-message .timeline-item-time {
    display: none;
}

.message.assistant-turn-with-process .timeline-item-title,
.message.progress-message .timeline-item-title {
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 500;
    line-height: 1.55;
}

.message.assistant-turn-with-process .timeline-item-iteration .timeline-item-title,
.message.progress-message .timeline-item-iteration .timeline-item-title {
    color: var(--text-primary);
    font-weight: 600;
}

/* 主代理轮次是一次新的“模型决策 → 工具结果 → 继续决策”边界。
 * 用轻量横线把长执行过程分组；子代理步骤仍沿用普通时间线节点。 */
.message.assistant-turn-with-process .timeline-item-iteration.timeline-iteration-divider,
.message.progress-message .timeline-item-iteration.timeline-iteration-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding-top: 12px !important;
    padding-bottom: 8px !important;
    overflow: visible;
    content-visibility: visible;
}

.message.assistant-turn-with-process .timeline-item-iteration.timeline-iteration-divider::after,
.message.progress-message .timeline-item-iteration.timeline-iteration-divider::after {
    content: "";
    flex: 1 1 48px;
    min-width: 28px;
    height: 1px;
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--border-color) 88%, transparent),
        color-mix(in srgb, var(--border-color) 20%, transparent)
    );
}

.message.assistant-turn-with-process .timeline-item-iteration.timeline-iteration-divider .timeline-item-header,
.message.progress-message .timeline-item-iteration.timeline-iteration-divider .timeline-item-header {
    flex: 0 1 auto;
    min-width: 0;
    max-width: calc(100% - 40px);
}

.message.assistant-turn-with-process .timeline-item-iteration.timeline-iteration-divider .timeline-item-title,
.message.progress-message .timeline-item-iteration.timeline-iteration-divider .timeline-item-title {
    letter-spacing: 0.01em;
}

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

.message.assistant-turn-with-process .timeline-item-content,
.message.progress-message .timeline-item-content {
    margin: 5px 0 2px;
    padding: 0;
    border: 0;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.6;
}

.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: attr(data-tool-detail-label);
    margin-left: auto;
    padding-left: 12px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
}

.message.assistant-turn-with-process .tool-call-detail-content,
.message.progress-message .tool-call-detail-content {
    margin: 7px 0 4px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-secondary) 68%, transparent);
}

.message.assistant-turn-with-process .tool-args,
.message.assistant-turn-with-process .tool-result,
.message.progress-message .tool-args,
.message.progress-message .tool-result {
    border-color: color-mix(in srgb, var(--border-color) 82%, transparent);
    background: var(--bg-primary);
    font-size: 0.77rem;
}

/* Codex-style inline approval and audit state. */
.hitl-inline-approval.hitl-tool-approval-summary,
.hitl-inline-approval.hitl-inline-approval--merged {
    margin: 5px 0 4px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.hitl-inline-approval.hitl-tool-approval-summary::before,
.hitl-inline-approval.hitl-inline-approval--merged::before {
    display: none;
}

.hitl-codex-tool-row,
.hitl-codex-state {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 27px;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.45;
}

.hitl-codex-tool-row {
    color: var(--text-primary);
    font-weight: 500;
}

.hitl-codex-shield {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: #858a91;
}

.hitl-codex-state strong {
    color: inherit;
    font-weight: 500;
}

.hitl-codex-state--running,
.hitl-codex-state--pending {
    color: var(--text-secondary);
}

.hitl-codex-state--approved {
    color: #2f8a45;
}

.hitl-codex-state--rejected {
    color: var(--error-color, #c73b43);
}

.hitl-codex-state--interrupted {
    color: var(--text-muted);
}

.hitl-codex-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.hitl-codex-spinner {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border: 1.5px solid color-mix(in srgb, currentColor 25%, transparent);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: hitl-codex-spin 0.85s linear infinite;
}

@keyframes hitl-codex-spin {
    to { transform: rotate(360deg); }
}

.hitl-codex-explainer {
    margin: 2px 0 6px 25px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.52;
}

.hitl-approval-heading {
    margin: 8px 0 0 25px;
}

.hitl-approval-heading h3 {
    margin: 3px 0 0;
    color: var(--text-primary);
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.hitl-approval-eyebrow {
    color: #22a06b;
    font-size: 0.75rem;
    font-weight: 650;
}

.hitl-approval-primary {
    margin: 8px 0 0 25px;
}

.hitl-approval-primary code {
    display: block;
    max-height: 112px;
    padding: 9px 11px;
    overflow: auto;
    border: 1px solid color-mix(in srgb, var(--border-color) 82%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-secondary) 84%, transparent);
    color: var(--text-primary);
    font-size: 0.78rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    scrollbar-gutter: stable;
}

.hitl-approval-countdown {
    margin: 10px 0 0 25px;
}

.hitl-approval-countdown--unlimited {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.hitl-approval-countdown--interrupted {
    color: var(--text-muted);
}

.hitl-approval-countdown--interrupted .hitl-codex-state {
    min-height: 24px;
    font-size: 0.78rem;
}

.hitl-approval-interrupted .hitl-approval-eyebrow {
    color: var(--text-muted);
}

.hitl-approval-countdown-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.hitl-approval-countdown-copy strong {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.hitl-approval-progress {
    height: 3px;
    margin-top: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--border-color) 68%, transparent);
}

.hitl-approval-progress-value {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    transition: width 0.25s linear, background-color 0.2s ease;
}

.hitl-approval-expired .hitl-approval-progress-value {
    background: var(--error-color, #dc2626);
}

.hitl-approval-details {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.hitl-approval-details + .hitl-approval-details {
    margin-top: 6px;
}

.hitl-approval-details summary {
    width: max-content;
    max-width: 100%;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 520;
}

.hitl-approval-details pre,
.hitl-approval-details .hitl-inline-edit,
.hitl-approval-details .hitl-inline-comment {
    width: 100%;
    margin: 7px 0 0;
    box-sizing: border-box;
}

.hitl-approval-details pre {
    max-height: 190px;
    padding: 10px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.hitl-inline-actions kbd {
    margin-left: 5px;
    padding: 1px 5px;
    border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    border-radius: 5px;
    background: color-mix(in srgb, currentColor 6%, transparent);
    color: inherit;
    font: inherit;
    font-size: 0.72em;
    opacity: 0.76;
}

.chat-hitl-approval-dock[hidden] {
    display: none !important;
}

.chat-input-container.has-hitl-approval .chat-composer-context,
.chat-input-container.has-hitl-approval .chat-composer-surface {
    display: none;
}

.chat-hitl-approval-dock {
    position: relative;
    z-index: 4;
    display: block;
    width: 100%;
    min-height: 158px;
    max-height: min(62vh, 560px);
    max-height: min(62dvh, 560px);
    padding: 18px 20px 74px;
    overflow: hidden;
    overscroll-behavior: contain;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.985);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.11), 0 2px 8px rgba(15, 23, 42, 0.05);
    box-sizing: border-box;
    outline: none;
}

.chat-hitl-approval-scroll-region {
    min-height: 0;
    max-height: max(76px, calc(min(62vh, 560px) - 94px));
    max-height: max(76px, calc(min(62dvh, 560px) - 94px));
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding-bottom: 12px;
    scrollbar-gutter: stable;
}

.chat-hitl-approval-dock .hitl-codex-tool-row {
    font-size: 0.92rem;
}

.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: 26px;
}

.chat-hitl-approval-dock .hitl-approval-heading h3 {
    display: -webkit-box;
    max-width: 900px;
    overflow: hidden;
    font-size: 1rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.chat-hitl-approval-dock .hitl-inline-body {
    gap: 6px;
    margin-top: 10px;
    padding: 0;
}

.chat-hitl-approval-dock .hitl-edit-args {
    max-height: min(28vh, 220px);
    max-height: min(28dvh, 220px);
    overflow: auto;
    resize: vertical;
}

.chat-hitl-approval-dock .hitl-inline-actions {
    position: absolute;
    right: 20px;
    bottom: 16px;
    left: 20px;
    z-index: 2;
    min-height: 48px;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 0;
    padding: 10px 0 0;
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
    background: rgba(255, 255, 255, 0.985);
    box-shadow: none;
}

.chat-hitl-approval-dock .hitl-inline-status {
    margin-right: auto;
}

.chat-hitl-approval-dock .hitl-inline-approve,
.chat-hitl-approval-dock .hitl-inline-reject {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
}

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

html[data-theme="dark"] .chat-hitl-approval-dock {
    border-color: color-mix(in srgb, var(--border-color) 88%, transparent);
    background: color-mix(in srgb, var(--bg-primary) 97%, transparent);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .chat-hitl-approval-dock .hitl-inline-actions {
    border-color: color-mix(in srgb, var(--border-color) 70%, transparent) !important;
    background: color-mix(in srgb, var(--bg-primary) 97%, transparent) !important;
    box-shadow: none;
}

html[data-theme="dark"] .hitl-approval-primary code,
html[data-theme="dark"] .hitl-approval-details pre {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.5);
}

.hitl-codex-diff {
    margin: 4px 0 4px 25px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.hitl-codex-diff summary {
    width: max-content;
    cursor: pointer;
}

.hitl-codex-diff pre {
    max-height: 220px;
    margin: 8px 0 0;
    padding: 10px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.76rem;
}

.hitl-tool-approval-summary .hitl-inline-body {
    gap: 8px;
    margin: 8px 0 0 25px;
    padding: 0;
}

.hitl-tool-approval-summary .hitl-inline-actions {
    justify-content: flex-end;
    gap: 7px;
    margin: 9px 0 0 25px;
    padding: 9px 0 0;
    border-top: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
    background: transparent;
}

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

.hitl-tool-approval-summary .hitl-inline-status {
    margin-right: auto;
}

.hitl-tool-approval-summary .hitl-config-input,
.hitl-tool-approval-summary .hitl-edit-args {
    border-radius: 7px;
    background: var(--bg-primary);
}

html[data-theme="dark"] .message.assistant-turn-with-process .timeline-item::before,
html[data-theme="dark"] .message.progress-message .timeline-item::before {
    border-color: var(--bg-primary);
}

html[data-theme="dark"] .hitl-inline-approval.hitl-tool-approval-summary,
html[data-theme="dark"] .hitl-inline-approval.hitl-inline-approval--merged {
    border: 0;
    background: transparent;
    box-shadow: none;
}

@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; }
.tool-status-badge.tool-status-blocked,
.status-chip.status-blocked,
.monitor-status-chip.blocked,
.mcp-stats-kpi__chip.is-blocked,
.mcp-stats-tool-item__pill.is-blocked {
    color: var(--tool-blocked-color);
    background: rgba(217, 146, 36, .12);
    border: 1px solid rgba(217, 146, 36, .32);
}
.timeline-item-tool_call.tool-call-blocked,
.timeline-item-tool_result.tool-call-blocked {
    border: 1px solid rgba(217, 146, 36, .32);
    border-left: 3px solid var(--tool-blocked-color);
    background: rgba(217, 146, 36, .065);
}
.tool-result-section.blocked .tool-result,
#mcp-detail-modal .code-block.blocked,
.mcp-detail-btn[data-status="blocked"] {
    color: var(--text-primary);
    border-color: rgba(217, 146, 36, .32);
    background: rgba(217, 146, 36, .055);
}
.message.assistant-turn-with-process .timeline-item.tool-call-blocked::before,
.message.progress-message .timeline-item.tool-call-blocked::before {
    background: var(--tool-blocked-color);
}
.mcp-stats-blocked-note,
.mcp-stats-timeline-moment__blocked {
    color: var(--tool-blocked-color);
}
.mcp-stats-blocked-note { display: inline-block; margin-left: 8px; font-size: .75rem; }
.mcp-stats-timeline-bar-blocked { fill: #d99224; opacity: .8; }
.mcp-stats-timeline-bar-blocked.is-hover { opacity: 1; }
.mcp-stats-timeline-line--blocked { fill: none; stroke: #d99224; stroke-width: 1.5; }
.mcp-stats-timeline__legend-item--blocked::before { background: #d99224; }
.mcp-stats-rate.is-muted,
.mcp-stats-tool-item__rate.is-muted { color: var(--text-muted); }
