/* ============================================================
   银狐拦截系统 · 基础样式
   配色变量（浅色 / 深色）与通用组件：按钮、标签、卡片、表单、
   表格、提示条、弹窗、分页等。
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f8;
  --border: #e7ebf2;
  --border-2: #d8dfe9;
  --text: #0f172a;
  --text-2: #4b5768;
  --text-3: #8b97a8;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-soft: #eef4ff;
  --brand-ring: rgba(37, 99, 235, .30);
  --ok: #0f9d6b;
  --ok-soft: #e8f8f1;
  --warn: #b7791f;
  --warn-soft: #fdf6e6;
  --danger: #dc2626;
  --danger-soft: #fdeeee;
  /* 「落在软底上的文字色」：比主色深一档，保证小字在浅色软底上达到 AA 对比度（4.5:1） */
  --ok-2: #0a7a52;
  --warn-2: #8a5a0f;
  --danger-2: #b91c1c;
  --violet: #7c3aed;
  --violet-soft: #f4efff;
  --radius-sm: 9px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 10px 30px -14px rgba(15, 23, 42, .22);
  --shadow-pop: 0 18px 50px -18px rgba(15, 23, 42, .32);
  --ring: 0 0 0 3px var(--brand-ring);
  --font: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f16;
  --surface: #121822;
  --surface-2: #171e2a;
  --surface-3: #1d2634;
  --border: #232c3a;
  --border-2: #2e3949;
  --text: #e8edf5;
  --text-2: #a8b3c4;
  --text-3: #6e7a8c;
  --brand: #4d84f5;
  --brand-2: #3b74ea;
  --brand-soft: rgba(77, 132, 245, .14);
  --brand-ring: rgba(77, 132, 245, .34);
  --ok: #34c48d;
  --ok-soft: rgba(52, 196, 141, .13);
  --warn: #e0a13c;
  --warn-soft: rgba(224, 161, 60, .13);
  --danger: #f0625d;
  --danger-soft: rgba(240, 98, 93, .13);
  /* 深色主题：软底是半透明叠加在深色面上，文字色本身已是浅色，直接复用主色 */
  --ok-2: #34c48d;
  --warn-2: #e0a13c;
  --danger-2: #f0625d;
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 12px 34px -16px rgba(0, 0, 0, .6);
  --shadow-pop: 0 20px 55px -18px rgba(0, 0, 0, .7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0f16;
    --surface: #121822;
    --surface-2: #171e2a;
    --surface-3: #1d2634;
    --border: #232c3a;
    --border-2: #2e3949;
    --text: #e8edf5;
    --text-2: #a8b3c4;
    --text-3: #6e7a8c;
    --brand: #4d84f5;
    --brand-2: #3b74ea;
    --brand-soft: rgba(77, 132, 245, .14);
    --brand-ring: rgba(77, 132, 245, .34);
    --ok: #34c48d;
    --ok-soft: rgba(52, 196, 141, .13);
    --warn: #e0a13c;
    --warn-soft: rgba(224, 161, 60, .13);
    --danger: #f0625d;
    --danger-soft: rgba(240, 98, 93, .13);
    --ok-2: #34c48d;
    --warn-2: #e0a13c;
    --danger-2: #f0625d;
    --violet: #a78bfa;
    --violet-soft: rgba(167, 139, 250, .14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 12px 34px -16px rgba(0, 0, 0, .6);
    --shadow-pop: 0 20px 55px -18px rgba(0, 0, 0, .7);
  }
}

/* ---------- 复位 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
h1, h2, h3, h4, p, figure { margin: 0; }
img, svg { display: block; max-width: 100%; }
/* 内联图标：不参与 flex 伸缩。否则尺寸失控的 SVG 会把同排的 CJK 文案挤成竖排 */
svg[aria-hidden="true"] { flex: none; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
body {
  font: 14px/1.65 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--brand-soft); color: var(--brand-2); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* 细滚动条（现代观感，不影响功能性） */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ---------- 排版工具 ---------- */
.h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.h2 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.h3 { font-size: 15px; font-weight: 650; }
.muted { color: var(--text-3); font-size: 12.5px; }
.sub { color: var(--text-2); font-size: 12.5px; }
.mono { font-family: var(--mono); }
.strong { font-weight: 650; color: var(--text); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

code, .code {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface-3); color: var(--text-2);
  padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border);
  word-break: break-all;
}
.kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 6px;
  border: 1px solid var(--border-2); border-bottom-width: 2px;
  border-radius: 6px; background: var(--surface-2); color: var(--text-2);
}

/* ---------- 布局工具 ---------- */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { align-items: flex-end; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1 1 160px; min-width: 0; }
.shrink { flex: 0 0 auto; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 14px; } .mt-3 { margin-top: 22px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 14px; }
.gap-0 { gap: 0; }

/* ---------- 按钮 ---------- */
.btn {
  /* 常态与 hover 各一组令牌：hover 必须同样走 var()，
     否则「.btn:hover 直接写 background」会以更高优先级压过变体的背景色，
     出现变体文字色（如主按钮的 #fff）落到浅色背景上的白底白字 */
  --btn-bg: var(--surface);
  --btn-fg: var(--text-2);
  --btn-bd: var(--border-2);
  --btn-bg-h: var(--surface-2);
  --btn-fg-h: var(--text);
  --btn-bd-h: var(--border-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px; font: inherit; font-size: 13px; font-weight: 600;
  line-height: 1.2; color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bd); border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .14s var(--ease), border-color .14s var(--ease),
              color .14s var(--ease), transform .14s var(--ease), box-shadow .14s var(--ease);
}
.btn:hover {
  background: var(--btn-bg-h); color: var(--btn-fg-h);
  border-color: var(--btn-bd-h); text-decoration: none;
}
.btn:active { transform: translateY(.5px); }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn.pri, .btn-pri {
  --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: var(--brand);
  --btn-bg-h: var(--brand-2); --btn-fg-h: #fff; --btn-bd-h: var(--brand-2);
}
.btn.dgr, .btn-danger {
  --btn-fg: var(--danger-2); --btn-bd: var(--border-2);
  --btn-bg-h: var(--danger-soft); --btn-fg-h: var(--danger-2); --btn-bd-h: var(--danger-2);
}
.btn.ghost {
  --btn-bg: transparent; --btn-bd: transparent;
  --btn-bg-h: var(--surface-3); --btn-bd-h: transparent;
}
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.sm svg { width: 13px; height: 13px; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px; width: 34px; height: 34px; }
.btn.icon.sm { width: 29px; height: 29px; padding: 0; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  color: var(--text-2); animation: spin .7s linear infinite;
}
.btn.pri[aria-busy="true"]::after { color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-group { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--radius-sm); overflow: hidden; }
.btn-group .btn { border: 0; border-radius: 0; }
.btn-group .btn + .btn { border-left: 1px solid var(--border-2); }

/* ---------- 标签（后台状态标记；方角细边，不用药丸） ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 650; line-height: 1.6; white-space: nowrap;
  padding: 1px 7px; border-radius: 5px;
  background: var(--surface-3); color: var(--text-2); border: 1px solid transparent;
}
.tag.manual { background: var(--brand-soft); color: var(--brand-2); }
.tag.sync { background: var(--violet-soft); color: var(--violet); }
.tag.report { background: var(--warn-soft); color: var(--warn-2); }
.tag.import { background: var(--surface-3); color: var(--text-2); }
.tag.pend, .tag.warn { background: var(--warn-soft); color: var(--warn-2); }
.tag.appr, .tag.ok { background: var(--ok-soft); color: var(--ok-2); }
.tag.rej { background: var(--surface-3); color: var(--text-2); }   /* 语义标签用二级色，不用三级装饰灰 */
.tag.err, .tag.danger { background: var(--danger-soft); color: var(--danger-2); }
.tag.info { background: var(--brand-soft); color: var(--brand-2); }
.tag.blacklist { background: #fdeeee; color: #b91c1c; }
.tag.whitelist { background: var(--ok-soft); color: var(--ok); }
:root[data-theme="dark"] .tag.blacklist { background: var(--danger-soft); color: var(--danger); }
.tag.plain { background: transparent; border-color: var(--border); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.err { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* ---------- 卡片（后台专用） ----------
   扁平细线：不投影、不悬浮，靠 1px 描边与内边距分组。 */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.card.flush .card-head { padding: 15px 20px 0; margin-bottom: 12px; }
.card-title { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 16px; height: 16px; color: var(--text-3); }
.card-desc { color: var(--text-3); font-size: 12px; margin-top: 3px; font-weight: 400; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 0 0 5px; }
label .req { color: var(--danger); margin-left: 2px; }
input[type=text], input[type=password], input[type=number], input[type=email],
input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 13.5px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease), background .14s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
select { appearance: none; cursor: pointer;
  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='%238b97a8' stroke-width='2.5' 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 11px center; padding-right: 32px; }
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.5; }
.hint.warn { color: var(--warn-2); }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .btn-affix {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--text-3); cursor: pointer;
  padding: 4px; border-radius: 6px; display: inline-flex;
}
.input-affix .btn-affix:hover { color: var(--text); background: var(--surface-3); }
.input-affix .btn-affix svg { width: 16px; height: 16px; }
.input-affix input { padding-right: 38px; }

/* 复选 / 开关 */
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; margin: 0; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; flex: none; }
.switch { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  flex: none; width: 40px; height: 23px; border-radius: 999px; background: var(--border-2);
  position: relative; transition: background .16s var(--ease); margin-top: 1px;
}
.switch .track::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.28);
  transition: transform .16s var(--ease);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch .sw-text { flex: 1; min-width: 0; }
.switch .sw-text b { font-size: 13.5px; font-weight: 600; display: block; }
.switch .sw-text span { font-size: 12px; color: var(--text-3); display: block; margin-top: 2px; }

/* ---------- 平铺式表单（不套卡片） ----------
   约定：以「提交/录入数据」为主的表单一律平铺——字段用「标签在左、控件在右」
   的分栏行，分组之间用细分隔线；卡片只留给展示型内容（表格/统计/图表/状态）。 */
.form-flat { position: relative; margin-bottom: 4px; }   /* relative：供表单内绝对定位的辅助字段使用 */

/* 表单分组：细线分隔，不用卡片边框 */
.fsec { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.fsec:last-of-type { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.fsec-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; }
.fsec-title svg { width: 16px; height: 16px; color: var(--brand); flex: none; }
.fsec-desc { color: var(--text-3); font-size: 12px; margin: 4px 0 10px; line-height: 1.6; }

/* 表单行：**标签在上、控件在下，整块左对齐**
   早先用「标签占左列（右对齐）+ 控件在右」，会把输入框整体右移，
   与页头 / 分组标题的左对齐线错开，视觉上像是缩进了一级。 */
.frow { display: block; padding: 10px 0; }
.frow > .flabel {
  display: block; margin: 0 0 6px; padding-top: 0; text-align: left;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); line-height: 1.45;
}
.frow > .fctrl { min-width: 0; }
.frow .req { color: var(--danger); margin-left: 2px; }
.fopt { font-weight: 400; color: var(--text-3); font-size: 11.5px; }
.f-narrow { max-width: 190px; }

/* 操作行：与控件同一条左对齐线 */
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0 0; }

/* 平铺搜索行 */
.searchbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.searchbar > input { flex: 1 1 220px; min-width: 0; }
/* 行内控件组（输入 + 按钮同一行） */
/* 行内控件组：输入框与按钮同一行。
   用 stretch 而不是 flex-start —— 输入框有 9px 内边距（高约 42px）、按钮 8px（高约 34px），
   顶部对齐时两者底边差 8~9px，看上去像「按钮浮在输入框上方」的两个层级。
   拉伸后按钮自动与输入框等高（.btn 内部是 flex 居中，文字不会跟着变形）。 */
.finline { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.finline > input { flex: 1 1 240px; min-width: 0; }
.finline > .btn { flex: 0 0 auto; }

@media (max-width: 640px) {
  .frow { padding: 8px 0; }
  .form-actions .btn { flex: 1 1 auto; }
  .f-narrow { max-width: none; }
}

/* 分段控件 */
.segmented { display: inline-flex; gap: 3px; padding: 3px; background: var(--surface-3); border-radius: 10px; }
.segmented a, .segmented button {
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2);
  padding: 6px 13px; border-radius: 7px; border: 0; background: transparent;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.segmented a:hover, .segmented button:hover { color: var(--text); text-decoration: none; }
.segmented a.on, .segmented button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.segmented a svg, .segmented button svg { width: 15px; height: 15px; flex: none; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .03em;
  text-transform: uppercase; color: var(--text-3);
  padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; word-break: break-word; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tbody tr.warn { background: var(--warn-soft); }
tbody tr.warn:hover { background: var(--warn-soft); }
td .row { gap: 6px; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 11.5px; color: var(--text-3); }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.empty { padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty svg { width: 34px; height: 34px; margin: 0 auto 10px; color: var(--border-2); }
.empty b { display: block; color: var(--text-2); font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 9px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border-2); border-radius: 8px; color: var(--text-2); background: var(--surface);
}
.pager a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.pager .on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .gap { border: 0; background: transparent; color: var(--text-3); min-width: 18px; }

/* ---------- 提示条（后台；左侧色条 + 线性图标，不铺色块） ---------- */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 3px 0 3px 14px; border-left: 2px solid var(--border-2);
  font-size: 13px; color: var(--text-2); line-height: 1.7;
}
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 2px; color: var(--text-3); }
.notice.ok { border-left-color: var(--ok); }
.notice.ok svg { color: var(--ok); }
.notice.err { border-left-color: var(--danger); color: var(--danger-2); }
.notice.err svg { color: var(--danger); }
.notice.warn { border-left-color: var(--warn); }
.notice.warn svg { color: var(--warn); }
.notice.info { border-left-color: var(--brand); }
.notice.info svg { color: var(--brand); }
.notice b { font-weight: 650; color: var(--text); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-pop); font-size: 13px; color: var(--text-2);
  animation: toast-in .28s var(--ease) both;
}
.toast .t-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok .t-icon { color: var(--ok); }
.toast.err .t-icon { color: var(--danger); }
.toast .t-body { flex: 1; min-width: 0; word-break: break-word; }
.toast .t-close { background: transparent; border: 0; color: var(--text-3); cursor: pointer; padding: 2px; border-radius: 6px; }
.toast .t-close:hover { color: var(--text); background: var(--surface-3); }
.toast .t-close svg { width: 14px; height: 14px; }
.toast.hide { animation: toast-out .2s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) scale(.98); } }

/* ---------- 模态 ---------- */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(9, 13, 20, .5);
  backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-back.open { display: flex; animation: fade .16s var(--ease) both; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); width: 100%; max-width: 420px; padding: 22px 22px 18px; animation: pop .2s var(--ease) both; }
.modal h3 { font-size: 15.5px; font-weight: 650; margin-bottom: 8px; display: flex; align-items: center; gap: 9px; }
.modal h3 svg { width: 18px; height: 18px; color: var(--warn); }
.modal p { color: var(--text-2); font-size: 13px; margin-bottom: 18px; }
.modal .modal-foot { display: flex; justify-content: flex-end; gap: 9px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ---------- 品牌标记 / 主题切换 ---------- */
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  display: grid; place-items: center; color: #fff; background: var(--brand);
  box-shadow: 0 6px 16px -6px var(--brand-ring);
}
.brand-mark svg { width: 19px; height: 19px; }
.theme-toggle .ti { display: none; }
.theme-toggle[data-mode="auto"] .ti-auto { display: block; }
.theme-toggle[data-mode="light"] .ti-light { display: block; }
.theme-toggle[data-mode="dark"] .ti-dark { display: block; }

/* ---------- 网格工具 ---------- */
/* margin-bottom 必须与 gap 同值：网格内卡片已归零 margin-bottom，
   容器若不留边距，紧随其后的卡片会与网格贴死（gap=0） */
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }
@media (max-width: 880px) { .grid.g2, .grid.g3 { grid-template-columns: 1fr; } }

/* ---------- 认证页（登录 / 安装向导共用） ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1100px 520px at 10% -10%, var(--brand-soft), transparent 62%),
    radial-gradient(900px 480px at 110% 2%, var(--violet-soft), transparent 58%),
    var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 30px 30px 26px; }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
/* 品牌只用「单色图标 + 字标」，不用填充色块 */
.auth-brand .brand-mark {
  width: auto; height: auto; flex: none; display: block;
  color: var(--brand); background: none; box-shadow: none; border-radius: 0;
}
.auth-brand .brand-mark svg { width: 26px; height: 26px; }
.auth-brand b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.auth-brand span { display: block; font-size: 12px; color: var(--text-3); }
.auth-title { font-size: 18px; font-weight: 700; margin-bottom: 5px; letter-spacing: -.01em; }
.auth-sub { color: var(--text-3); font-size: 12.5px; margin-bottom: 20px; line-height: 1.6; }
.auth-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-3); }

/* ---------- 响应式工具 ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 720px) {
  .hide-sm { display: none !important; }
  .row { gap: 8px; }
  /* 表格：给最小宽度，让 .table-wrap 横向滚动。
     否则 table 的 width:100% 会把列压到容器宽度内，中文被逐字折断 */
  .table-wrap > table { min-width: 680px; }
  /* 空状态行不受最小宽度影响：否则 .empty 会被推到表格右侧而被裁切 */
  .table-wrap:has(.empty) > table { min-width: 0; }
  /* 分段控件在窄屏可横向滚动，避免按钮换行/溢出 */
  .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented a, .segmented button { white-space: nowrap; flex: none; }
  /* 触控：加大点击目标 */
  .btn { padding: 9px 16px; }
  .btn.sm { padding: 6px 12px; }
}
@media (max-width: 640px) {
  /* iOS 在字号 < 16px 的输入框上会自动放大页面，统一提到 16px 规避 */
  input[type=text], input[type=password], input[type=number], input[type=email],
  input[type=url], input[type=search], select, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
