/* ============================================
   SQL扫描模块原型 - 全局样式
   从 Vue3 SPA 转换为纯 HTML/CSS/JS
   ============================================ */

/* ---------- CSS 变量 ---------- */
:root {
  --primary: #1890ff;
  --primary-light: #e6f7ff;
  --primary-hover: #40a9ff;
  --success: #52c41a;
  --success-bg: #f6ffed;
  --warning: #faad14;
  --warning-bg: #fffbe6;
  --danger: #ff4d4f;
  --danger-bg: #fff1f0;
  --info: #1890ff;
  --cyan: #13c2c2;

  --text-primary: #222;
  --text-regular: #606266;
  --text-secondary: #909399;
  --text-placeholder: #c0c4cc;

  --border-color: #e8e8e8;
  --border-color-light: #f0f0f0;
  --bg-page: #f0f2f5;
  --bg-sidebar: #f7f8fa;
  --bg-white: #ffffff;
  --bg-table-header: #fafafa;
  --bg-hover: #f5f5f5;

  --header-height: 56px;
  --sidebar-width: 200px;

  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.12);

  --font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 13px;
  --font-size-base: 14px;
  --font-size-md: 15px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-xxl: 20px;
}

/* ---------- Reset ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-hover);
}

ul, ol {
  list-style: none;
}

/* ---------- 通用按钮 ---------- */
button {
  font-family: inherit;
  font-size: var(--font-size-sm);
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  color: var(--text-regular);
  padding: 4px 15px;
  border-radius: var(--radius-md);
  line-height: 1.5;
  transition: all 0.2s;
}

button:hover {
  color: var(--primary);
  border-color: var(--primary);
}

button:disabled {
  color: var(--text-placeholder);
  cursor: not-allowed;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.primary-btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.cancel-btn {
  background: var(--bg-white);
  color: var(--text-regular);
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  padding: 0 4px;
  cursor: pointer;
  font-size: var(--font-size-sm);
}

.link-btn:hover {
  color: var(--primary-hover);
}

.op-btn {
  margin-right: 8px;
}

.toolbar-btn {
  padding: 4px 12px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}

.toolbar-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.add-btn, .search-btn, .filter-btn {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 4px 12px;
  border-radius: var(--radius-md);
}

.add-btn:hover, .search-btn:hover, .filter-btn:hover {
  background: var(--primary-hover);
}

.table-btn {
  background: none;
  border: none;
  color: var(--primary);
  padding: 0 6px;
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.table-btn:hover {
  color: var(--primary-hover);
}

.table-btn.danger {
  color: var(--danger);
}

/* ---------- 输入控件 ---------- */
input[type="text"], input[type="number"], input[type="password"],
input[type="date"], input[type="email"], textarea, select {
  font-family: inherit;
  font-size: var(--font-size-sm);
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg-white);
  color: var(--text-primary);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
}

input:disabled, textarea:disabled, select:disabled {
  background: #f5f5f5;
  color: var(--text-placeholder);
  cursor: not-allowed;
}

.search-input, .filter-input, .form-input, .source-select, .template-input {
  width: auto;
  min-width: 120px;
  padding: 4px 8px;
}

select.select, .page-size-select {
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  background: var(--bg-white);
}

/* ---------- 布局外壳 ---------- */
.layout-root {
  min-height: 100vh;
  background: var(--bg-page);
}

/* ---------- 顶部栏 ---------- */
.app-header {
  height: var(--header-height);
  background: #001529;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
}

.header-logo {
  color: var(--primary);
  font-size: var(--font-size-lg);
  font-weight: 600;
  white-space: nowrap;
}

.header-nav {
  display: flex;
  gap: 20px;
}

.header-nav a {
  color: rgba(255,255,255,0.65);
  font-size: var(--font-size-base);
}

.header-nav a:hover, .header-nav a.active {
  color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  color: rgba(255,255,255,0.85);
  font-size: var(--font-size-sm);
}

.header-bell {
  position: relative;
  cursor: pointer;
  font-size: var(--font-size-lg);
}

.header-bell .badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
}

/* ---------- 布局体 ---------- */
.layout-body {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

/* ---------- 侧边栏 ---------- */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color-light);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.sidebar-group {
  padding: 8px 0;
}

.sidebar-group-title {
  padding: 6px 20px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
}

.sidebar-item {
  padding: 8px 20px 8px 24px;
  font-size: var(--font-size-sm);
  color: var(--text-regular);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.sidebar-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
  border-right: 3px solid var(--primary);
}

.sidebar-sub-item {
  padding: 6px 20px 6px 40px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  cursor: pointer;
}

.sidebar-sub-item:hover {
  color: var(--primary);
}

.sidebar-sub-item.active {
  color: var(--primary);
  font-weight: 500;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color-light);
}

.space-config-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--text-regular);
}

.space-config-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ---------- 空间配置弹窗 ---------- */
.space-menu-pop {
  position: fixed;
  bottom: 48px;
  left: 180px;
  width: 200px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
}

.space-menu-pop.show {
  display: block;
}

.space-menu-pop .menu-item {
  padding: 8px 16px;
  font-size: var(--font-size-sm);
  cursor: pointer;
  border-bottom: 1px solid var(--border-color-light);
}

.space-menu-pop .menu-item:last-child {
  border-bottom: none;
}

.space-menu-pop .menu-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ---------- 主内容区 ---------- */
.main-content {
  flex: 1;
  padding: 16px 24px;
  min-width: 0;
  overflow-x: auto;
}

/* ---------- 面包屑 ---------- */
.breadcrumb {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.breadcrumb-sep {
  margin: 0 4px;
}

/* ---------- Tab 导航 ---------- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color-light);
  margin-bottom: 16px;
  gap: 0;
}

.tab {
  padding: 8px 20px;
  font-size: var(--font-size-base);
  color: var(--text-regular);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--primary);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

/* ---------- 状态按钮区 ---------- */
.status-btn-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.status-btns-left, .status-btns-right {
  display: flex;
  gap: 8px;
}

/* ---------- 工具栏 ---------- */
.toolbar {
  margin-bottom: 12px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-left .search-input {
  width: 200px;
}

.toolbar-left .select {
  width: auto;
  min-width: 120px;
}

/* ---------- 表格通用 ---------- */
.table-wrapper {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

table.quality-table,
table.rule-table,
table.rule-set-table,
table.rule-set-list-table,
table.notice-table,
table.detail-table,
table.ruleset-table,
table.addruleset-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.quality-table th, .quality-table td,
.rule-table th, .rule-table td,
.rule-set-table th, .rule-set-table td,
.rule-set-list-table th, .rule-set-list-table td,
.notice-table th, .notice-table td,
.detail-table th, .detail-table td,
.ruleset-table th, .ruleset-table td,
.addruleset-table th, .addruleset-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color-light);
  white-space: nowrap;
}

.quality-table th,
.rule-table th,
.rule-set-table th,
.rule-set-list-table th,
.notice-table th,
.detail-table th,
.ruleset-table th,
.addruleset-table th {
  background: var(--bg-table-header);
  font-weight: 600;
  color: var(--text-regular);
  white-space: nowrap;
}

.quality-table tbody tr:hover,
.rule-table tbody tr:hover,
.rule-set-table tbody tr:hover,
.rule-set-list-table tbody tr:hover,
.ruleset-table tbody tr:hover {
  background: var(--bg-hover);
}

.sub {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

/* ---------- 标签/Tag ---------- */
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  line-height: 1.5;
}

.tag.pass, .tag.green {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #b7eb8f;
}

.tag.fail {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #ffa39e;
}

.tag.blue {
  background: #e6f7ff;
  color: var(--primary);
  border: 1px solid #91d5ff;
}

.tag.yellow {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid #ffe58f;
}

/* ---------- 质量门禁 Popover ---------- */
.quality-tag-container {
  position: relative;
}

.quality-detail-popover {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  min-width: 360px;
  display: none;
}

.quality-detail-popover.show {
  display: block;
}

/* ---------- 分页 ---------- */
.pagination,
.rule-set-pagination,
.rule-set-list-pagination,
.native-pagination,
.rule-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  color: var(--text-regular);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-regular);
}

.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-btn:disabled {
  color: var(--text-placeholder);
  cursor: not-allowed;
}

.page-input {
  width: 48px;
  text-align: center;
}

/* ---------- 弹窗/模态框 ---------- */
.modal-mask,
.dialog-mask,
.confirm-dialog-mask,
.addruleset-dialog-mask,
.addruleset-dialog-mask2 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
}

.modal-mask.show,
.dialog-mask.show,
.confirm-dialog-mask.show,
.addruleset-dialog-mask.show {
  display: flex;
}

.modal-container,
.dialog-box,
.confirm-dialog,
.addruleset-dialog {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 80vh;
  overflow-y: auto;
  width: 600px;
  max-width: 90vw;
}

.modal-header,
.dialog-title,
.confirm-dialog-header,
.addruleset-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-color-light);
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.modal-close-btn,
.dialog-close-icon,
.confirm-dialog-close,
.addruleset-dialog-close {
  cursor: pointer;
  font-size: var(--font-size-xl);
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 0 4px;
}

.modal-close-btn:hover,
.dialog-close-icon:hover,
.confirm-dialog-close:hover {
  color: var(--text-primary);
}

.modal-form,
.dialog-content,
.confirm-dialog-content,
.addruleset-dialog-body {
  padding: 24px;
}

/* ---------- 表单行 ---------- */
.form-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 8px;
}

.form-row > label {
  width: 120px;
  text-align: right;
  font-size: var(--font-size-sm);
  color: var(--text-regular);
  padding-top: 5px;
  flex-shrink: 0;
}

.form-row .form-input,
.form-row input,
.form-row select,
.form-row textarea {
  flex: 1;
  max-width: 400px;
}

.form-row.vertical > label {
  width: auto;
  text-align: left;
  margin-bottom: 4px;
}

.form-row.vertical {
  flex-direction: column;
}

.required,
.required-star {
  color: var(--danger);
  margin-right: 2px;
}

.form-error {
  color: var(--danger);
  font-size: var(--font-size-xs);
  margin-left: 8px;
  padding-top: 5px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
}

.radio-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.radio-group label,
.form-row label input[type="radio"],
.form-row label input[type="checkbox"] {
  cursor: pointer;
  font-size: var(--font-size-sm);
}

/* ---------- 文件路径列表 ---------- */
.file-path-list {
  flex: 1;
}

.file-path-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.input-with-icon {
  flex: 1;
  position: relative;
}

.input-with-icon input {
  width: 100%;
}

.tips-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  cursor: help;
  color: var(--text-secondary);
}

/* ---------- Toast 提示 ---------- */
.toast-tip {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #333;
  color: #fff;
  padding: 8px 24px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  z-index: 2000;
  display: none;
}

.toast-tip.show {
  display: block;
}

.toast-tip[data-type="success"] {
  background: var(--success);
}

/* ---------- 抽屉（日志侧栏） ---------- */
.drawer-mask {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3);
  z-index: 900;
  display: none;
}

.drawer-mask.show {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 520px;
  max-width: 90vw;
  height: 100%;
  background: var(--bg-white);
  z-index: 1000;
  box-shadow: -4px 0 12px rgba(0,0,0,0.1);
  display: none;
  flex-direction: column;
}

.drawer.show {
  display: flex;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-color-light);
  font-size: var(--font-size-lg);
  font-weight: 600;
}

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

/* ---------- 步骤列表（日志） ---------- */
.step-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.step-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}

.step-item::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 20px;
  bottom: 0;
  width: 1px;
  background: var(--border-color);
}

.step-item:last-child::before {
  display: none;
}

.step-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--bg-white);
  flex-shrink: 0;
  margin-top: 4px;
  z-index: 1;
}

.step-dot.success {
  border-color: var(--success);
  background: var(--success);
}

.step-dot.error {
  border-color: var(--danger);
  background: var(--danger);
}

.step-content {
  flex: 1;
}

.step-title {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  margin-bottom: 4px;
}

.step-time {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.log-content {
  margin-top: 8px;
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: "SF Mono", "Monaco", monospace;
  font-size: var(--font-size-xs);
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

/* ---------- 影响程度圆点 ---------- */
.level-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
}

.level-danger {
  background: var(--danger);
}

.level-warning {
  background: var(--warning);
}

.level-info {
  background: var(--primary);
}

/* ---------- Switch 开关 ---------- */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ccc;
  transition: 0.3s;
  border-radius: 20px;
}

.slider::before {
  position: absolute;
  content: '';
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background: white;
  transition: 0.3s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(16px);
}

/* ---------- 角色标签选择器 ---------- */
.role-tag-select {
  position: relative;
}

.role-tag-display {
  min-height: 28px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px 24px 2px 8px;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  position: relative;
}

.role-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
}

.role-tag-remove {
  cursor: pointer;
  font-size: 12px;
  opacity: 0.6;
}

.role-tag-remove:hover {
  opacity: 1;
}

.role-tag-placeholder {
  color: var(--text-placeholder);
  font-size: var(--font-size-sm);
}

.role-tag-arrow {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-secondary);
}

.role-tag-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
}

.role-tag-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  font-size: var(--font-size-sm);
}

.role-tag-option:hover {
  background: var(--bg-hover);
}

.role-tag-option.selected {
  color: var(--primary);
}

.role-tag-check {
  color: var(--primary);
}

/* ---------- 卡片（慢SQL统计） ---------- */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* ---------- 慢SQL 表单弹窗 ---------- */
.slow-sql-modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding-top: 40px;
}

.slow-sql-modal-mask.show {
  display: flex;
}

.slow-sql-modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  width: 800px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
}

.slow-sql-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-color-light);
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.slow-sql-modal-body {
  padding: 24px;
}

.slow-sql-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.slow-sql-form-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slow-sql-form-item.full {
  grid-column: 1 / -1;
}

.slow-sql-form-item label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.slow-sql-modal-input,
.slow-sql-modal-select {
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}

.slow-sql-modal-input.editable {
  border-color: var(--primary);
}

.slow-sql-modal-textarea {
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  min-height: 60px;
  resize: vertical;
  font-family: inherit;
}

.slow-sql-modal-textarea.small {
  min-height: 40px;
}

.slow-sql-progress-input {
  display: flex;
  align-items: center;
  gap: 4px;
}

.slow-sql-progress-suffix {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.slow-sql-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px;
  border-top: 1px solid var(--border-color-light);
}

.slow-sql-btn {
  padding: 4px 16px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-white);
}

.slow-sql-btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.slow-sql-btn.ghost {
  background: var(--bg-white);
  color: var(--text-regular);
}

/* ---------- 扫描任务详情页 ---------- */
.scan-detail-page {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 16px 24px;
}

.scan-detail-back {
  margin-bottom: 12px;
}

.detail-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color-light);
  margin-bottom: 16px;
}

.detail-tab {
  padding: 8px 16px;
  cursor: pointer;
  font-size: var(--font-size-base);
  color: var(--text-regular);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.detail-tab:hover {
  color: var(--primary);
}

.detail-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

/* ---------- 信息卡片 ---------- */
.info-card {
  background: #fafafa;
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.info-card-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color-light);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 24px;
}

.info-grid .info-item {
  display: flex;
  gap: 8px;
}

.info-grid .info-label {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  white-space: nowrap;
}

.info-grid .info-value {
  color: var(--text-primary);
  font-size: var(--font-size-sm);
}

/* ---------- 风险环形图（CSS conic-gradient） ---------- */
.risk-chart-container {
  display: flex;
  gap: 24px;
  align-items: center;
}

.risk-ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.risk-ring-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.risk-ring-center .ring-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.risk-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.risk-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
}

.risk-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.risk-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.risk-bar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
}

.risk-bar-label {
  width: 80px;
  text-align: right;
  color: var(--text-secondary);
}

.risk-bar-track {
  flex: 1;
  height: 20px;
  background: #f5f5f5;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.risk-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.5s;
}

.risk-bar-value {
  width: 40px;
  text-align: left;
}

/* ---------- 工程平台架构图 ---------- */
.engineering-platform {
  background: #f5f7fa;
  padding: 24px;
}

.ep-header {
  text-align: center;
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 16px;
  color: #222;
  letter-spacing: 2px;
}

.ep-portal {
  background: #a5c6f7;
  border-radius: var(--radius-lg);
  padding: 12px 0 8px 0;
  margin-bottom: 18px;
  text-align: center;
}

.ep-portal-title {
  font-size: var(--font-size-lg);
  font-weight: bold;
  margin-bottom: 6px;
}

.ep-portal-items span {
  display: inline-block;
  background: #fff;
  color: #3a6ea5;
  border-radius: var(--radius-md);
  margin: 0 8px;
  padding: 4px 16px;
  font-size: var(--font-size-md);
  font-weight: 500;
  box-shadow: 0 1px 2px #e0e7ef;
}

.ep-main {
  margin: 0 auto;
  max-width: 1400px;
}

.ep-row {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
  gap: 18px;
}

.ep-block {
  background: #e3edfa;
  border-radius: var(--radius-lg);
  min-width: 180px;
  min-height: 120px;
  box-shadow: 0 2px 8px #e0e7ef;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px 12px 8px;
  flex: 1 1 0;
  max-width: 240px;
}

.ep-block-title {
  font-size: var(--font-size-lg);
  font-weight: bold;
  color: #1a3e6e;
  margin-bottom: 8px;
  text-align: center;
}

.ep-block-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--font-size-sm);
  color: #333;
  text-align: center;
}

.ep-footer {
  margin-top: 32px;
  text-align: center;
}

.ep-footer-desc {
  font-size: var(--font-size-md);
  color: #666;
  margin-bottom: 8px;
}

.ep-footer-bar {
  display: inline-block;
  background: #f7c873;
  color: #222;
  border-radius: var(--radius-lg);
  padding: 6px 32px;
  font-size: var(--font-size-lg);
  font-weight: bold;
  margin: 0 12px 6px 12px;
}

/* ---------- 配置中心页面 ---------- */
.config-breadcrumb {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.config-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color-light);
  margin-bottom: 16px;
}

.config-tab {
  padding: 8px 20px;
  font-size: var(--font-size-base);
  color: var(--text-regular);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.config-tab:hover {
  color: var(--primary);
}

.config-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

.config-tab-content {
  min-height: 400px;
}

/* ---------- 全局配置（归档时间） ---------- */
.global-config-page {
  padding: 24px;
  max-width: 600px;
}

.global-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: 12px;
}

.global-desc-list {
  margin-bottom: 16px;
  padding-left: 16px;
}

.global-desc-list li {
  list-style: disc;
  font-size: var(--font-size-sm);
  color: var(--text-regular);
  margin-bottom: 6px;
  line-height: 1.8;
}

.global-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.global-form-label {
  font-size: var(--font-size-sm);
  color: var(--text-regular);
}

.global-form-input {
  width: 80px;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.global-form-unit {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.global-form-tip {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.global-save-btn {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 4px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* ---------- 筛选区（规则配置） ---------- */
.filter-section {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: var(--font-size-sm);
}

.filter-label {
  color: var(--text-regular);
  white-space: nowrap;
}

.filter-row label {
  cursor: pointer;
  font-size: var(--font-size-sm);
}

/* ---------- 规则集配置弹窗步骤条 ---------- */
.step-bar {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  gap: 12px;
}

.step-bar .step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  margin-right: 8px;
}

.step-bar .step-circle.active {
  background: var(--cyan);
  color: #fff;
}

.step-bar .step-circle.inactive {
  background: #d9e6ef;
  color: #888;
}

.step-bar .step-text {
  font-size: var(--font-size-xl);
}

.step-bar .step-text.active {
  color: #234;
  font-weight: 600;
}

.step-bar .step-text.inactive {
  color: #888;
}

.step-bar .step-line {
  flex: 1;
  height: 2px;
  background: #d9e6ef;
}

/* ---------- 扫描方案页面 ---------- */
.scanplan-page {
  display: flex;
  gap: 0;
}

.scanplan-sidebar {
  width: 240px;
  background: var(--bg-white);
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-md);
  padding: 12px;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: var(--font-size-base);
  font-weight: 600;
}

.sidebar-search-input {
  width: 100%;
  padding: 4px 8px;
  margin-bottom: 12px;
}

.sidebar-group-header {
  cursor: pointer;
  user-select: none;
  font-size: var(--font-size-sm);
  padding: 4px 0;
}

.scanplan-sidebar .sidebar-item {
  padding: 6px 8px 6px 20px;
  font-size: var(--font-size-sm);
  cursor: pointer;
  border-radius: var(--radius-md);
}

.scanplan-sidebar .sidebar-item:hover {
  background: var(--primary-light);
}

.scanplan-sidebar .sidebar-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.scanplan-main {
  flex: 1;
  background: var(--bg-white);
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-left: 12px;
}

/* ---------- 页面切换 ---------- */
.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

/* ---------- 通知配置保存行 ---------- */
.save-btn-row {
  margin-top: 16px;
}

.save-btn {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 4px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.toast-success {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--success);
  color: #fff;
  padding: 8px 24px;
  border-radius: var(--radius-md);
  z-index: 2000;
  display: none;
}

.toast-success.show {
  display: block;
}

/* ---------- 富文本替代 textarea ---------- */
.quill-editor {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  font-size: var(--font-size-sm);
  resize: vertical;
  font-family: inherit;
}

/* ---------- 确认弹窗小尺寸 ---------- */
.confirm-dialog {
  width: 340px;
  max-width: 90vw;
}

.confirm-dialog-content {
  padding: 24px;
  font-size: var(--font-size-md);
}

.confirm-dialog-footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 24px 24px;
}

.confirm-dialog-btn {
  padding: 4px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-white);
}

.confirm-dialog-btn.confirm {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ---------- 阈值表格 ---------- */
.threshold-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  margin-top: 8px;
}

.threshold-table th,
.threshold-table td {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.threshold-table th {
  background: var(--bg-table-header);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1200px) {
  .ep-main {
    max-width: 100%;
  }
  .ep-row {
    flex-wrap: wrap;
  }
  .ep-block {
    min-width: 140px;
    max-width: 180px;
    font-size: 13px;
  }
  .stats-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .app-sidebar {
    display: none;
  }
  .stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .info-grid {
    grid-template-columns: 1fr;
  }
  .slow-sql-form-grid {
    grid-template-columns: 1fr;
  }
}
