/* ============================================================
   KeyAuth 设计系统
   亮/暗双主题 · 无外部依赖 · 参考 shadcn / Linear 的视觉语言
   ============================================================ */

:root {
  /* 设计语言对齐登录页的「珠光白」：近白底（不是纯白）、极淡描边、
     近黑文字与主色、克制的柔和阴影。
     原 --primary 用 indigo #4F46E5 —— 那正是 Tailwind 作者公开道歉过的
     "AI 生成 UI 默认色"，已换成近黑 #18181B。 */
  --bg: #FAFAFC;
  --surface: #FFFFFF;
  --surface-2: #F7F8FB;
  --surface-3: #F1F3F8;
  --border: #EBEDF2;
  --border-strong: #DADFE8;
  --text: #18181B;
  --text-2: #52525B;
  --text-3: #71717A;
  --primary: #18181B;
  --primary-hover: #2D2D33;
  --primary-soft: #F2F3F6;
  --on-primary: #FFFFFF;
  --success: #15803D;
  --success-soft: #EAF6EE;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --warn: #B45309;
  --warn-soft: #FDF3E3;
  --info: #1D4ED8;
  --info-soft: #EAF0FE;
  --shadow-xs: 0 1px 2px rgba(13, 17, 23, .04);
  --shadow-sm: 0 1px 3px rgba(13, 17, 23, .06), 0 1px 2px rgba(13, 17, 23, .04);
  --shadow: 0 4px 12px rgba(13, 17, 23, .06), 0 1px 3px rgba(13, 17, 23, .04);
  --shadow-lg: 0 20px 44px -18px rgba(13, 17, 23, .13), 0 4px 10px rgba(13, 17, 23, .05);
  --r-xs: 5px;
  --r-sm: 7px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --sidebar-w: 236px;
  --topbar-h: 62px;
  --ease: cubic-bezier(.2, .8, .3, 1);
}

html[data-theme="dark"] {
  /* 深色主题对齐登录页的「极光暮光」：深蓝紫底 + 近白文字，
     主按钮反过来用近白底 + 深色字（和 aurora 登录页一致）。 */
  --bg: #10141F;
  --surface: #171C2A;
  --surface-2: #1D2333;
  --surface-3: #252C3E;
  --border: #272E40;
  --border-strong: #374052;
  --text: #EAF0FF;
  --text-2: #A8B4D0;
  --text-3: #7C88A6;
  --primary: #EAF0FF;
  --primary-hover: #FFFFFF;
  --primary-soft: #1E263A;
  --on-primary: #10141F;
  --success: #6EE7B7;
  --success-soft: #0E2A22;
  --danger: #FDA4AF;
  --danger-soft: #2C161B;
  --warn: #FBBF24;
  --warn-soft: #2A2110;
  --info: #7DD3FC;
  --info-soft: #10233A;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow: 0 4px 14px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .62);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 6px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------------------------------------------------------- 布局 */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 18px 16px 14px; }
.brand-mark {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px;
  background: linear-gradient(140deg, var(--primary), var(--primary-hover));
  display: flex; align-items: center; justify-content: center;
  color: var(--on-primary); box-shadow: 0 4px 14px rgba(13, 17, 23, .22);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-txt b { display: block; font-size: 14.5px; font-weight: 600; letter-spacing: -.2px; }
.brand-txt span { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.nav-group { font-size: 10.5px; font-weight: 500; color: var(--text-3);
  padding: 14px 9px 6px; letter-spacing: .6px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7.5px 10px;
  border-radius: var(--r-sm); color: var(--text-2); cursor: pointer;
  user-select: none; font-size: 13.5px; margin-bottom: 1px;
  transition: background .12s, color .12s;
}
.nav-item svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .8; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.nav-item.active svg { opacity: 1; }
.nav-item .count {
  margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: 20px;
  background: var(--surface-3); color: var(--text-3); font-variant-numeric: tabular-nums;
}
.nav-item.active .count { background: rgba(127, 127, 127, .14); color: var(--primary); }

.side-foot { border-top: 1px solid var(--border); padding: 11px 12px; display: flex; flex-direction: column; gap: 7px; }
.conn { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); padding: 0 3px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: 0 0 7px; }
.dot.on { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 15.5px; font-weight: 600; margin: 0; letter-spacing: -.2px; }
.topbar .sub { font-size: 11.5px; color: var(--text-3); margin-top: -2px; }
/* 顶栏右下角的身份块：用户名 + 角色 */
.who { display: flex; align-items: center; gap: 7px; max-width: 260px; }
.who .uname {
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.who .urole {
  font-size: 11px; color: var(--text-3); line-height: 1.5;
  border: 1px solid var(--border); border-radius: 20px; padding: 0 7px;
  white-space: nowrap;
}
.spacer { flex: 1; }
.content { padding: 20px 22px 70px; width: 100%; max-width: 1420px; }
.hamburger { display: none !important; }

/* ---------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 33px; padding: 0 13px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s, box-shadow .12s, color .12s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.btn svg { width: 14px; height: 14px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-xs); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.kbar {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-2); font: 500 13px/1 inherit; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.kbar:hover { border-color: var(--border-strong); color: var(--text); }
.kbar svg { width: 15px; height: 15px; flex: none; }
.kbar kbd {
  font: 500 10.5px/1 ui-monospace, monospace;
  color: var(--text-3);
  background: var(--surface-3);
  padding: 3px 5px; border-radius: 4px;
}

.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn.sm svg { width: 12.5px; height: 12.5px; }
.btn.icon { width: 33px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------- 表单 */
.field { display: flex; flex-direction: column; min-width: 0; }
.field > label { font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

input[type=text], input[type=number], input[type=password], input[type=url],
select, textarea {
  width: 100%; height: 33px; padding: 0 10px; font: inherit; font-size: 13px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input:disabled, select:disabled { background: var(--surface-3); color: var(--text-3); }
select {
  appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888f9e' stroke-width='2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center;
}
.grid { display: grid; gap: 13px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input { display: none; }
.switch .track {
  width: 36px; height: 20px; border-radius: 20px; background: var(--border-strong);
  position: relative; transition: background .16s; flex: 0 0 36px;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .16s var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }

.check { display: flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-size: 12.5px; color: var(--text-2); }
input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; margin: 0; }

/* ---------------------------------------------------------- 卡片 */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 17px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 13.5px; font-weight: 600; margin: 0; }
.card-head .desc { font-size: 12px; color: var(--text-3); }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 17px; }
.card-body.tight { padding: 15px 17px 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 13px; margin-bottom: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 15px 16px; box-shadow: var(--shadow-xs);
  transition: box-shadow .16s, transform .16s var(--ease);
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.stat .lbl { font-size: 12.5px; color: var(--text-2); }
.stat .val { font-size: 26px; font-weight: 600; letter-spacing: -.7px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .foot { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.ico { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 30px; }
.ico svg { width: 15px; height: 15px; }
.i-primary { background: var(--primary-soft); color: var(--primary); }
.i-success { background: var(--success-soft); color: var(--success); }
.i-danger { background: var(--danger-soft); color: var(--danger); }
.i-warn { background: var(--warn-soft); color: var(--warn); }
.i-info { background: var(--info-soft); color: var(--info); }

/* ---------------------------------------------------------- 表格 */
.tw { overflow-x: auto; }
/* 长列表（卡密库 / 校验日志 / 操作审计）在表格内部滚动，表头吸顶。
   这三张表一次渲染 50~300 行，不限高会把整页拉到上万像素，翻页要滚到底才点得到。 */
.tw.tall { max-height: 62vh; overflow: auto; }
.tw.tall thead th { position: sticky; top: 0; z-index: 2; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 14px; white-space: nowrap; border-bottom: 1px solid var(--border); }
th { font-size: 11.5px; font-weight: 500; color: var(--text-3); background: var(--surface-2); letter-spacing: .2px; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.row-click { cursor: pointer; }
tbody tr.row-click:hover { background: var(--surface-3); }
tbody tr:last-child td { border-bottom: none; }
td.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
td.dim { color: var(--text-3); }
td.right, th.right { text-align: right; }

.copy-cell { display: inline-flex; align-items: center; gap: 6px; }
.copy-btn {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
.copy-btn svg { width: 11.5px; height: 11.5px; }
tr:hover .copy-btn, .copy-btn.always { opacity: 1; }
.copy-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }

/* ---------------------------------------------------------- 徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px;
  border-radius: 20px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.plain::before { display: none; }
.b-success { background: var(--success-soft); color: var(--success); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-primary { background: var(--primary-soft); color: var(--primary); }
.b-gray { background: var(--surface-3); color: var(--text-2); }

/* ---------------------------------------------------------- 工具条 */
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 170px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }
.search input { padding-left: 31px; }

.pager { display: flex; align-items: center; gap: 9px; padding: 12px 17px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }

/* ---------------------------------------------------------- 下拉菜单 */
/* fixed 而不是 absolute：openMenu 用的是 getBoundingClientRect() 的视口坐标，
   若用 absolute 会相对文档定位，页面一滚动菜单就跑到别处，看着像「点不开」。 */
.menu {
  position: fixed; z-index: 200; min-width: 172px; padding: 5px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  animation: pop .12s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.985); } to { opacity: 1; transform: none; } }
.menu-item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.menu-item svg { width: 13.5px; height: 13.5px; opacity: .7; }
.menu-item:hover { background: var(--surface-3); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }

/* ---------------------------------------------------------- 弹窗 / 抽屉 */
.mask {
  position: fixed; inset: 0; z-index: 300; padding: 20px;
  background: rgba(10, 12, 18, .46); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 540px; max-height: 88vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); animation: rise .17s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 14.5px; font-weight: 600; margin: 0; }
.modal-body { padding: 17px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 13px 17px; border-top: 1px solid var(--border); background: var(--surface-2); }
.x-btn { margin-left: auto; width: 28px; height: 28px; border: none; background: transparent; color: var(--text-3); cursor: pointer; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.x-btn:hover { background: var(--surface-3); color: var(--text); }

.drawer-mask { position: fixed; inset: 0; z-index: 300; background: rgba(10, 12, 18, .42); backdrop-filter: blur(2px); animation: fade .14s ease-out; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 94vw); z-index: 301;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slideIn .2s var(--ease);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { font-size: 14.5px; font-weight: 600; margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------------------------------------------------------- Toast */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 400; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 9px; padding: 11px 14px; min-width: 240px; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
  box-shadow: var(--shadow-lg); font-size: 13px; pointer-events: auto;
  animation: slideIn .18s var(--ease);
}
.toast.out { animation: slideOut .18s ease-in forwards; }
@keyframes slideOut { to { opacity: 0; transform: translateX(16px); } }
.toast svg { width: 17px; height: 17px; flex: 0 0 17px; margin-top: 1px; }
.toast .body { min-width: 0; word-break: break-word; }

/* ---------------------------------------------------------- 图表 */
.bar-chart { display: flex; align-items: flex-end; gap: 9px; height: 158px; padding: 4px 2px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-col .v { font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bar-col .l { font-size: 11px; color: var(--text-3); }
.bar {
  width: 100%; max-width: 42px; min-height: 3px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--primary), var(--primary-hover));
  transition: height .55s var(--ease), opacity .15s;
}
.bar-col:hover .bar { opacity: .82; }

.progress { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
.dist-row { margin-bottom: 13px; }
.dist-row .line { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.dist-row .line span:last-child { color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- 其他 */
.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; align-items: start; }
.split-even { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.page { display: none; animation: fade .16s ease-out; }
.page.active { display: block; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty svg { width: 40px; height: 40px; opacity: .32; margin-bottom: 10px; }
.empty p { margin: 0; font-size: 13px; color: var(--text-2); }
.empty .sm { font-size: 12px; margin-top: 4px; }

/* 顶部条：弱令牌提醒等 */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin-bottom: 14px;
  border: 1px solid var(--warn); border-radius: var(--r);
  background: var(--warn-soft); color: var(--text);
  font-size: 13px;
}
.banner > svg { width: 17px; height: 17px; flex: none; color: var(--warn); }
.banner b { margin-right: 6px; }
.banner span { color: var(--text-2); }
/* 制卡页右侧还没生成结果时，别让空态把半屏都占了 */
.empty-tight { padding: 26px 16px; }
.empty-tight svg { width: 30px; height: 30px; margin-bottom: 7px; }

pre {
  margin: 0; padding: 14px; border-radius: var(--r); overflow: auto; max-height: 540px;
  background: #0D1117; color: #D6DEEB; border: 1px solid #1F2532;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.65;
}
html[data-theme="dark"] pre { background: #090B10; border-color: #202634; }
code.inline {
  padding: 1.5px 5px; border-radius: 5px; font-size: 12px;
  background: var(--surface-3); border: 1px solid var(--border);
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.kv { display: grid; grid-template-columns: 108px 1fr; gap: 9px 14px; font-size: 13px; margin: 0; }
.kv dt { color: var(--text-2); font-size: 12.5px; }
.kv dd { margin: 0; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); padding: 0 4px; overflow-x: auto; }
.tab { padding: 8px 13px; font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .12s, border-color .12s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

.bulk {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 250;
  display: flex; align-items: center; gap: 9px; padding: 9px 11px 9px 15px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 999px; box-shadow: var(--shadow-lg); animation: rise .18s var(--ease);
}
.bulk .n { font-size: 13px; font-weight: 500; color: var(--primary); white-space: nowrap; }
.bulk .sep { width: 1px; height: 20px; background: var(--border); }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(316px, 1fr)); gap: 14px; }
.app-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-xs); transition: box-shadow .16s, transform .16s var(--ease); }
.app-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.app-card .h { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.app-card .h b { font-size: 14px; font-weight: 600; }
.app-card .h .badge { margin-left: auto; }
.app-card .row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.app-card .row .k { color: var(--text-3); width: 66px; flex: 0 0 66px; }
.app-card .row .v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; }
.app-card .foot { display: flex; gap: 7px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--border); flex-wrap: wrap; }

.notice { padding: 11px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; margin-bottom: 10px; }
.notice.info { border-left: 3px solid var(--info); }
.notice.warn { border-left: 3px solid var(--warn); }
.notice.danger { border-left: 3px solid var(--danger); }
.notice b { display: block; margin-bottom: 3px; }

.sec-title { font-size: 11.5px; font-weight: 500; color: var(--text-3); margin: 0 0 9px; letter-spacing: .3px; text-transform: uppercase; }
.divider { height: 1px; background: var(--border); margin: 17px 0; }

@media (max-width: 1000px) {
  .split, .split-even { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: calc(-1 * var(--sidebar-w) - 10px); transition: left .2s var(--ease); }
  .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
  .hamburger { display: inline-flex !important; }
  .content { padding: 15px 13px 70px; }
  .topbar { padding: 0 13px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
