:root {
  --bg: #f4f7f5;
  --panel: #ffffff;
  --ink: #0f1f1a;
  --muted: #6b7c74;
  --line: #e3eae6;
  --brand: #1b7a4b;
  --brand-soft: #e8f5ee;
  --warn: #b45309;
  --danger: #c2410c;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, #dcf0e5 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #e6f2ea 0%, transparent 55%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px 28px;
  box-shadow: 0 24px 60px -30px rgba(16, 60, 40, .35);
}

.login-card h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.3px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 26px; line-height: 1.6; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(27, 122, 75, .12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #c8d6ce; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #15643e; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f0d6cc; background: #fff7f4; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

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

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: #10301f;
  color: #cfe3d8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 22px 20px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: .2px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand small { display: block; font-weight: 400; font-size: 11px; color: #8fb3a2; margin-top: 4px; letter-spacing: .4px; }

.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #cfe3d8;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .6; }

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

.topbar {
  height: 60px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h2 { font-size: 15px; margin: 0; font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

.content { padding: 22px 24px 48px; }

/* ---------- 卡片与表格 ---------- */
.grid { display: grid; gap: 14px; }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card .label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.card .value { font-size: 26px; font-weight: 600; letter-spacing: -.5px; }
.card .hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-head .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-body { padding: 16px 20px; }
.panel-body.flush { padding: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; font-size: 13px; border-bottom: 1px solid #eef3f0; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: #fafcfb; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfdfc; }
td .mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: #375446; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--brand-soft);
  color: var(--brand);
  white-space: nowrap;
}
.tag.grey { background: #eff2f0; color: #64748b; }
.tag.warn { background: #fef3e2; color: var(--warn); }
.tag.danger { background: #fdecec; color: var(--danger); }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13px; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* 审计日志关键信息标签 */
.kvchip {
  display: inline-block;
  padding: 3px 9px;
  margin: 2px 6px 2px 0;
  border-radius: 8px;
  background: #f2f7f4;
  color: #4a6456;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}
.kvchip b { color: #10301f; font-weight: 600; }

/* 右上角账号区 */
.user-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s;
}
.user-chip:hover { border-color: #c8d6ce; }
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.user-chip .uinfo { display: flex; flex-direction: column; line-height: 1.25; }
.user-chip .uinfo b { font-size: 13px; font-weight: 600; color: var(--ink); }
.user-chip .uinfo small { font-size: 11px; color: var(--muted); }
.user-chip .caret { color: #94a3b8; font-size: 10px; margin-left: 2px; }

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 40px -18px rgba(16, 48, 31, .35);
  padding: 6px;
  display: none;
  z-index: 120;
}
.user-menu.show { display: block; }
.um-item { padding: 9px 12px; border-radius: 8px; font-size: 13px; color: #22392e; cursor: pointer; }
.um-item:hover { background: #f2f8f5; }
.um-item.danger { color: var(--danger); }
.um-sep { height: 1px; background: var(--line); margin: 5px 8px; }

.profile-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid #eef3f0; font-size: 13px; }
.profile-row:last-child { border-bottom: none; }
.profile-row span { color: var(--muted); }

/* 分类选择器 */
.cat-picker { position: relative; }
.cat-list {
  display: none;
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}
.cat-item:hover { background: #f2f8f5; }
.cat-item.parent { color: #64748b; }
.cat-badge {
  font-size: 11px;
  color: #94a3b8;
  background: #f1f5f3;
  padding: 1px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
.cat-empty { padding: 12px; color: #94a3b8; font-size: 12px; text-align: center; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%) translateY(12px);
  background: #10301f;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all .22s;
  z-index: 999;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #8a2b12; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 31, 26, .38);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.45); overflow: hidden;
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-body { padding: 20px 22px; max-height: 62vh; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 文档页 ---------- */
.doc { max-width: 1000px; margin: 0 auto; padding: 40px 24px 80px; }
.doc h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -.5px; }
.doc .lead { color: var(--muted); line-height: 1.8; margin-bottom: 32px; }
.doc h2 { font-size: 17px; margin: 34px 0 12px; }
.doc p { line-height: 1.8; color: #33463d; }
pre.code {
  background: #0f1f1a; color: #cfe3d8; padding: 16px 18px; border-radius: 12px;
  overflow-x: auto; font-size: 12.5px; line-height: 1.7;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.api-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; background: #fff; }
.api-item .row1 { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.method { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); letter-spacing: .5px; }
.api-item .path { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.api-item .desc { color: var(--muted); font-size: 12.5px; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
}
