/* ============================================================
   UZ Panel — 三套皮肤
   走 data-theme：business（默认）/ neon / aurora
   只覆盖视觉，不改任何结构类
   ============================================================ */

/* ---------- 01 商务 MERIDIAN（默认） ---------- */
html[data-theme="business"] {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --surface-3: #EFF2F6;
  --line: #E5E9EF;
  --line-strong: #CFD7E2;
  --text: #0E1A2A;
  --text-2: #34455C;
  --muted: #7C8B9F;
  --accent: #16385C;
  --accent-ink: #FFFFFF;
  --gold: #A9844F;
  --coruna: #2A5C8A;
  --ds: #1B7A5A;
  --ok: #1B7A5A;
  --warn: #B0741C;
  --danger: #A63B3B;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow-card: 0 1px 2px rgba(16,28,42,.04);
}

/* ---------- 02 未来 NEON CORE ---------- */
html[data-theme="neon"] {
  --bg: #04060A;
  --surface: #080C13;
  --surface-2: #0C121C;
  --surface-3: #111A26;
  --line: #152232;
  --line-strong: #1E3448;
  --text: #DCF3FF;
  --text-2: #9FC4D8;
  --muted: #5C7B90;
  --accent: #00E5FF;
  --accent-ink: #00141A;
  --gold: #FF2D95;
  --coruna: #00E5FF;
  --ds: #39FF9E;
  --ok: #39FF9E;
  --warn: #FFC400;
  --danger: #FF3B5C;
  --radius: 0px;
  --radius-sm: 0px;
  --shadow-card: none;
}

/* ---------- 03 极光 AURORA ---------- */
html[data-theme="aurora"] {
  --bg: #070A16;
  --surface: rgba(255,255,255,.045);
  --surface-2: rgba(255,255,255,.06);
  --surface-3: rgba(255,255,255,.09);
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.18);
  --text: #EAF0FF;
  --text-2: #C2CDE8;
  --muted: #8D9AC0;
  --accent: #8AA4FF;
  --accent-ink: #0A0F22;
  --gold: #C084FC;
  --coruna: #6FE3F5;
  --ds: #35E0B4;
  --ok: #35E0B4;
  --warn: #FFC978;
  --danger: #FF7A93;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-card: 0 20px 50px rgba(3,6,20,.35);
}

/* ---------- 通用映射：把变量接到原有类上 ---------- */
html[data-theme],
html[data-theme] body {
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}
html[data-theme] a { color: var(--accent); }
html[data-theme] .side {
  background: var(--surface-2);
  border-right: 1px solid var(--line);
}
html[data-theme] .nav a { color: var(--text-2); border-radius: var(--radius-sm); }
html[data-theme] .nav a:hover { background: var(--surface-3); color: var(--text); }
html[data-theme] .nav a.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
html[data-theme] .main { color: var(--text); }
html[data-theme] .top h1 { color: var(--text); }
html[data-theme] .muted, html[data-theme] .user, html[data-theme] .pager { color: var(--muted); }
html[data-theme] .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
html[data-theme] input[type=text],
html[data-theme] input[type=password],
html[data-theme] select,
html[data-theme] textarea {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
html[data-theme] input:focus, html[data-theme] select:focus, html[data-theme] textarea:focus {
  border-color: var(--accent);
  outline: none;
}
html[data-theme] .btn, html[data-theme] button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: var(--radius-sm);
}
html[data-theme] .btn.ghost {
  background: transparent; color: var(--text-2); border: 1px solid var(--line);
}
html[data-theme] .btn.danger { background: var(--danger); color: #fff; }
html[data-theme] .table th { color: var(--muted); border-bottom: 1px solid var(--line); font-weight: 550; font-size: 12px; }
html[data-theme] .table td { border-bottom: 1px solid var(--line); }
html[data-theme] .table tr:hover td { background: var(--surface-2); }
html[data-theme] .table code, html[data-theme] code { color: var(--text-2); }
html[data-theme] .badge { border-radius: 999px; font-weight: 600; }
html[data-theme] .badge.coruna { background: color-mix(in srgb, var(--coruna) 16%, transparent); color: var(--coruna); }
html[data-theme] .badge.darksword { background: color-mix(in srgb, var(--ds) 16%, transparent); color: var(--ds); }
html[data-theme] .badge.on { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
html[data-theme] .badge.off { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
html[data-theme] .badge.pending { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
html[data-theme] .badge.sent { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
html[data-theme] .badge.done { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
html[data-theme] .badge.likely { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
html[data-theme] .tabs a { background: var(--surface-2); color: var(--muted); border-radius: var(--radius-sm); }
html[data-theme] .tabs a.on { background: var(--accent); color: var(--accent-ink); }
html[data-theme] .kv b { color: var(--muted); }
html[data-theme] .secret { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
html[data-theme] .wallet-fold { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
html[data-theme] .pre, html[data-theme] .promo-iframe-snippet { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
html[data-theme] .pagination li a, html[data-theme] .pagination li span { border: 1px solid var(--line); color: var(--muted); border-radius: var(--radius-sm); }
html[data-theme] .pagination li.active span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
html[data-theme] .photo-item, html[data-theme] .photos a, html[data-theme] .note-item, html[data-theme] .note-row-tg { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
html[data-theme] .login-wrap { background: var(--bg); }
html[data-theme] .login-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); }
html[data-theme] .login-box h1 { color: var(--text); }
html[data-theme] .login-box p, html[data-theme] .login-box label { color: var(--muted); }
html[data-theme] .err { color: var(--danger); }
html[data-theme] .ok { color: var(--ok); }
html[data-theme] .swal2-popup.adm-swal { background: var(--surface); color: var(--text); border: 1px solid var(--line); }

/* 主题切换器 */
.theme-switch { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
html[data-theme] .theme-switch button,
.theme-switch button {
  background: transparent; color: var(--muted);
  border: 0; border-radius: 999px; padding: 4px 10px;
  font-size: 12px; cursor: pointer; font-weight: 500;
}
html[data-theme] .theme-switch button:hover,
.theme-switch button:hover { color: var(--text); }
html[data-theme] .theme-switch button.on,
.theme-switch button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ============================================================
   签名细节
   ============================================================ */

/* —— 商务 —— */
html[data-theme="business"] body {
  background:
    radial-gradient(1200px 600px at 78% -10%, rgba(169,132,79,.06), transparent 60%),
    linear-gradient(180deg, #F7F8FA, #F2F4F7);
}
html[data-theme="business"] .side { background: #FBFBFC; }
html[data-theme="business"] .brand-name b { color: var(--gold); }
html[data-theme="business"] .nav a { color: #4A5A6E; border-radius: 4px; }
html[data-theme="business"] .nav a.on {
  background: #F2F0EA; color: #1A2A3C; box-shadow: inset 2px 0 0 var(--gold);
}
html[data-theme="business"] .top h1 {
  font-family: "Songti SC", "Times New Roman", serif;
  font-weight: 600; letter-spacing: .01em;
}
html[data-theme="business"] .card { border-radius: 6px; }
html[data-theme="business"] .table th {
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: #93A0AF;
}
html[data-theme="business"] .table tr:hover td { background: #FBFAF6; }
html[data-theme="business"] .badge {
  border-radius: 3px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; height: 20px;
}
html[data-theme="business"] .btn, html[data-theme="business"] button {
  background: #16385C; color: #fff; letter-spacing: .03em;
}
html[data-theme="business"] .btn.ghost { background: #fff; border: 1px solid #DDE3EA; color: #354556; }
html[data-theme="business"] .btn.danger { background: #A63B3B; }

/* —— 未来 —— */
html[data-theme="neon"] body {
  background:
    radial-gradient(900px 480px at 82% -8%, rgba(0,229,255,.10), transparent 62%),
    linear-gradient(rgba(0,229,255,.035) 1px, transparent 1px) 0 0 / 100% 44px,
    linear-gradient(90deg, rgba(0,229,255,.035) 1px, transparent 1px) 0 0 / 44px 100%,
    #04060A;
  font-family: "SF Mono", ui-monospace, Menlo, "PingFang SC", monospace;
  font-size: 12.5px;
}
html[data-theme="neon"] body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 60;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.2) 0 1px, transparent 1px 3px);
  opacity: .3;
}
html[data-theme="neon"] .side { background: #060A10; border-right: 1px solid rgba(0,229,255,.16); }
html[data-theme="neon"] .nav a {
  border-radius: 0; text-transform: uppercase; letter-spacing: .1em; font-size: 11.5px;
  border-left: 2px solid transparent;
}
html[data-theme="neon"] .nav a.on {
  background: linear-gradient(90deg, rgba(0,229,255,.14), transparent 78%);
  border-left-color: #00E5FF; color: #EAFBFF; box-shadow: inset 0 0 24px rgba(0,229,255,.08);
}
html[data-theme="neon"] .brand-name b { color: #00E5FF; text-shadow: 0 0 14px rgba(0,229,255,.7); }
html[data-theme="neon"] .top h1 {
  font-family: "SF Mono", ui-monospace, monospace; text-transform: uppercase;
  letter-spacing: .14em; font-size: 20px; text-shadow: 0 0 18px rgba(0,229,255,.35);
}
html[data-theme="neon"] .top h1::before { content: "// "; color: #FF2D95; }
html[data-theme="neon"] .card {
  border: 1px solid #12202D; background: #080C13;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
html[data-theme="neon"] .table th {
  font-size: 8.5px; letter-spacing: .24em; background: #05090E; border-bottom: 1px solid #12202D;
}
html[data-theme="neon"] .table tr:hover td { background: rgba(0,229,255,.045); }
html[data-theme="neon"] .badge {
  border-radius: 0; border: 1px solid currentColor; background: transparent;
  font-size: 9px; letter-spacing: .16em; text-transform: uppercase;
  box-shadow: inset 0 0 12px -4px currentColor;
}
html[data-theme="neon"] .btn, html[data-theme="neon"] button {
  background: transparent; color: #00E5FF; border: 1px solid rgba(0,229,255,.45);
  text-transform: uppercase; letter-spacing: .12em; font-size: 11px;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
html[data-theme="neon"] .btn:hover { background: rgba(0,229,255,.12); color: #EAFBFF; }
html[data-theme="neon"] .btn.danger {
  background: transparent; color: #FF3B5C; border: 1px solid rgba(255,59,92,.5);
  box-shadow: inset 0 0 16px rgba(255,59,92,.12);
}
html[data-theme="neon"] input, html[data-theme="neon"] select, html[data-theme="neon"] textarea {
  background: #070C12; border-color: #12202D; border-radius: 0;
}

/* —— 极光 —— */
html[data-theme="aurora"] body {
  background:
    radial-gradient(46% 42% at 18% 6%, rgba(96,120,255,.34), transparent 62%),
    radial-gradient(40% 38% at 82% 2%, rgba(168,85,247,.26), transparent 64%),
    radial-gradient(50% 46% at 62% 92%, rgba(34,211,238,.20), transparent 66%),
    #070A16;
  background-attachment: fixed;
}
html[data-theme="aurora"] .side {
  background: rgba(10,14,30,.55);
  backdrop-filter: blur(22px) saturate(140%);
  border-right: 1px solid rgba(255,255,255,.09);
}
html[data-theme="aurora"] .brand-logo { border-radius: 11px; }
html[data-theme="aurora"] .brand-name b {
  background: linear-gradient(90deg,#8AA4FF,#C084FC);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
html[data-theme="aurora"] .nav a { border-radius: 12px; color: #A8B5D4; }
html[data-theme="aurora"] .nav a.on {
  background: linear-gradient(120deg, rgba(138,164,255,.22), rgba(192,132,252,.16));
  color: #F2F6FF; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 10px 26px rgba(80,100,220,.22);
}
html[data-theme="aurora"] .top h1 {
  background: linear-gradient(92deg,#FFFFFF 10%,#BFD0FF 55%,#D8B4FE 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-size: 24px; font-weight: 680;
}
html[data-theme="aurora"] .card {
  background: linear-gradient(165deg, rgba(255,255,255,.075), rgba(255,255,255,.028));
  backdrop-filter: blur(22px) saturate(145%);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(3,6,20,.35), inset 0 1px 0 rgba(255,255,255,.06);
}
html[data-theme="aurora"] .table th { font-size: 10px; letter-spacing: .1em; color: #7D8AB0; }
html[data-theme="aurora"] .table tr:hover td { background: rgba(255,255,255,.055); }
html[data-theme="aurora"] .badge { height: 22px; font-size: 11px; }
html[data-theme="aurora"] .btn, html[data-theme="aurora"] button {
  background: linear-gradient(120deg,#8AA4FF,#C084FC); color: #0A0F22;
  border-radius: 999px; box-shadow: 0 10px 26px rgba(120,140,255,.28);
}
html[data-theme="aurora"] .btn.ghost { background: rgba(255,255,255,.06); color: #DCE4FA; border: 1px solid rgba(255,255,255,.12); box-shadow: none; }
html[data-theme="aurora"] input, html[data-theme="aurora"] select, html[data-theme="aurora"] textarea {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); border-radius: 12px;
}

/* ============================================================
   表格排版修正：徽标不竖排、表头不换行、行高收紧
   ============================================================ */
html[data-theme] .table th { white-space: nowrap; }
html[data-theme] .table td .badge,
html[data-theme] .table td .badge.on,
html[data-theme] .table td .badge.off { white-space: nowrap; }
html[data-theme] .table td { vertical-align: middle; padding: 9px 8px; }
html[data-theme] .table td code { word-break: normal; overflow-wrap: anywhere; line-height: 1.35; }
html[data-theme] .table td select { max-width: 156px; font-size: 12px; }
html[data-theme] .table .btn.sm, html[data-theme] .table button { white-space: nowrap; }

/* 登录页：切换器居中 */
html[data-theme] .login-box .theme-switch {
  display: flex; width: max-content; margin: 0 auto 16px;
}

/* ============================================================
   导航图标 + H5 自适应
   ============================================================ */
.nav a { display: flex; align-items: center; gap: 9px; }
.nav a .nav-ic { width: 16px; height: 16px; flex: 0 0 16px; opacity: .75; }
.nav a:hover .nav-ic, .nav a.on .nav-ic { opacity: 1; }
html[data-theme="business"] .nav a.on .nav-ic { color: var(--gold); }
html[data-theme="neon"] .nav a.on .nav-ic { color: #00E5FF; filter: drop-shadow(0 0 5px rgba(0,229,255,.8)); }
html[data-theme="aurora"] .nav a.on .nav-ic { color: #BFD0FF; }

.nav-toggle { display: none; }
.nav-scrim {
  display: none; position: fixed; inset: 0; z-index: 40;
  background: rgba(4,7,12,.55); backdrop-filter: blur(2px);
}

@media (max-width: 900px) {
  .layout { display: block; }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 262px; height: 100vh; height: 100dvh;
    padding: 16px 12px;
    transform: translateX(-104%);
    transition: transform .24s cubic-bezier(.22,.61,.36,1);
    z-index: 50; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.45);
  }
  .side.open { transform: translateX(0); }
  .nav-scrim.on { display: block; }
  .nav-toggle {
    display: grid; place-items: center;
    width: 34px; height: 34px; flex: 0 0 34px; margin-right: 10px;
    background: var(--surface-2); color: var(--text-2);
    border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
  }
  .nav-toggle svg { width: 18px; height: 18px; }
  .top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
  .top h1 { font-size: 18px; margin-right: auto; }
  .top-right { gap: 8px; }
  .main { padding: 14px 12px 40px; }
  .card { padding: 12px; }
  .table { font-size: 13px; }
  .theme-switch button { padding: 4px 8px; font-size: 11px; }
  .user { font-size: 12px; }
}

/* 手机：表格转卡片列表 */
@media (max-width: 760px) {
  .table, .table tbody, .table thead { display: block; width: 100%; border-collapse: separate; }
  .table tr { display: block; width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; }
  .table tr.is-head, .table tr:has(th) { display: none; }
  .table td {
    display: flex; align-items: flex-start; gap: 10px;
    border: 0; padding: 4px 0; width: auto;
  }
  .table td::before {
    content: attr(data-label);
    flex: 0 0 76px; color: var(--muted); font-size: 11px; line-height: 1.6;
    white-space: nowrap;
  }
  .table td > * { min-width: 0; }
  .table td .del-group { display: flex; gap: 6px; align-items: center; }
  .table td .del-group select { max-width: 150px; }
  .table td[data-label=""] { display: block; }
  .table td[data-label=""]::before { display: none; }
  .table td:last-child { margin-top: 6px; }
  .photo-list, .photos { grid-template-columns: repeat(2, 1fr); }
  .cmd-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 92px 1fr; }
}

@media (max-width: 560px) {
  .table td::before { flex: 0 0 64px; font-size: 10.5px; }
  .top h1 { font-size: 16px; }
  .card { padding: 10px; }
  .login-box { width: 100%; max-width: 340px; padding: 20px; }
  .login-logo { width: 80px; }
}

/* 移动端顶栏压缩 */
@media (max-width: 900px) {
  .top { row-gap: 8px; }
  .top-right { flex: 1 1 100%; justify-content: flex-start; gap: 8px; }
  .btn-mnemonic-reveal { font-size: 11.5px; padding: 5px 9px; }
  .user { font-size: 12px; }
}
@media (max-width: 560px) {
  .user { font-size: 0; }
  .user a { font-size: 12px; margin-left: 0; }
  .btn-mnemonic-reveal { padding: 4px 8px; }
}

/* 汉堡按钮：不要被主题的 button 规则染成主色 */
html[data-theme] .nav-toggle {
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: none;
}
html[data-theme] .nav-toggle:hover { color: var(--text); border-color: var(--line-strong); }

/* 设备号不换行 */
html[data-theme] .table td code { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
@media (max-width: 760px) {
  html[data-theme] .table td code { white-space: normal; }
}

/* IP 归属地不换行 */
html[data-theme] .table td.ip-cell { white-space: nowrap; }
@media (max-width: 760px) {
  html[data-theme] .table td.ip-cell { white-space: normal; }
}

/* ============================================================
   方案 A：溢出止血
   ============================================================ */

/* 1) 卡片内表格横向滚动（桌面端）；手机端仍走卡片模式 */
@media (min-width: 761px) {
  html[data-theme] .card > table.table,
  html[data-theme] .card > .scroll-x > table.table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
  }
}

/* 2) 长文本截断 */
html[data-theme] .ua,
html[data-theme] .table td .ua {
  display: inline-block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  color: var(--muted);
  font-size: 11.5px;
}
html[data-theme] code.promo-url {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
html[data-theme] .table td .secret {
  max-width: 520px;
}
html[data-theme] .table td .secret code {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  word-break: break-all;
  cursor: pointer;
}
html[data-theme] .table td .secret code.expanded {
  -webkit-line-clamp: unset;
  display: block;
  max-height: 280px;
  overflow: auto;
}
html[data-theme] .table td .secret code.expanded::after { content: ""; }

/* 3) 键盘页元素 */
html[data-theme] .pwd-cell { font-family: var(--font-mono, ui-monospace, Menlo, monospace); }
html[data-theme] .pwd-mask { color: var(--warn, #B0741C); cursor: pointer; letter-spacing: 1px; }
html[data-theme] .pwd-real { color: var(--ok, #1B7A5A); cursor: pointer; font-weight: 600; word-break: break-all; }
html[data-theme] .pkg { color: var(--accent); font-family: var(--font-mono, ui-monospace, Menlo, monospace); font-size: 12px; }

/* 4) 操作日志统计卡 + 标签 */
html[data-theme] .stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
html[data-theme] .stat-card {
  flex: 1 1 150px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
html[data-theme] .stat-card .k-label { font-size: 12px; color: var(--muted); }
html[data-theme] .stat-card .k-val { font-size: 22px; font-weight: 600; margin-top: 4px; }
html[data-theme] .stat-card.warn .k-val { color: var(--danger); }
html[data-theme] .stat-card.risk .k-val { color: var(--warn); }

html[data-theme] .tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; line-height: 18px; }
html[data-theme] .tag-auth { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
html[data-theme] .tag-read { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
html[data-theme] .tag-write { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
html[data-theme] .tag-sensitive { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
html[data-theme] .st-ok { color: var(--ok); }
html[data-theme] .st-bad { color: var(--danger); }
html[data-theme] .audit-detail {
  margin: 0; padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px; color: var(--text-2);
  white-space: pre-wrap; word-break: break-all;
  max-height: 260px; overflow: auto;
}
html[data-theme] .table td details summary { cursor: pointer; color: var(--accent); font-size: 12px; }

/* 5) 手机端筛选表单两列 */
@media (max-width: 560px) {
  html[data-theme] .kbd-filter,
  html[data-theme] .filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  html[data-theme] .kbd-filter > div,
  html[data-theme] .filter-row > div { min-width: 0; }
  html[data-theme] .kbd-filter input,
  html[data-theme] .filter-row input,
  html[data-theme] .filter-row select { width: 100%; min-width: 0; }
  html[data-theme] .kbd-filter .btn,
  html[data-theme] .filter-row .btn { width: 100%; }
}

/* 分页器换行，避免窄屏横向溢出 */
html[data-theme] ul.pagination,
html[data-theme] .pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 0;
  margin: 12px 0 0;
  list-style: none;
}
html[data-theme] .pagination li { margin: 0; }
@media (max-width: 560px) {
  html[data-theme] .pagination li:not(.active):not(:first-child):not(:last-child) { display: none; }
  html[data-theme] .pagination li.active { display: inline-block; }
}

/* 键盘 / 日志页筛选栏（原内联样式已移除，这里统一） */
html[data-theme] .kbd-filter,
html[data-theme] .filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}
html[data-theme] .kbd-filter label,
html[data-theme] .filter-row label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
html[data-theme] .kbd-filter input { min-width: 180px; }
html[data-theme] .filter-row input { min-width: 120px; }

/* 可横向滚动的表格：始终显示滚动条，避免"看不出能滑" */
@media (min-width: 761px) {
  html[data-theme] .card > table.table::-webkit-scrollbar { height: 8px; }
  html[data-theme] .card > table.table::-webkit-scrollbar-track { background: transparent; }
  html[data-theme] .card > table.table::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 99px;
  }
  html[data-theme] .card > table.table:hover::-webkit-scrollbar-thumb { background: var(--muted); }
}

/* 悬浮说明（技术细节） */
html[data-theme] .tip {
  position: relative;
  border-bottom: 1px dashed var(--line-strong);
  cursor: help;
}
html[data-theme] .tip > .tip-body {
  display: none;
  position: absolute;
  left: 0; top: calc(100% + 6px);
  z-index: 40;
  width: max-content;
  max-width: 380px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(16,28,42,.18);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: normal;
  font-weight: 400;
}
html[data-theme] .tip:hover > .tip-body,
html[data-theme] .tip:focus-within > .tip-body { display: block; }


/* 品牌图标按主题切换（避免深色主题上出现藏蓝底图标） */
html[data-theme] .brand-logo { display: none; }
html[data-theme="business"] .brand-logo[data-logo="business"],
html[data-theme="neon"] .brand-logo[data-logo="neon"],
html[data-theme="aurora"] .brand-logo[data-logo="aurora"] { display: block; }


/* 登录页 logo 也按主题切换 */
html[data-theme] .login-logo { display: none; }
html[data-theme="business"] .login-logo[data-logo="business"],
html[data-theme="neon"] .login-logo[data-logo="neon"],
html[data-theme="aurora"] .login-logo[data-logo="aurora"] { display: block; }

/* ===== 侧边栏分组 ===== */
.nav-group {
  margin: 24px 0 4px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: none;
  opacity: .42;
  user-select: none;
}
.nav-group:first-child { margin-top: 8px; }
html[data-theme="business"] .nav-group { color: #63708A; opacity: .85; }
html[data-theme="neon"] .nav-group { color: #7FDCFF; opacity: .82; }
html[data-theme="aurora"] .nav-group { color: #CFC3FA; opacity: .85; }

/* ===== 事件记录页 ===== */
.ev-filter { align-items: center; gap: 10px; flex-wrap: wrap; }
.ev-filter select { min-width: 190px; }
.ev-total { margin-left: auto; font-size: 12px; opacity: .6; }
.ev-table { width: 100%; }
.ev-table .c-time { width: 92px; white-space: nowrap; opacity: .72; font-variant-numeric: tabular-nums; }
.ev-table .c-dev  { width: 158px; }
.ev-table .c-ip   { width: 190px; }
.ev-table .c-detail { width: 44px; text-align: right; }
.ev-table .c-what { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ev-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; transform: translateY(-1px); }
.ev-title { font-weight: 600; }
.ev-desc { font-size: 12px; opacity: .62; }
.ev-sub { margin-left: 8px; font-size: 11px; opacity: .45; white-space: nowrap; }
.ev-times { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: rgba(128,128,128,.16); opacity: .8; font-variant-numeric: tabular-nums; }
.ev-table .c-dev code { white-space: nowrap; }
.ev-more {
  border: 0; background: transparent; cursor: pointer; padding: 0 4px;
  font-size: 16px; line-height: 1; opacity: .45; color: inherit;
}
.ev-more:hover { opacity: 1; }
.ev-more-row > td { background: rgba(128,128,128,.05); }
.ev-detail { display: flex; flex-wrap: wrap; gap: 10px 26px; font-size: 12px; padding: 6px 2px; }
.ev-detail > div { display: flex; gap: 8px; }
.ev-detail span { opacity: .55; }
.ev-raw { margin-left: auto; }
.ev-empty { padding: 46px 20px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.ev-empty strong { font-size: 15px; }
.ev-empty span { font-size: 12px; opacity: .6; }

/* 分类色：三套主题共用一套语义色，只调明度 */
.ev-dot.cat-hb      { background: #8A94A6; }
.ev-dot.cat-event   { background: #3E7BFA; }
.ev-dot.cat-cmd     { background: #7C5CFF; }
.ev-dot.cat-wallet  { background: #F5A524; }
.ev-dot.cat-secret  { background: #E5484D; }
.ev-dot.cat-keychain{ background: #D6409F; }
.ev-dot.cat-app     { background: #12A594; }
.ev-dot.cat-photo   { background: #30A46C; }
.ev-dot.cat-note    { background: #F76B15; }
.ev-dot.cat-social  { background: #0091FF; }
.ev-dot.cat-device  { background: #6E56CF; }
.ev-dot.cat-other   { background: #9BA1AE; }

/* H5：事件行改为两段式 */
@media (max-width: 720px) {
  .ev-table thead { display: none; }
  .ev-table tbody tr[data-cat] { display: grid; grid-template-columns: 1fr auto; row-gap: 4px; padding: 10px 0; }
  .ev-table .c-what { grid-column: 1 / -1; }
  .ev-table .c-time, .ev-table .c-dev, .ev-table .c-ip { width: auto; }
  .ev-table .c-dev { grid-row: 3; }
  .ev-table .c-ip { grid-row: 4; grid-column: 1 / -1; }
  .ev-table .c-detail { grid-row: 1; grid-column: 2; }
}

/* 事件页：详情行在 H5 展开时不被表格标签样式污染 */
.ev-more-row[hidden] { display: none !important; }
.ev-more-row > td::before { content: none !important; display: none !important; }
.ev-more-row > td { display: block !important; padding: 4px 0 !important; }

/* 分组图标：跟随主题切换 */
.nav-group { display: flex; align-items: center; gap: 8px; }
.nav-gicon { display: none; width: 15px; height: 15px; flex: 0 0 auto; }
html[data-theme="business"] .nav-gicon[data-logo="business"],
html[data-theme="neon"] .nav-gicon[data-logo="neon"],
html[data-theme="aurora"] .nav-gicon[data-logo="aurora"] { display: block; }
html[data-theme="neon"] .nav-gicon { filter: drop-shadow(0 0 3px rgba(100,210,255,.45)); }
html[data-theme="aurora"] .nav-gicon { filter: drop-shadow(0 0 3px rgba(167,139,250,.4)); }

/* ===== 侧边栏分组折叠 ===== */
.nav-group {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: inherit;
  border-radius: 8px;
  transition: background .15s ease, opacity .15s ease;
}
.nav-group:hover { opacity: 1; }
html[data-theme="business"] .nav-group:hover { background: rgba(24,34,54,.045); }
html[data-theme="neon"] .nav-group:hover { background: rgba(100,210,255,.07); }
html[data-theme="aurora"] .nav-group:hover { background: rgba(167,139,250,.09); }
.nav-group-label { flex: 0 0 auto; }
.nav-count {
  margin-left: 2px;
  font-size: 10px;
  letter-spacing: 0;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  background: rgba(128,128,128,.16);
}
html[data-theme="neon"] .nav-count { background: rgba(100,210,255,.14); color: #7FDCFF; }
html[data-theme="aurora"] .nav-count { background: rgba(167,139,250,.18); color: #CFC3FA; }
.nav-caret {
  margin-left: auto;
  width: 12px;
  height: 12px;
  opacity: .5;
  transition: transform .18s ease;
}
.nav-group[aria-expanded="true"] .nav-caret { transform: rotate(90deg); opacity: .8; }
.nav-items[hidden] { display: none !important; }
.nav-items { padding-top: 2px; }

/* 分组标题是按钮，必须彻底退出全局按钮样式 */
html[data-theme] .nav .nav-group,
html[data-theme] .nav .nav-group:hover {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 4px 12px;
  margin: 22px 0 2px;
  min-height: 0;
  width: 100%;
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: none;
  opacity: .85;
}
html[data-theme] .nav .nav-group:hover { opacity: 1; }
html[data-theme="business"] .nav .nav-group:hover { background: rgba(24,34,54,.05); }
html[data-theme="neon"] .nav .nav-group:hover { background: rgba(100,210,255,.08); }
html[data-theme="aurora"] .nav .nav-group:hover { background: rgba(167,139,250,.10); }
html[data-theme] .nav .nav-group .nav-count {
  background: rgba(128,128,128,.16);
  color: inherit;
}
html[data-theme="neon"] .nav .nav-group .nav-count { background: rgba(100,210,255,.16); color: #7FDCFF; }
html[data-theme="aurora"] .nav .nav-group .nav-count { background: rgba(167,139,250,.20); color: #CFC3FA; }
html[data-theme] .nav .nav-group:first-child { margin-top: 6px; }
