/* ═══════════════════════════════════════════════════════════════
   DeepX 安全测试云 · 设计系统
   极简、留白、单一强调色。所有页面共用同一套令牌。
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* 品牌色 */
  --brand: #4d6bfe;
  --brand-hover: #3f59e4;
  --brand-active: #364fc7;
  --brand-soft: #eef2ff;
  --brand-soft-2: #f5f7ff;
  --brand-ring: rgba(77, 107, 254, .16);

  /* 中性色 */
  --bg: #ffffff;
  --bg-sub: #fafafb;
  --bg-soft: #f5f6f8;
  --bg-hover: #f2f3f6;
  --border: #ecedf0;
  --border-2: #e3e5ea;
  --border-3: #d8dbe2;
  --text: #16181d;
  --text-2: #545861;
  --text-3: #8a8f99;
  --text-4: #a8adb7;
  --text-invert: #ffffff;

  /* 语义色 */
  --ok: #0f9d70;
  --ok-bg: #e9f8f1;
  --ok-border: #cdeede;
  --warn: #b26a00;
  --warn-bg: #fff7e8;
  --warn-border: #f7e3bf;
  --danger: #d93b3b;
  --danger-bg: #fdeeee;
  --danger-border: #f6d5d5;
  --info: #3e63dd;
  --info-bg: #eff3ff;
  --info-border: #dbe3fb;

  /* 风险色 */
  --risk-critical: #cf2f2f;
  --risk-high: #e2622c;
  --risk-medium: #d99400;
  --risk-low: #4d6bfe;

  /* 圆角 */
  --r-xl: 20px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 10px;
  --r-xs: 8px;
  --r-pill: 999px;

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(16, 18, 24, .04);
  --shadow-sm: 0 1px 3px rgba(16, 18, 24, .06), 0 1px 2px rgba(16, 18, 24, .04);
  --shadow-md: 0 6px 20px -8px rgba(16, 18, 24, .14), 0 2px 4px rgba(16, 18, 24, .04);
  --shadow-lg: 0 28px 64px -24px rgba(16, 18, 24, .26), 0 8px 20px -14px rgba(16, 18, 24, .16);

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* 布局 */
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --content-max: 1240px;
}

* { box-sizing: border-box; }

/* 保证 hidden 属性优先于组件自身的 display，避免空占位元素（如空提示框）显示出来 */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--brand-ring); color: var(--text); }

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

button { font-family: inherit; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.012em; color: var(--text); }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 14.5px; }
h4 { font-size: 14px; }

p { margin: 0; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: #d5d8df transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #dcdfe6; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #c6cad3; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ══ 应用骨架 ═════════════════════════════════════════════════ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
}

/* ══ 侧边栏 ══════════════════════════════════════════════════ */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px 12px;
  background: var(--bg-sub);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 40;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #e2e4ea; border: none; }

/* 品牌 */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 18px;
  min-height: 44px;
}
.logo {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  display: grid; place-items: center;
}
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo.lg { width: 42px; height: 42px; flex-basis: 42px; }

/* 侧栏品牌：图标与两行文字等高，保持同一视觉重心 */
.brand .logo { width: 36px; height: 36px; flex-basis: 36px; }

.brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brand-name {
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  font-size: 14.5px; font-weight: 650; line-height: 20px;
  color: var(--text); letter-spacing: 0;
  white-space: nowrap;
}
.brand-sub {
  font-size: 11px; color: var(--text-3);
  letter-spacing: .04em; line-height: 16px;
}

/* 新建AI安全测试 */
.new-scan {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px; margin: 0 0 16px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--text);
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .16s, border-color .16s, transform .1s;
  text-decoration: none;
}
.new-scan:hover {
  border-color: var(--border-3);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text);
}
.new-scan:active { transform: scale(.987); }
.new-scan .ico { color: var(--brand); }
.new-scan kbd {
  margin-left: auto;
  font-family: var(--font);
  font-size: 10.5px; color: var(--text-4);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 5px;
  line-height: 16px;
  background: var(--bg-sub);
}

/* 导航 */
.nav-group-label {
  padding: 14px 10px 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-4);
  letter-spacing: .02em;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px;
  border: none; background: none;
  border-radius: var(--r-xs);
  color: var(--text-2);
  font-size: 13.5px; font-weight: 450;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background .14s, color .14s;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 550;
}
.nav-item .ico { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
.nav-item.active .ico { opacity: 1; }
.nav-item span:not(.nav-badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-badge {
  margin-left: auto;
  min-width: 20px; height: 18px; padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.nav-item.active .nav-badge { background: #fff; }

/* 侧栏底部 */
.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-4);
}

.plan-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  margin-bottom: 8px;
}
.plan-card .pc-top {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text-2); margin-bottom: 8px;
}
.plan-card .pc-top b { color: var(--text); font-weight: 600; }
.plan-card .pc-top a { font-size: 12px; }
.plan-card .bar { height: 5px; }
.plan-card .pc-foot {
  margin-top: 8px; font-size: 11.5px; color: var(--text-4);
  display: flex; justify-content: space-between;
}

.user-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .14s;
  position: relative;
}
.user-row:hover { background: var(--bg-hover); }
.user-row .u-name {
  font-size: 13px; font-weight: 550; color: var(--text);
  line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-row .u-role { font-size: 11px; color: var(--text-4); line-height: 1.4; }
.user-row .ico { color: var(--text-4); margin-left: auto; flex: 0 0 auto; }

.avatar {
  width: 28px; height: 28px; flex: 0 0 28px;
  border-radius: 8px;
  background: linear-gradient(145deg, #eef2ff, #e2e8ff);
  color: var(--brand);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 650;
  border: 1px solid #e0e6ff;
  user-select: none;
}
.avatar.lg { width: 32px; height: 32px; flex-basis: 32px; border-radius: 9px; font-size: 13px; }

.mode-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  border-radius: var(--r-pill);
  background: #fff;
  border: 1px solid var(--border);
  font-size: 11px; color: var(--text-3);
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); display: inline-block; flex: 0 0 6px;
}
.dot.warn { background: #e8a33d; }
.dot.bad { background: var(--danger); }

.env-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  font-size: 11.5px; color: var(--text-3);
  letter-spacing: .01em;
}

/* ══ 主区 ════════════════════════════════════════════════════ */
.main { min-width: 0; display: flex; flex-direction: column; background: var(--bg); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-size: 16px; font-weight: 600; letter-spacing: -.015em;
  line-height: 1.3;
}
.page-sub { font-size: 12.5px; color: var(--text-3); line-height: 1.4; margin-top: 1px; }
.topbar-spacer { flex: 1; }

.quota-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: #fff;
  font-size: 12px; color: var(--text-2);
  white-space: nowrap;
}
.quota-pill b { color: var(--text); font-weight: 600; }
.quota-pill .sep { color: var(--border-3); }
.quota-pill:hover { border-color: var(--border-2); }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: none; border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  position: relative;
  transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn .nav-badge {
  position: absolute; top: 2px; right: 1px;
  min-width: 8px; height: 8px; padding: 0;
  background: var(--danger);
  border: 1.5px solid #fff;
}

.user-menu {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 8px 3px 3px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background .14s;
}
.user-menu:hover { background: var(--bg-hover); }

.content {
  padding: 26px 28px 88px;
  width: 100%;
  max-width: var(--content-max);
}

/* ══ 卡片 ════════════════════════════════════════════════════ */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid #f4f4f6;
}
.card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; line-height: 1.45; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.card-body.tight .empty { border-radius: 0 0 var(--r-lg) var(--r-lg); }

.section-gap { margin-bottom: 18px; }

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); }

/* KPI */
.kpi { padding: 18px 20px; }
.kpi .label {
  font-size: 12.5px; color: var(--text-3); font-weight: 450;
  display: flex; align-items: center; gap: 6px;
}
.kpi .value {
  font-size: 27px; font-weight: 650; letter-spacing: -.028em;
  margin-top: 8px; line-height: 1.15; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kpi .value small {
  font-size: 13px; font-weight: 450; color: var(--text-4);
  margin-left: 5px; letter-spacing: 0;
}
.kpi .foot { font-size: 12px; color: var(--text-3); margin-top: 7px; line-height: 1.5; }

/* 快捷操作卡 */
.quick { display: flex; flex-direction: column; gap: 0; padding: 18px; }
.quick .qi {
  width: 32px; height: 32px; flex: 0 0 32px;
  margin-bottom: 11px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  color: var(--brand);
}
.quick .q-title { font-size: 13.5px; font-weight: 550; color: var(--text); line-height: 1.4; }
.quick .q-desc { font-size: 12.3px; color: var(--text-3); line-height: 1.65; margin-top: 3px; flex: 1; }
.quick .btn { margin-top: 13px; align-self: flex-start; }

/* ══ 按钮 ════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, box-shadow .14s, color .14s, transform .08s;
  text-decoration: none;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; color: var(--text); }
.btn:active { transform: scale(.985); }

.btn.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(77, 107, 254, .28), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn.primary:hover { background: var(--brand-hover); color: #fff; }

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand);
}
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand); }

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

.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: var(--r-xs); gap: 5px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 14px; border-radius: var(--r-md); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: var(--bg-soft); }
.btn.primary:disabled:hover { background: var(--brand); }

/* ══ 表单 ════════════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--text-4); line-height: 1.5; }

.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: background .14s, border-color .14s, box-shadow .14s;
  appearance: none;
}
.input:hover, .select:hover, .textarea:hover { background: #f1f2f5; }
.input:focus, .select:focus, .textarea:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:disabled, .select:disabled, .textarea:disabled {
  color: var(--text-3); background: #f7f8f9; cursor: not-allowed;
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.65; }
.select {
  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='%238a8f99' stroke-width='2.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 12px center;
  padding-right: 34px;
  cursor: pointer;
}
select[multiple] { height: auto; padding: 8px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.checkbox {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 12.8px; color: var(--text-2); line-height: 1.65;
}
.checkbox input[type="checkbox"] {
  appearance: none;
  width: 16px; height: 16px; flex: 0 0 16px;
  margin: 2px 0 0;
  border: 1.5px solid var(--border-3);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  position: relative;
}
.checkbox input[type="checkbox"]:checked {
  background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l5 5L19 7'/%3E%3C/svg%3E") center/11px no-repeat;
  border-color: var(--brand);
}
.checkbox input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px var(--brand-ring); }
.checkbox label { cursor: pointer; }

/* 开关 */
.switch {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid #f4f4f6;
}
.switch:last-child { border-bottom: none; }
.switch input[type="checkbox"] {
  appearance: none;
  width: 38px; height: 22px; flex: 0 0 38px;
  border-radius: var(--r-pill);
  background: #e2e4ea;
  position: relative;
  cursor: pointer;
  transition: background .18s;
  margin: 0;
}
.switch input[type="checkbox"]::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 18, 24, .2);
  transition: transform .18s;
}
.switch input[type="checkbox"]:checked { background: var(--brand); }
.switch input[type="checkbox"]:checked::after { transform: translateX(16px); }

/* ══ 表格 ════════════════════════════════════════════════════ */
.table-wrap { width: 100%; overflow-x: auto; border-radius: inherit; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-3);
  padding: 11px 16px;
  background: var(--bg-sub);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data th:first-child { padding-left: 20px; }
table.data th:last-child { padding-right: 20px; }
table.data th.text-right { text-align: right; }
table.data td {
  padding: 13px 16px;
  border-bottom: 1px solid #f4f4f6;
  vertical-align: middle;
  color: var(--text-2);
}
table.data td:first-child { padding-left: 20px; }
table.data td:last-child { padding-right: 20px; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: #fbfbfc; }
table.data tr.clickable { cursor: pointer; }
table.data td .btn + .btn { margin-left: 4px; }
table.data .btn:not(.primary) {
  background: transparent;
  border-color: transparent;
  color: var(--text-3);
  box-shadow: none;
  font-weight: 450;
}
table.data .btn:not(.primary):hover { background: var(--bg-hover); color: var(--text); }
table.data .btn.danger:not(.primary) { color: var(--danger); }
table.data .btn.danger:not(.primary):hover { background: var(--danger-bg); color: var(--danger); }
table.data .btn.ghost:not(.primary) { color: var(--brand); }
table.data .btn.ghost:not(.primary):hover { background: var(--brand-soft); color: var(--brand); }

.mono { font-family: var(--mono); font-size: 11.8px; color: var(--text-3); letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.strong { font-weight: 550; color: var(--text); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.cell-sub { font-size: 11.5px; color: var(--text-4); margin-top: 2px; line-height: 1.5; }

/* ══ 徽标 ════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px;
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 11.5px; font-weight: 500;
  white-space: nowrap;
  line-height: 1;
}
.badge::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .65;
  flex: 0 0 5px;
}
.badge.plain::before, .badge:not(.ok):not(.warn):not(.danger):not(.info)::before { display: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.plain { background: var(--bg-soft); color: var(--text-3); }

/* 风险标记 */
.risk {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 550; white-space: nowrap;
}
.risk::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }
.risk.critical { color: var(--risk-critical); }
.risk.high { color: var(--risk-high); }
.risk.medium { color: var(--risk-medium); }
.risk.low { color: var(--risk-low); }
.risk.none { color: var(--ok); }

/* ══ 进度 ════════════════════════════════════════════════════ */
.bar { height: 6px; border-radius: var(--r-pill); background: #eef0f3; overflow: hidden; }
.bar > i {
  display: block; height: 100%; border-radius: var(--r-pill);
  background: var(--brand); transition: width .5s cubic-bezier(.4, 0, .2, 1);
}
.bar.warn > i { background: #e8a33d; }
.bar.danger > i { background: var(--danger); }

.usage-row { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; }
.usage-row:last-child { margin-bottom: 0; }
.usage-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.usage-top b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ══ 空状态 / 骨架 ═══════════════════════════════════════════ */
.empty {
  padding: 44px 24px;
  text-align: center;
  color: var(--text-4);
  font-size: 12.5px;
}
.empty .big { font-size: 14px; color: var(--text-2); font-weight: 550; margin-bottom: 5px; }
.empty svg { opacity: .35; margin-bottom: 12px; }

.skeleton {
  height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, #f2f3f6 25%, #f9fafb 37%, #f2f3f6 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease infinite;
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ══ 标签页（分段控件） ══════════════════════════════════════ */
.tabs {
  display: inline-flex; gap: 2px;
  padding: 3px;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  margin-bottom: 18px;
  max-width: 100%;
  overflow-x: auto;
}
.tab {
  height: 30px; padding: 0 13px;
  border: none; border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px; font-weight: 450;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s, color .14s, box-shadow .14s;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: #fff;
  color: var(--text);
  font-weight: 550;
  box-shadow: 0 1px 2px rgba(16, 18, 24, .08), 0 0 0 1px rgba(16, 18, 24, .02);
}

/* ══ 弹层 ════════════════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(16, 18, 24, .38);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 9vh 16px 24px;
  z-index: 100;
  animation: fade .16s ease-out;
}
.overlay.center { align-items: center; padding: 20px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%; max-width: 540px;
  max-height: 84vh;
  display: flex; flex-direction: column;
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.16, 1, .3, 1);
  overflow: hidden;
}
.modal.wide { max-width: 800px; }
@keyframes pop {
  from { transform: translateY(10px) scale(.985); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 20px 22px 14px;
}
.modal-head h3 { font-size: 16.5px; font-weight: 600; }
.modal-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 4px; line-height: 1.55; }
.modal-body { padding: 2px 22px 6px; overflow-y: auto; }
.modal-body .alert:first-child { margin-top: 4px; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 22px 20px;
  border-top: 1px solid #f4f4f6;
  margin-top: 12px;
}
.x-btn {
  margin-left: auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: none; border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-3);
  font-size: 19px; line-height: 1;
  cursor: pointer;
  flex: 0 0 30px;
  transition: background .14s, color .14s;
}
.x-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ══ 提示 ════════════════════════════════════════════════════ */
.toasts {
  position: fixed; top: 18px; right: 20px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  max-width: 400px;
  padding: 11px 15px;
  border-radius: var(--r-md);
  background: #191b21;
  color: #f2f3f5;
  font-size: 13px;
  line-height: 1.55;
  box-shadow: 0 12px 32px -10px rgba(16, 18, 24, .38);
  animation: slidein .22s cubic-bezier(.16, 1, .3, 1);
}
.toast::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  margin-top: 7px; flex: 0 0 6px;
  background: #7d8494;
}
.toast.ok::before { background: #35d39a; }
.toast.err::before { background: #ff6b6b; }
.toast.info::before { background: #7d9bff; }
@keyframes slidein {
  from { transform: translateY(-6px) scale(.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* 行内提示 */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 15px;
  border-radius: var(--r-md);
  font-size: 12.8px;
  line-height: 1.65;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert.info { background: var(--info-bg); border-color: var(--info-border); color: #2b47b8; }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-border); color: #8a5200; }
.alert.danger { background: var(--danger-bg); border-color: var(--danger-border); color: #a52a2a; }
.alert.ok { background: var(--ok-bg); border-color: var(--ok-border); color: #0a7a57; }
.alert b { font-weight: 600; }
.alert .btn { flex: 0 0 auto; }

/* ══ 登录 / 申请 ════════════════════════════════════════════ */
.auth-page {
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 24px 18px;
  background: #fff;
  overflow: hidden;
}
.auth-bg {
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(680px 420px at 50% -8%, #eef2ff 0%, rgba(238, 242, 255, 0) 68%),
    radial-gradient(520px 340px at 92% 108%, #f4f6ff 0%, rgba(244, 246, 255, 0) 70%);
}
.auth-top {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
}
.auth-top .name { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.auth-top .name em { font-style: normal; font-weight: 450; color: var(--text-3); }
.auth-top .spacer { flex: 1; }
.auth-top .auth-top-link { font-size: 12.5px; color: var(--text-3); }
.auth-top .auth-top-link:hover { color: var(--text); }

.auth-center {
  position: relative; z-index: 1;
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 28px 0;
}

.auth-card {
  width: 100%;
  max-width: 404px;
  padding: 34px 34px 30px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: 0 24px 60px -34px rgba(16, 18, 24, .22), 0 1px 2px rgba(16, 18, 24, .03);
}
.auth-card.wide { max-width: 580px; }
.auth-card h1, .auth-card h2 {
  font-size: 24px; font-weight: 650; letter-spacing: -.025em;
  line-height: 1.3;
}
.auth-card .sub {
  font-size: 13px; color: var(--text-3);
  margin-top: 7px; margin-bottom: 24px; line-height: 1.6;
}
.auth-card form { margin: 0; }
.auth-card .field > label { font-size: 12.5px; }
.auth-card .input, .auth-card .select, .auth-card .textarea { height: 42px; border-radius: var(--r-sm); }
.auth-card .textarea { height: auto; padding: 11px 12px; }
.auth-card .btn.lg { height: 44px; margin-top: 4px; }

.auth-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.7;
}
.auth-foot a { color: var(--brand); font-weight: 500; }

.auth-legal {
  position: relative; z-index: 1;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-4);
  line-height: 1.6;
}

/* ══ 定价 ════════════════════════════════════════════════════ */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.plan {
  position: relative;
  display: flex; flex-direction: column;
  padding: 22px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: #fff;
  transition: border-color .16s, box-shadow .16s;
}
.plan:hover { border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.plan.featured {
  border-color: #c7d2fe;
  box-shadow: 0 0 0 1px rgba(77, 107, 254, .08), 0 8px 24px -18px rgba(77, 107, 254, .5);
}
.plan.current { border-color: var(--brand); }
.plan .tag {
  position: absolute; top: -9px; left: 18px;
  height: 19px; padding: 0 9px;
  display: inline-flex; align-items: center;
  background: var(--brand); color: #fff;
  font-size: 10.5px; font-weight: 550; letter-spacing: .02em;
  border-radius: var(--r-pill);
}
.plan h4 { font-size: 14.5px; display: flex; align-items: center; gap: 7px; }
.plan .price {
  font-size: 28px; font-weight: 650; letter-spacing: -.03em;
  margin: 12px 0 2px; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.plan .price span { font-size: 12.5px; font-weight: 450; color: var(--text-3); letter-spacing: 0; }
.plan .price-note { font-size: 12px; color: var(--text-4); min-height: 18px; }
.plan ul {
  list-style: none; padding: 0; margin: 16px 0 18px;
  display: flex; flex-direction: column; gap: 9px;
  flex: 1;
}
.plan li { font-size: 12.8px; color: var(--text-2); display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }
.plan li::before {
  content: "";
  width: 14px; height: 14px; flex: 0 0 14px; margin-top: 2px;
  background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%234d6bfe' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l5 5L19 7'/%3E%3C/svg%3E") center/10px no-repeat;
  border-radius: 50%;
}

/* ══ 终端日志 ════════════════════════════════════════════════ */
.terminal {
  height: auto;
  min-height: 150px;
  max-height: 280px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: #0f1116;
  color: #c9d1e0;
  font-family: var(--mono);
  font-size: 11.8px;
  line-height: 1.9;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid #1c1f27;
}
.terminal .ln { display: block; }
.terminal .ln::before { content: "› "; color: #4b5568; }
.terminal .ln.ok { color: #5ee3a8; }
.terminal .ln.err { color: #ff8f8f; }

/* ══ 页面工具条 & 详情头 ═════════════════════════════════════ */
.detail-head {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.detail-head > div:first-child { min-width: 0; }
.detail-head h2 {
  display: flex; align-items: center; gap: 9px;
  font-size: 20px; font-weight: 600; letter-spacing: -.02em;
  line-height: 1.35;
}
.detail-head .input { width: 230px; height: 36px; }
.detail-head .btn { flex: 0 0 auto; }

.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin-bottom: 12px;
  font-size: 12.5px; color: var(--text-3);
  transition: color .14s;
}
.back-link:hover { color: var(--text); }

/* 进度步骤 */
.progress-steps { display: flex; gap: 8px; margin: 4px 0 6px; }
.step {
  flex: 1;
  position: relative;
  padding-top: 17px;
  font-size: 11.5px;
  color: var(--text-4);
}
.step::before {
  content: "";
  position: absolute; top: 2px; left: 0; right: 0;
  height: 3px;
  background: #eef0f3;
  border-radius: var(--r-pill);
}
.step:first-child::before { border-radius: var(--r-pill) 0 0 var(--r-pill); }
.step:last-child::before { border-radius: 0 var(--r-pill) var(--r-pill) 0; }
.step.done::before { background: #a9baff; }
.step.active::before { background: var(--brand); }
.step.done, .step.active { color: var(--text-2); font-weight: 500; }
.step.active { color: var(--brand); }

/* 时间线 */
.timeline { display: flex; flex-direction: column; }
.tl-item {
  display: flex; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed #f0f1f4;
  font-size: 12.8px;
}
.tl-item:last-child { border-bottom: none; }
.tl-dot { width: 7px; height: 7px; border-radius: 50%; background: #d3d6dd; margin-top: 7px; flex: 0 0 7px; }
.tl-dot.blue { background: var(--brand); }
.tl-time { color: var(--text-4); font-size: 11.5px; white-space: nowrap; font-family: var(--mono); }
.tl-body { flex: 1; min-width: 0; }

/* ══ 通知面板 / 下拉 ═════════════════════════════════════════ */
.panel {
  position: absolute; top: 46px; right: 0;
  width: 360px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
  animation: pop .16s cubic-bezier(.16, 1, .3, 1);
}
.panel.up { top: auto; bottom: calc(100% + 8px); right: 0; }
.panel.fixed { position: fixed; top: auto; right: auto; }
.panel.fixed { position: fixed; top: auto; right: auto; }
.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 16px;
  border-bottom: 1px solid #f4f4f6;
  font-size: 13px; font-weight: 600;
}
.panel-list { max-height: 400px; overflow-y: auto; }
.panel-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f7f7f9;
  font-size: 12.8px;
  transition: background .12s;
}
.panel-item:last-child { border-bottom: none; }
.panel-item:hover { background: var(--bg-sub); }
.panel-item .t { font-weight: 550; color: var(--text); margin-bottom: 3px; }
.panel-item .b { color: var(--text-2); line-height: 1.6; }
.panel-item .d { color: var(--text-4); font-size: 11px; margin-top: 5px; }
.panel-item.unread { background: var(--brand-soft-2); }
.panel-item.unread .t::after {
  content: ""; display: inline-block;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand); margin-left: 6px; vertical-align: 2px;
}

/* ══ 响应式 ══════════════════════════════════════════════════ */
@media (max-width: 1240px) {
  :root { --content-max: 100%; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-side { grid-template-columns: minmax(0, 1fr); }
  .plans { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; height: auto;
    flex-direction: row; align-items: center;
    gap: 4px;
    padding: 8px 10px;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0 6px 0 0; min-height: 0; }
  .brand-text, .nav-group-label, .sidebar-foot, .new-scan { display: none; }
  .nav-item { width: auto; white-space: nowrap; padding: 0 10px; }
  .nav-item span:not(.nav-badge) { display: none; }
  .topbar { padding: 0 16px; height: 58px; }
  .page-sub { display: none; }
  .quota-pill { display: none; }
  .content { padding: 18px 16px 64px; }
  .grid.cols-3, .grid.cols-2, .form-row { grid-template-columns: 1fr; }
  .detail-head { gap: 10px; }
  .detail-head .input { width: 100%; }
  .auth-card { padding: 28px 22px 24px; }
  .toasts { left: 16px; right: 16px; }
  .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ══ 套餐徽章（专业版 / 企业版专属样式）══════════════════ */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 19px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
  vertical-align: middle;
}
.plan-badge b {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .2);
}
.plan-badge.free {
  background: var(--bg-soft);
  color: var(--text-3);
  border: 1px solid var(--border-2);
}
.plan-badge.pro {
  background: linear-gradient(135deg, #4d6bfe 0%, #7a5cff 100%);
  color: #fff;
  box-shadow: 0 2px 8px -3px rgba(77, 107, 254, .55);
}
.plan-badge.ent {
  background: linear-gradient(135deg, #23262f 0%, #3d4252 100%);
  color: #f3d38a;
  border: 1px solid #5a5138;
  box-shadow: 0 2px 8px -3px rgba(35, 38, 47, .45);
}

/* ══ 主题色（设置页可切换，作用于全部控制台）════════════ */
html[data-theme="emerald"] {
  --brand: #0f9d70;
  --brand-hover: #0c8a62;
  --brand-active: #0a7354;
  --brand-soft: #e9f8f1;
  --brand-soft-2: #f4fbf8;
  --brand-ring: rgba(15, 157, 112, .16);
}
html[data-theme="violet"] {
  --brand: #7c5cff;
  --brand-hover: #6b4bee;
  --brand-active: #5b3cd4;
  --brand-soft: #f1edff;
  --brand-soft-2: #f8f6ff;
  --brand-ring: rgba(124, 92, 255, .16);
}
html[data-theme="amber"] {
  --brand: #e08616;
  --brand-hover: #c97612;
  --brand-active: #b0650f;
  --brand-soft: #fdf3e5;
  --brand-soft-2: #fffaf2;
  --brand-ring: rgba(224, 134, 22, .16);
}
html[data-theme="rose"] {
  --brand: #e2557b;
  --brand-hover: #cc476c;
  --brand-active: #b33d5e;
  --brand-soft: #fdeef2;
  --brand-soft-2: #fff7f9;
  --brand-ring: rgba(226, 85, 123, .16);
}

/* 主题选择器 */
.theme-row { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.theme-swatch:hover { border-color: var(--brand); }
.theme-swatch.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
  font-weight: 600;
}
.theme-swatch .sw {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
