/* 百炼知识库管理 —— 样式 */

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

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e2e5ea;
  --border-strong: #cdd3dc;
  --text: #1f2329;
  --text-muted: #737a87;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff4ff;
  --danger: #d92d20;
  --danger-hover: #b42318;
  --danger-soft: #fef3f2;
  --success: #12a150;
  --success-soft: #ecfdf3;
  --warning: #d97706;
  --warning-soft: #fffaeb;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.16);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
}

[hidden] {
  display: none !important;
}

/* ---------------- 通用控件 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--text-muted);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

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

.btn-danger {
  color: var(--danger);
  border-color: #f3c3bf;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
}

.btn-text {
  border: none;
  background: none;
  color: var(--primary);
  padding: 0 4px;
  height: auto;
}

.btn-text:hover:not(:disabled) {
  text-decoration: underline;
  background: none;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.field .hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* 账号弹窗里的知识库多选 */
.kb-picker {
  max-height: 168px;
  overflow-y: auto;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.kb-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
}

.kb-picker-item input {
  flex: none;
  cursor: pointer;
}

.input,
select.input,
textarea.input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

textarea.input {
  height: auto;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.6;
}

.input:focus,
select.input:focus,
textarea.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ---------------- 登录 / 初始化 ---------------- */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #eef2f9 0%, #f4f5f7 55%, #eef4f2 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow-lg);
}

.auth-card .brand {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.auth-card .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
  margin-bottom: 26px;
}

.auth-card .btn-primary {
  width: 100%;
  height: 38px;
  margin-top: 4px;
}

/* ---------------- 主布局 ---------------- */

.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .brand {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
}

.topbar .brand::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--primary);
}

.topbar .user-area {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}

.role-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-left: 6px;
}

.role-tag.agent {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.sidebar {
  width: 178px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
}

.sidebar .nav-group {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  padding: 14px 10px 6px;
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 11px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  margin-bottom: 2px;
  transition: background 0.12s;
}

.nav-item:hover {
  background: var(--surface-2);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 500;
}

.content {
  flex: 1;
  padding: 22px 26px 60px;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.page-head h2 {
  font-size: 17px;
  font-weight: 600;
}

.page-head .desc {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 3px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------------- 卡片 / 表格 ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card + .card {
  margin-top: 16px;
}

.card-body {
  padding: 18px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  text-align: left;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background: var(--surface-2);
}

.doc-name {
  font-weight: 500;
  word-break: break-all;
}

.cell-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.row-actions {
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ---------------- 状态标签 ---------------- */

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-success {
  background: var(--success-soft);
  color: var(--success);
}

.tag-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.tag-muted {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ---------------- 应用观测 ---------------- */

/* 首页总览指标 */

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  flex: 1 1 150px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-label {
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 21px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-value.high {
  color: var(--success);
}

.stat-value.mid {
  color: var(--warning);
}

.stat-value.low {
  color: var(--danger);
}

/* 一行两个应用 */
.observe-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* 网格自己控好了间距，别再叠加 .card + .card 的上边距 */
.observe-grid > .card + .card {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .observe-grid {
    grid-template-columns: 1fr;
  }
}

.observe-app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.observe-app-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.observe-app-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.observe-app-kb {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observe-app-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* 覆盖率走势图（手写 SVG） */

.cov-chart {
  padding: 12px 14px 4px;
  --cov-color: var(--text-muted);
}

.cov-chart.high {
  --cov-color: var(--success);
}

.cov-chart.mid {
  --cov-color: var(--warning);
}

.cov-chart.low {
  --cov-color: var(--danger);
}

.cov-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.cov-grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.cov-area {
  fill: var(--cov-color);
  fill-opacity: 0.08;
}

.cov-path {
  fill: none;
  stroke: var(--cov-color);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.cov-dot {
  fill: var(--surface);
  stroke: var(--cov-color);
  stroke-width: 2;
}

.cov-axis {
  fill: var(--text-muted);
  font-size: 11px;
}

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

.cov-bar {
  width: 90px;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.cov-fill {
  height: 100%;
  border-radius: 3px;
}

.cov-fill.high {
  background: var(--success);
}

.cov-fill.mid {
  background: var(--warning);
}

.cov-fill.low {
  background: var(--danger);
}

.cov-num {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 上传区 ---------------- */

.drop-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 26px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  margin-bottom: 16px;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.drop-zone:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.drop-zone.dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.drop-zone strong {
  color: var(--text);
  font-weight: 500;
}

.drop-zone.dragging strong {
  color: var(--primary);
}

/* ---------------- 弹窗 ---------------- */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 60;
}

.modal {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow: auto;
}

.modal-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h3 {
  font-size: 15.5px;
  font-weight: 600;
}

.modal-close {
  border: none;
  background: none;
  font-size: 21px;
  line-height: 1;
  color: var(--text-muted);
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px 22px;
}

.modal-foot {
  padding: 14px 22px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------------- 任务进度 ---------------- */

.steps {
  list-style: none;
}

.step {
  display: flex;
  gap: 11px;
  padding: 7px 0;
  align-items: flex-start;
}

.step-dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
}

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

.step.success .step-dot::after {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

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

.step.failed .step-dot::after {
  content: "";
  position: absolute;
  left: 6.5px;
  top: 3px;
  width: 2px;
  height: 7px;
  background: #fff;
}

.step.running .step-dot {
  border-color: var(--primary);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0);
  }
}

.step-label {
  font-size: 13.5px;
}

.step.pending .step-label {
  color: var(--text-muted);
}

.step-detail {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.step.failed .step-label {
  color: var(--danger);
}

.task-result {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
}

.task-result.success {
  background: var(--success-soft);
  color: #05603a;
}

.task-result.failed {
  background: var(--danger-soft);
  color: #912018;
}

/* ---------------- 召回测试 ---------------- */

.retrieve-form {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.retrieve-form textarea {
  flex: 1;
}

.retrieve-form .btn {
  height: 60px;
  padding: 0 20px;
}

.node {
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}

.node:last-child {
  border-bottom: none;
}

.node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.node-source {
  font-size: 12.5px;
  color: var(--text-muted);
  word-break: break-all;
}

.node-score {
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 1px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.node-text {
  font-size: 13.5px;
  color: #344054;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
}

/* ---------------- 提示条 ---------------- */

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.6;
}

.alert-warning {
  background: var(--warning-soft);
  border: 1px solid #fde9b8;
  color: #93540d;
}

.alert-danger {
  background: var(--danger-soft);
  border: 1px solid #fbd3cf;
  color: #912018;
}

.alert-info {
  background: var(--primary-soft);
  border: 1px solid #d2e0fd;
  color: #1a45a8;
}

/* ---------------- 浮动提示 ---------------- */

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 90;
}

.toast {
  background: #1f2329;
  color: #fff;
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  animation: slide-in 0.16s ease-out;
}

.toast.error {
  background: var(--danger);
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
}

/* ---------------- 载入态 ---------------- */

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-row {
  padding: 34px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------------- 小屏适配 ---------------- */

@media (max-width: 760px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    overflow-x: auto;
    padding: 8px;
  }

  .sidebar .nav-group {
    display: none;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .content {
    padding: 16px 14px 50px;
  }

  .table th,
  .table td {
    padding: 9px 10px;
  }
}

/* ---------------- 时间管理 ---------------- */

.inline-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-row .input {
  flex: 1;
}

.inline-row .btn {
  flex-shrink: 0;
}

/* 一行两个作用域，与「应用观测」卡片同宽 */
.scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.scope-grid > .card + .card {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .scope-grid {
    grid-template-columns: 1fr;
  }
}

/* 作用域卡片底部的「加一条」 */
.scope-add-row {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ------------------------- 规则管理 ------------------------- */

.fr-value-cell {
  word-break: break-all;
}

.fr-value-cell.fr-disabled {
  text-decoration: line-through;
  color: var(--muted, #999);
}

.fr-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}

/* 按智能体：左侧列表 + 右侧规则 */
.fr-layout {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

@media (max-width: 1000px) {
  .fr-layout {
    grid-template-columns: 1fr;
  }

  .fr-side {
    position: static;
  }
}

.fr-side {
  position: sticky;
  top: 16px;
  overflow: hidden;
}

.fr-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
}

#fr-agent-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
}

.fr-agent-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.fr-agent-item:hover {
  background: var(--surface-2);
}

.fr-agent-item.active {
  background: var(--primary-soft);
  border-color: #c7d7fe;
}

.fr-agent-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.fr-agent-name {
  font-size: 13px;
  font-weight: 600;
}

.fr-agent-item.active .fr-agent-name {
  color: var(--primary);
}

.fr-agent-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.fr-pill {
  padding: 0 6px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
}

.fr-agent-item.active .fr-pill {
  background: #dbe6ff;
  color: var(--primary);
}

.fr-agent-card {
  margin-bottom: 14px;
}

.fr-agent-card-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  flex-wrap: wrap;
}

.fr-agent-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 16px;
  font-weight: 600;
}

.fr-agent-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.fr-agent-card-meta code,
.fr-agent-url code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.fr-agent-url {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 9px 14px;
  border-top: 1px dashed var(--border);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-muted);
}

.fr-agent-edit {
  border-top: 1px solid var(--border);
}

/* 公共层继承下来的行：只读、灰一点 */
.fr-inherited-row {
  background: #fbfcfd;
}

.fr-inherited-row .fr-value-cell {
  color: var(--text-muted);
}

.fr-inherited-row:hover {
  background: var(--surface-2);
}

.fr-tag-own,
.fr-tag-common {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.fr-tag-own {
  background: var(--primary-soft);
  color: var(--primary);
}

.fr-tag-common {
  border: 1px solid var(--border);
  background: #f1f3f6;
  color: var(--text-muted);
}

.fr-overridden {
  margin-left: 4px;
  color: var(--warning);
  font-size: 11px;
}

.fr-import-box {
  margin-top: 10px;
}

.fr-import-box textarea {
  width: 100%;
}

.fr-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* 模块标签页：一次只管理一个规则分类 */
.fr-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.fr-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.fr-tab:hover {
  background: var(--surface-2);
  color: var(--text);
}

.fr-tab.active {
  background: var(--primary-soft);
  border-color: #c7d7fe;
  color: var(--primary);
  font-weight: 600;
}

.fr-tab-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

.fr-tab.active .fr-tab-count {
  background: #fff;
  color: var(--primary);
}

.fr-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.fr-pager .btn {
  padding: 4px 10px;
  font-size: 13px;
}
