/* 关键词指数管理平台 · 主题：浅天蓝 + 白卡 + 炭黑 + 钢蓝点缀 */
:root {
  --bg: #eef4fb;
  --bg-2: #e6effa;
  --card: #ffffff;
  --ink: #23262b;
  --ink-2: #343a44;
  --muted: #7b8794;
  --muted-2: #9aa6b4;
  --line: #e2eaf3;
  --line-2: #eef3f9;
  --charcoal: #28292c;
  --charcoal-2: #33363b;
  --brand: #4f79b8;
  --brand-2: #7fa7d9;
  --sky: #d3f0ff;
  --sky-2: #eff6ff;
  --mint: #e5f0e8;
  --accent-ink: #2f5f96;
  --danger: #d24a52;
  --ok: #2e8b6b;
  --radius: 18px;
  --shadow: 0 8px 28px rgba(45, 75, 115, .07);
  --shadow-sm: 0 2px 10px rgba(45, 75, 115, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
/* 预留滚动条位置，删除内容后滚动条消失也不会引起页面左右抖动 */
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(720px 420px at 6% -6%, rgba(211, 240, 255, .85), transparent 62%),
    radial-gradient(680px 420px at 98% 2%, rgba(214, 232, 250, .8), transparent 58%),
    radial-gradient(560px 380px at 70% 104%, rgba(229, 240, 232, .55), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13.5px; color: var(--ink); }
code { background: var(--sky-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.up { color: var(--ok); font-size: 12px; }
.down { color: var(--danger); font-size: 12px; }
.hint { color: var(--muted-2); font-size: 11.5px; line-height: 1.6; }

/* ---------------- 控件 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  transition: .16s ease;
  white-space: nowrap;
}
.btn:hover { border-color: #cfdcea; transform: translateY(-1px); }
.btn.primary {
  border: 0; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 18px rgba(79, 121, 184, .26);
}
.btn.primary:hover { box-shadow: 0 12px 24px rgba(79, 121, 184, .32); }
.btn.ghost { background: var(--sky-2); border-color: #dfeaf6; color: var(--accent-ink); }
.btn.danger { color: var(--danger); background: #fdf2f3; border-color: #f7dde0; }
.btn.tiny { padding: 6px 11px; border-radius: 8px; font-size: 12px; }
.btn.block { width: 100%; padding: 11px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.link {
  border: 0; background: none; color: var(--brand);
  font-size: 12.5px; padding: 3px 6px; border-radius: 6px;
}
.link:hover { background: var(--sky-2); }
.link.danger { color: var(--danger); }
.link.danger:hover { background: #fdf2f3; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
  transition: .15s;
  min-width: 0;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: #a9c6e6;
  box-shadow: 0 0 0 4px rgba(133, 175, 219, .16);
}
input[disabled] { background: #f7fafd; color: var(--muted); }

/* 复选框统一美化 */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 17px;
  height: 17px;
  border: 1.5px solid #c7d3e2;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex: none;
  margin: 0;
  transition: .15s ease;
  vertical-align: middle;
}
input[type="checkbox"]:hover { border-color: #9db8d8; }
input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: var(--brand);
}
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 8px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}
input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(79, 121, 184, .16);
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #98a6b6 50%), linear-gradient(135deg, #98a6b6 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }

.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.inline-form select { width: auto; min-width: 120px; }
.search-form input[type="text"] { width: 170px; padding: 7px 11px; }

.chip {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  background: #f2f6fb; color: #55606f; font-size: 11.5px; font-weight: 500;
  white-space: nowrap;
}
.chip.blue { background: #e6f3fd; color: #2f6a9e; }
.chip.lime { background: var(--mint); color: #2e6b52; }
.chip.gray { background: #f4f6f8; color: #8792a0; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  font-size: 12px; color: var(--muted); box-shadow: var(--shadow-sm);
}
.pill.unit { color: var(--ink-2); font-weight: 500; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.ok { color: #2e6b52; background: #f2f9f5; border-color: #dcefe5; }
.pill.warn { color: #96671a; background: #fffaf0; border-color: #f5e5c6; }
.pill.danger { color: var(--danger); background: #fdf3f4; border-color: #f7dde0; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  position: relative; z-index: 1;
  min-height: 100vh; padding: 32px;
  display: flex; align-items: center; justify-content: center;
}
/* 左右两块合并成一张卡片：整体一个圆角 + 一处阴影，中间无缝 */
.login-card {
  width: 100%; max-width: 1120px;
  display: grid; grid-template-columns: 1.08fr .92fr;
  border-radius: 28px; overflow: hidden;
  box-shadow: 0 30px 70px rgba(35, 38, 43, .24);
  min-height: min(740px, calc(100vh - 64px));
}
.login-visual {
  position: relative; overflow: hidden;
  background: linear-gradient(158deg, #23262b 0%, #2b3038 58%, #333b46 100%);
  border-radius: 0; padding: 46px 44px; color: #fff;
  display: flex; flex-direction: column;
  box-shadow: none;
}
.login-visual::after {
  content: ""; position: absolute; right: -130px; bottom: -150px;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(211, 240, 255, .38), transparent 62%);
  z-index: 0;
}
.login-visual::before {
  content: ""; position: absolute; left: -110px; top: -120px;
  width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(127, 167, 217, .3), transparent 64%);
  z-index: 0;
}
/* 星云画布：铺满视觉区、在光斑之上、文字之下，不接收鼠标事件 */
.nebula-bg {
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none; opacity: 0;
  transition: opacity 1.4s ease;
}
.nebula-bg.ready { opacity: 1; }
.nebula-bg canvas { display: block; width: 100% !important; height: 100% !important; mix-blend-mode: screen; }
.login-visual > *:not(.nebula-bg) { position: relative; z-index: 2; }
.brand-lg { display: flex; align-items: center; gap: 12px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #c9d6e6; }
.login-visual h1 { font-size: 42px; line-height: 1.2; font-weight: 700; margin-top: 58px; letter-spacing: -.02em; }
.login-visual h1 .accent { color: var(--sky); }
.login-visual .lead { margin-top: 16px; color: #a9b6c6; font-size: 14px; line-height: 1.8; }
.feat { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.feat li { color: #ccd8e6; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.feat li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sky); flex: none; }
.visual-foot { margin-top: auto; padding-top: 30px; color: #6d7a8a; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; position: relative; z-index: 1; }
.login-panel {
  background: #fff; border-radius: 0; padding: 50px 46px;
  display: flex; flex-direction: column; justify-content: center;
  box-shadow: none;
  border-left: 1px solid rgba(226, 234, 243, .9);
}
.login-panel h2 { font-size: 25px; }
.login-panel .sub { color: var(--muted); font-size: 13px; margin-top: 8px; }
.login-panel form { display: grid; gap: 16px; margin-top: 28px; }
.login-panel label { display: grid; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.login-panel input { padding: 12px 14px; border-radius: 11px; }
/* 记住账号：复选框要脱离上面的大输入框样式 */
.login-panel label.check {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 400; color: var(--ink-2);
  margin-top: -4px; cursor: pointer; user-select: none;
}
.login-panel label.check input[type="checkbox"] { padding: 0; border-radius: 5px; }
.err { color: var(--danger); font-size: 12.5px; }

/* ---------------- 主框架 ---------------- */
.shell {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 236px 1fr; gap: 20px;
  padding: 16px; min-height: 100vh; align-items: start;
}
.sidebar {
  position: sticky; top: 16px; height: calc(100vh - 32px);
  background: linear-gradient(180deg, #28292c, #2f333a);
  border-radius: 22px; padding: 20px 15px 15px;
  display: flex; flex-direction: column; color: #e9eef5;
  box-shadow: 0 16px 40px rgba(35, 38, 43, .24);
  overflow: hidden;
}
.brand { display: flex; align-items: center; padding: 0 4px 18px; }
.brand b { font-size: 16px; letter-spacing: .02em; }
.brand small { display: block; color: #7d8896; font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; margin-top: 3px; }

.side-nav { margin-top: 14px; display: grid; gap: 2px; overflow-y: auto; }
.side-nav .group-label { color: #8b95a4; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; padding: 13px 11px 5px; }
.side-nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: 9px; color: #ccd6e3; font-size: 13px;
  border-left: 2px solid transparent;
}
.side-nav a .mark { width: 5px; height: 5px; border-radius: 1px; background: #6d7885; flex: none; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.active { background: rgba(211, 240, 255, .12); color: #fff; border-left-color: var(--sky); }
.side-nav a.active .mark { background: var(--sky); }

.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.who { display: flex; flex-direction: column; gap: 2px; }
.who-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.who-row b { font-size: 13px; font-weight: 600; }
.who .expire { white-space: nowrap; font-size: 10.5px; }
.who small { display: block; color: #9aa5b3; font-size: 10.5px; margin-top: 2px; }
.who .expire { color: #9aa7b6; }
.who .expire.warn { color: #e0b264; }
.who .expire.danger { color: #f08b96; }
.side-foot .btn { margin-top: 10px; background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); color: #c6d1df; }
.side-foot .btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.main { min-width: 0; padding: 4px 4px 36px; }
.view, .card, .table-scroll { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 8px 4px 18px; }
.topbar h2 { font-size: 23px; font-weight: 700; }
.topbar .sub { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.top-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.user-filter select { background: #fff; box-shadow: var(--shadow-sm); min-width: 150px; }

.flash {
  margin: 0 4px 16px; padding: 11px 15px; border-radius: 12px;
  font-size: 13px; background: var(--mint); color: #2b5f4a; border: 1px solid #d9ece1;
}
.flash.err { background: #fdf3f4; color: #a5323a; border-color: #f7dde0; }
.flash a { color: inherit; font-weight: 600; text-decoration: underline; }
.card-warn { border-color: #f7dde0; box-shadow: 0 8px 28px rgba(226, 58, 78, .08); }

/* ---------------- 卡片与统计 ---------------- */
.view { display: grid; gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h3 { font-size: 14.5px; font-weight: 650; }
.card-head .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
/* 卡片头：Tab 靠左，「共 N 个词」靠右 */
.card-head { flex-wrap: wrap; }
.card-head .total-hint { margin-left: auto; align-self: center; white-space: nowrap; }
/* 工具栏独占一行：筛选靠左，操作按钮靠右 */
.tools { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.card-head .tools { flex: 1 1 100%; max-width: 100%; }
.tools-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-start; width: 100%; }
.tools-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: #fff; border: 1px solid var(--line-2); border-radius: 16px;
  padding: 15px 17px; box-shadow: var(--shadow-sm); display: grid; gap: 4px;
}
.stat small { color: var(--muted); font-size: 11.5px; }
.stat b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat b.sm { font-size: 17px; }
.stat span { color: var(--muted-2); font-size: 11px; }
.stat span.warn { color: #b97f24; }
.stat span.danger { color: var(--danger); }
.stat.dark { background: linear-gradient(150deg, #28292c, #3a4149); border: 0; color: #fff; }
.stat.dark small, .stat.dark span { color: #98a3b0; }
.stat.dark b.accent { color: var(--sky); }

/* ---------------- 标签页 / 表格 ---------------- */
.tabs { display: inline-flex; gap: 3px; padding: 3px; background: #f3f7fb; border-radius: 10px; }
.tabs a { padding: 7px 15px; border-radius: 8px; font-size: 12.5px; color: var(--muted); }
.tabs a.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  text-align: left; font-size: 13px; color: var(--ink-2); font-weight: 600;
  letter-spacing: .03em;
  padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #f7fafd;
}
/* 表头排序（指数值） */
.th-sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
.th-sort:hover { color: var(--brand); }
.th-sort.on { color: var(--accent-ink); }
.th-sort .sort-ico { font-size: 11px; opacity: .55; }
.th-sort.on .sort-ico { opacity: 1; }
/* 筛选行：关键词 + 指数范围 + 排序 合成一个表单 */
.filter-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-form .filter-group { width: auto; min-width: 148px; max-width: 210px; flex: none; padding: 7px 26px 7px 11px; }
.filter-form .filter-q { width: 170px; flex: none; padding: 7px 11px; }
.filter-sep { font-size: 11.5px; color: var(--muted-2); }
.filter-form .filter-sort { width: auto; min-width: 132px; flex: none; }
.filter-form .idx-input { width: 78px; flex: none; padding: 6px 8px; text-align: center; }
.idx-input::-webkit-outer-spin-button, .idx-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.idx-input { -moz-appearance: textfield; }
.no-index { font-size: 12px; letter-spacing: .02em; }
table.grid td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); font-size: 13px; vertical-align: middle; }
table.grid tbody tr:hover { background: #f8fbfe; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tfoot td { background: #fafcff; border-top: 1px solid var(--line); font-size: 12.5px; }
table.grid.compact td, table.grid.compact th { padding: 8px 10px; font-size: 12.5px; }
table.grid input[type="checkbox"] { width: 17px; height: 17px; }
/* 表格容器只做横向滚动：不限制高度，让列表随内容展开，避免出现列表内部纵向滚动条 */
.table-scroll { max-height: none; overflow-x: auto; overflow-y: visible; }

/* 表头吸顶（JS 克隆一份表头固定到视口顶部，因为容器是横向滚动容器，CSS sticky 在纵向不生效） */
.sticky-head {
  position: fixed; top: 0; left: 0; z-index: 45;
  display: none; overflow: hidden;
  background: #fff; pointer-events: none;
  box-shadow: 0 10px 22px rgba(45, 75, 115, .12);
}
.sticky-head table { margin: 0 !important; border-collapse: collapse; }
.sticky-head thead th { background: #f7fafd; }
.wrap-cell { max-width: 420px; word-break: break-all; }

.kw-img {
  height: 48px; width: auto; border-radius: 7px; display: block;
  border: 1px solid #e7eef7; user-select: none; -webkit-user-drag: none;
}
table.grid, .kw-img { user-select: none; }
.kw-text { font-size: 13.5px; font-weight: 500; color: var(--ink); }

.batchbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--sky-2); border: 1px solid #dfeaf6;
  padding: 9px 12px; border-radius: 11px; margin-bottom: 12px;
  font-size: 12.5px; color: #3c4a5a;
}
.batchbar select { width: auto; min-width: 130px; }
.batchbar .btn { background: #fff; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; color: var(--muted); font-size: 12px; flex-wrap: wrap; gap: 10px; }
.pager .pages { display: flex; gap: 5px; align-items: center; }
.pg-btn {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 12px; color: var(--ink-2);
}
.pg-btn:hover { border-color: #c8d8e8; }
.pg-btn.active { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }

/* ---------------- 分组 / 规则 ---------------- */
.group-add { display: flex; gap: 8px; margin-bottom: 14px; }
.group-add input { flex: 1; }
.group-add select { max-width: 220px; }
.child-row td { background: #fbfcfe; }
.tree-line { color: #b9c3d3; margin-right: 7px; font-size: 12px; }
.group-add .btn { flex: none; }

.rule-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 2; }
.rule-list code { color: var(--accent-ink); }

.policy { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.policy-item { background: var(--sky-2); border: 1px solid #e3eef9; border-radius: 13px; padding: 13px 15px; }
.policy-item b { display: block; font-size: 12.5px; margin-bottom: 5px; color: var(--accent-ink); }
.policy-item span { color: var(--muted); font-size: 11.5px; line-height: 1.7; }

/* ---------------- 平台切换 ---------------- */
.ptabs {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--line-2); border-radius: 14px;
  padding: 6px 8px; box-shadow: var(--shadow-sm); align-self: flex-start;
}
.ptabs-label { color: var(--muted-2); font-size: 11.5px; padding: 0 8px 0 4px; }
.ptabs a {
  padding: 7px 18px; border-radius: 10px; font-size: 13px; color: var(--muted);
  transition: .15s;
}
.ptabs a:hover { background: var(--sky-2); color: var(--accent-ink); }
.ptabs span.disabled {
  padding: 7px 18px; border-radius: 10px; font-size: 13px;
  color: #b8c1cc; background: #f6f8fa; cursor: not-allowed;
  text-decoration: line-through; text-decoration-color: #d5dce4;
}
.ptabs a.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 600; box-shadow: 0 6px 14px rgba(79, 121, 184, .28);
}

/* ---------------- 导入步骤 ---------------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.step { background: var(--sky-2); border: 1px solid #e3eef9; border-radius: 14px; padding: 14px 16px; }
.step-no {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 7px; background: #fff; color: var(--brand); font-size: 12px; font-weight: 700;
  border: 1px solid #dbe8f6; margin-bottom: 8px;
}
.step b { display: block; font-size: 13px; margin-bottom: 5px; }
.step p { color: var(--muted); font-size: 12px; line-height: 1.7; }

.sample { margin: 4px 0 16px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.sample-head { display: flex; align-items: baseline; gap: 10px; padding: 12px 14px; background: #fafcff; border-bottom: 1px solid var(--line-2); }
.sample-head b { font-size: 13px; }
.sample table.grid th, .sample table.grid td { padding: 9px 14px; }

.tabs a i { font-style: normal; color: var(--muted-2); font-size: 11px; margin-left: 3px; }
.tabs a.active i { color: var(--brand); }

/* ---------------- 首页 Dashboard ---------------- */
.dash-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.platform-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.platform-card {
  display: block; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 15px; background: #fbfcff; transition: .16s;
}
.platform-card:hover { border-color: #bcd4ea; background: #f7fbff; transform: translateY(-1px); }
.platform-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.platform-top b { font-size: 14px; }
.platform-top .num { color: var(--accent-ink); font-size: 13px; }
.platform-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 11.5px; margin-bottom: 10px; }
.platform-quota { margin-top: 6px; color: var(--muted-2); font-size: 11px; }

.rank-list { display: grid; gap: 12px; }
.rank-row { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 10px; }
.rank-name { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .bar { height: 8px; border-radius: 999px; background: #eef3f9; overflow: hidden; }
.rank-row .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #a9cdea, #4f79b8); }
.rank-num { text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.recent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.recent-grid.wide { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.recent-item { display: grid; gap: 6px; }
.recent-item img { width: 100%; height: auto; border-radius: 8px; border: 1px solid #e7eef7; user-select: none; -webkit-user-drag: none; }
.recent-item small { color: var(--muted-2); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: 1fr; }
  .platform-cards { grid-template-columns: 1fr; }
}

/* ---------------- 分类统计 ---------------- */
.chart-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.chart-box { width: 100%; height: 320px; }
.percent { display: flex; align-items: center; gap: 10px; }
.percent .bar { flex: 1; height: 7px; border-radius: 999px; background: #eef3f9; overflow: hidden; }
.percent .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #9dc7e8, #4f79b8); }
.percent span { min-width: 42px; text-align: right; }

/* ---------------- 导入 ---------------- */
.drop {
  border: 1.5px dashed #cbdcee; border-radius: 15px; padding: 26px;
  text-align: center; background: #fafcff; transition: .15s;
}
.drop { cursor: pointer; }
.drop:hover { border-color: #a8c6e4; background: #f6faff; }
.drop.dragover { border-color: var(--brand); background: #eff7ff; border-style: solid; box-shadow: 0 0 0 4px rgba(79, 121, 184, .1); }
.drop b { display: block; margin-bottom: 5px; font-size: 13.5px; }
.drop small { color: var(--muted); font-size: 11.5px; }
.import-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 15px; }
.result-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.result-grid div { background: #f7fafd; border-radius: 12px; padding: 12px 14px; }
.result-grid small { color: var(--muted); font-size: 10.5px; display: block; margin-bottom: 4px; }
.result-grid b { font-size: 21px; font-variant-numeric: tabular-nums; }
.result-grid .good b { color: var(--ok); }
.result-grid .bad b { color: var(--danger); }

/* ---------------- 表单 ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
.field .hint { font-size: 11px; }
.field .hint.over { color: var(--danger); }
input.invalid, textarea.invalid { border-color: var(--danger) !important; }

/* 导入进度 */
.import-progress {
  margin: 16px 0 4px; padding: 14px 16px;
  border: 1px solid #d9e7f7; border-radius: 13px;
  background: linear-gradient(180deg, #f7fbff, #eff6ff);
}
.import-progress-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.import-progress-head b { font-size: 13px; color: var(--ink); }
.import-progress-head span { font-size: 13px; font-weight: 700; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.import-progress .bar { height: 8px; border-radius: 999px; background: #dde8f5; overflow: hidden; }
.import-progress .bar i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .25s ease;
}
.import-progress p { margin: 9px 0 0; }
.btn.loading { cursor: not-allowed; display: inline-flex; align-items: center; gap: 8px; }
.btn.loading:disabled { opacity: .9; }
.spin {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  display: inline-block; animation: kp-spin .7s linear infinite;
}
@keyframes kp-spin { to { transform: rotate(360deg); } }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.switch-row b { font-size: 13px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; cursor: pointer; padding: 4px 0; }
.check-row { display: flex; gap: 18px; flex-wrap: wrap; }
.check input { width: 18px; height: 18px; margin-top: 1px; flex: none; }
.switch { position: relative; width: 40px; height: 23px; border-radius: 999px; background: #dbe3ec; border: 0; transition: .18s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: .18s; box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.switch.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.switch.on::after { left: 20px; }

/* ---------------- 配额 ---------------- */
.quota-list { display: grid; gap: 14px; }
.quota-item.off .quota-head b { color: var(--muted-2); }
.quota-item.off .bar i { width: 0 !important; }
.quota-item.off .muted { font-size: 11.5px; }
.quota-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: 12.5px; }
.bar { height: 8px; border-radius: 999px; background: #eef3f9; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7fa7d9, #4f79b8); }
.bar.warn i { background: linear-gradient(90deg, #e0b06a, #d24a52); }

/* ---------------- 登录欢迎 / 额度说明 ---------------- */
.modal.welcome { max-width: 980px; padding: 30px 34px; }
.modal.welcome h3 { text-align: left; font-size: 22px; margin-bottom: 6px; }
.modal.welcome .sub { text-align: left; font-size: 13px; margin-bottom: 18px; }
.welcome-grid { display: flex; gap: 14px; margin: 16px 0 14px; }
.welcome-box {
  flex: 1; background: #f7fafd; border: 1px solid #e6eef7; border-radius: 14px;
  padding: 13px 16px; display: grid; gap: 2px;
}
.welcome-box small { color: var(--muted); font-size: 12px; }
.welcome-box b { font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.welcome-box span { color: var(--muted-2); font-size: 11.5px; }
.welcome-box.accent { background: linear-gradient(150deg, #eef6ff, #e2eefb); border-color: #d3e5f6; }
.welcome-box.accent b { color: #2f5f96; }
.welcome-note {
  font-size: 12.5px; color: #6b7385; line-height: 1.85;
  background: #fbfcff; border-left: 3px solid #cfe0f2; padding: 9px 12px;
  border-radius: 0 8px 8px 0;
}
.welcome-note strong { color: var(--ink-2); }
.welcome-note.small { font-size: 11.5px; color: var(--muted-2); background: transparent; border: 0; padding: 2px 0 0; }
.welcome-table-wrap { margin-top: 12px; }
.modal .welcome-foot { justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.welcome-foot .welcome-check { margin-right: auto; }
.welcome-check { font-size: 12.5px; color: var(--muted); }
.welcome-actions { display: flex; gap: 8px; }
.flow { margin-top: 20px; }
.flow svg { margin-top: 2px; }
.flow-title { font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.flow svg { width: 100%; height: auto; display: block; }
.flow svg text { font-family: inherit; }

/* ---------------- 轻提示 ---------------- */
.toasts { position: fixed; top: 20px; right: 22px; z-index: 90; display: grid; gap: 8px; }
.toast {
  background: #0d1322; color: #fff; padding: 11px 16px; border-radius: 12px;
  font-size: 13px; box-shadow: 0 12px 30px rgba(11, 16, 32, .28);
  animation: toastIn .2s ease; max-width: 380px; line-height: 1.5;
}
.toast.err { background: linear-gradient(135deg, #b3202f, #e23a4e); }
@keyframes toastIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* ---------------- 平台与额度 / 分享 ---------------- */
.plat-block { margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: #fbfcff; }
.plat-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.plat-head b { font-size: 13px; }
.plat-row { display: flex; align-items: center; gap: 16px; padding: 9px 0; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.plat-row:first-of-type { border-top: 0; }
.plat-row .check { min-width: 82px; }
.plat-field { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.plat-field input { width: 92px; padding: 6px 9px; }

.share-list { display: grid; gap: 10px; margin-top: 4px; }
.share-row { display: grid; grid-template-columns: 68px 1fr auto auto; align-items: center; gap: 10px; }
.share-label { color: var(--muted); font-size: 12.5px; }
.share-row code { background: #f7fafd; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; word-break: break-all; }

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed; inset: 0; z-index: 60; padding: 24px;
  background: rgba(35, 38, 43, .4); backdrop-filter: blur(3px);
  display: grid; place-items: center;
}
.modal {
  background: #fff; border-radius: 20px; padding: 22px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 28px 64px rgba(35, 38, 43, .3);
}
.modal.wide { max-width: 640px; }
.modal.confirm { max-width: 460px; padding: 26px 28px 22px; }
.modal.confirm h3 {
  text-align: left; font-size: 17px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.confirm-ico { flex: none; }
.modal.confirm .sub {
  text-align: left; font-size: 13.5px; color: var(--ink-2);
  line-height: 1.8; margin-bottom: 22px; padding-bottom: 16px;
  border-bottom: 1px solid var(--line-2);
}
.modal.confirm .modal-foot { margin-top: 18px; }
.modal .sub { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.modal .modal-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.modal .field + .field { margin-top: 12px; }

/* ---------------- 独立页面 ---------------- */
.center-page { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.center-card {
  background: #fff; border-radius: 22px; padding: 40px 38px; max-width: 440px; width: 100%;
  box-shadow: var(--shadow); text-align: center;
}
.center-card h2 { font-size: 21px; margin-bottom: 10px; }
.center-card .muted { font-size: 13px; line-height: 1.7; }
.center-card .hint { margin-top: 12px; }
.big-code { font-size: 54px; font-weight: 800; color: #dbe8f5; line-height: 1; margin-bottom: 8px; }
.center-actions { display: flex; gap: 10px; justify-content: center; margin-top: 24px; }
.blocked-icon {
  width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 16px;
  display: grid; place-items: center; font-size: 26px; font-weight: 800;
  background: #fdf3f4; color: var(--danger);
}
.captcha-form { display: grid; gap: 14px; margin-top: 20px; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-img { width: 132px; height: 48px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; flex: none; }
.captcha-row input { flex: 1; }

.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); font-size: 12.5px; }
.empty-state b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 6px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .result-grid { grid-template-columns: repeat(3, 1fr); }
  .policy { grid-template-columns: 1fr; }
}
/* ---------------- 词图片放大 ---------------- */
img.kw-img, .recent-item img { cursor: zoom-in; }
.img-viewer {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(11, 16, 32, .86);
  display: grid; place-items: center; gap: 12px;
  padding: 24px; cursor: zoom-out;
}
.img-viewer img {
  max-width: min(92vw, 960px); max-height: 82vh;
  width: auto; height: auto;
  border-radius: 12px; background: #fff;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .45);
}
.img-viewer-tip { color: rgba(255, 255, 255, .6); font-size: 12px; }

/* ---------------- 移动端 ---------------- */
.nav-toggle {
  display: none;
  width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--line); background: #fff;
  align-items: center; justify-content: center; gap: 4px; flex-direction: column;
  box-shadow: var(--shadow-sm); flex: none; cursor: pointer;
}
.nav-toggle span { display: block; width: 16px; height: 1.8px; border-radius: 2px; background: var(--ink-2); }
.nav-overlay { display: none; }

@media (max-width: 900px) {
  body.nav-open { overflow: hidden; }

  .shell { grid-template-columns: 1fr; padding: 10px; gap: 12px; z-index: auto; }
  /* 抽屉要浮在遮罩之上：shell 不再创建层叠上下文，sidebar z-index 才能生效 */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 268px; height: 100vh; height: 100dvh; border-radius: 0 20px 20px 0;
    padding: 18px 14px 14px; z-index: 90;
    transform: translateX(-104%); transition: transform .22s ease;
  }
  body.nav-open .sidebar { transform: none; }
  .nav-overlay {
    display: block; position: fixed; inset: 0; z-index: 70;
    background: rgba(11, 16, 32, .45);
  }
  .nav-toggle { display: inline-flex; }

  .main { padding: 0 0 26px; min-width: 0; }
  .topbar { justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 10px; padding: 2px 2px 12px; }
  .nav-toggle { margin-top: 0; }
  .topbar-title { flex: 1 1 0; min-width: 0; text-align: left; }
  .topbar-title h2 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .sub { font-size: 12px; line-height: 1.6; }
  .top-actions { flex: 1 1 100%; width: 100%; justify-content: flex-start; gap: 8px; }
  .top-actions .user-filter { width: 100%; }
  .top-actions select { width: 100%; }
  .pill.unit { max-width: 100%; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat b { font-size: 21px; }
  .stat b.sm { font-size: 15px; }

  .card { padding: 14px; border-radius: 16px; }
  .card-head { gap: 10px; }
  .tools { width: 100%; gap: 8px; align-items: stretch; }
  .tools-row { justify-content: flex-start; }
  .tools-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  /* Tab 行：缩小内边距，让「共 N 个词」能跟在右边同一行；工具栏仍独占一行 */
  .card-head { flex-wrap: wrap; align-items: center; row-gap: 8px; }
  .tabs { flex: none; }
  .tabs a { padding: 6px 9px; font-size: 12px; }
  .card-head .total-hint { margin-left: auto; font-size: 11.5px; }
  .card-head .tools { flex: 1 1 100%; }
  .tools .btn { padding: 8px 12px; }
  .search-form { flex: 1 1 100%; }
  .search-form input[type="text"] { width: 100%; flex: 1; }
  .filter-form { flex: 1 1 100%; }
  .filter-form .filter-group { flex: 1 1 100%; width: 100%; max-width: none; }
  .filter-form .filter-q { flex: 1 1 100%; width: 100%; }
  .filter-form .idx-input { flex: 1; min-width: 66px; width: auto; }
  .filter-form .filter-sort { flex: 1 1 120px; width: auto; min-width: 0; }

  .dash-grid, .chart-grid { grid-template-columns: 1fr; }
  .platform-cards { grid-template-columns: 1fr; }
  .recent-grid, .recent-grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rank-row { grid-template-columns: 96px 1fr 38px; }
  .rank-name { font-size: 12px; }

  .form-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .policy { grid-template-columns: 1fr; }
  .summary-row { grid-template-columns: repeat(2, 1fr); }

  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.grid { min-width: 620px; }
  table.grid th, table.grid td { padding: 9px 8px; }
  .kw-img { height: 48px; }

  .ptabs { width: 100%; overflow-x: auto; }
  .ptabs a, .ptabs span.disabled { padding: 7px 12px; white-space: nowrap; }
  .pager { flex-direction: column; align-items: flex-start; gap: 8px; }
  .pager .pages { width: 100%; overflow-x: auto; padding-bottom: 2px; }

  .mask { padding: 10px; }
  .modal, .modal.wide, .modal.welcome {
    max-width: 100%; width: 100%; max-height: 92vh;
    padding: 18px 16px; border-radius: 16px;
  }
  .welcome-grid { flex-direction: column; }
  .welcome-box b { font-size: 24px; }
  .flow { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .flow svg { min-width: 700px; }
  .share-row { grid-template-columns: 1fr auto; }
  .share-label { grid-column: 1 / -1; }
  .plat-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .plat-field { width: 100%; }
  .plat-field input { flex: 1; width: auto; }

  .login-wrap { padding: 12px; }
  .login-card { grid-template-columns: 1fr; border-radius: 20px; min-height: 0; }
  .login-visual { padding: 24px 22px; min-height: 236px; }
  .login-visual h1 { font-size: 28px; margin-top: 18px; }
  .login-visual .feat { display: none; }
  .login-visual .lead { font-size: 13px; }
  .login-panel { padding: 26px 22px; border-left: 0; border-top: 1px solid rgba(226, 234, 243, .9); }

  .side-nav { display: grid; gap: 2px; }
  .side-nav a { padding: 12px; font-size: 14px; }
  .side-nav .group-label { display: block; font-size: 10.5px; padding: 13px 12px 6px; }
  .side-foot .btn { padding: 10px; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
  .recent-grid, .recent-grid.wide { grid-template-columns: 1fr; }
  .topbar-title h2 { font-size: 18px; }
}
