:root {
  --bg: #f5f6f8; --card: #fff; --border: #e8eaee;
  --text: #1f2329; --muted: #8a919c;
  --accent: #4f46e5; --accent-soft: #eef0ff;
  --green: #22a06b; --yellow: #e8a23d; --red: #e5484d; --gray: #c2c7ce;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.07);
  --shadow-lg: 0 8px 24px rgba(16,24,40,.12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system,"Segoe UI","Microsoft YaHei","PingFang SC",sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }
.hidden { display: none !important; }

/* ============ 解锁页 ============ */
#unlock {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eef0ff 0%, #f5f6f8 55%, #f0f4ff 100%);
}
.unlock-card {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 40px 44px; width: 400px; text-align: center;
}
.unlock-ico { font-size: 40px; margin-bottom: 12px; }
.unlock-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.unlock-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.pin-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 22px; }
.pin-box {
  width: 46px; height: 54px; border: 1.5px solid var(--border); border-radius: 10px;
  text-align: center; font-size: 22px; font-weight: 700; outline: none;
  transition: border .12s, box-shadow .12s;
}
.pin-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pin-box.filled { border-color: #c9cdf7; }
.btn-primary {
  width: 100%; background: var(--accent); color: #fff; border: none; border-radius: 10px;
  padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer; transition: background .12s;
}
.btn-primary:hover { background: #4338ca; }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-ghost {
  background: #f2f3f6; color: #3a3f47; border: none; border-radius: 10px;
  padding: 10px 14px; font-size: 13px; cursor: pointer; transition: background .12s;
}
.btn-ghost:hover { background: #e8eaee; }
.unlock-hint { margin-top: 16px; font-size: 12px; color: var(--muted); }
.unlock-hint a { color: var(--accent); cursor: pointer; text-decoration: none; }
.err { color: var(--red); font-size: 12px; margin-bottom: 12px; min-height: 16px; }
.warn-banner {
  background: #fff7e6; border: 1px solid #ffe0a8; border-radius: 10px;
  padding: 10px 14px; font-size: 12px; color: #8a6100; text-align: left; margin-bottom: 18px;
}

/* ============ 主应用 ============ */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 20px; flex-shrink: 0;
}
.logo { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  padding: 8px 14px; border-radius: 8px; cursor: pointer; color: #5b616b;
  display: flex; align-items: center; gap: 6px; font-weight: 500; border: none; background: none; font-size: 14px;
}
.tab:hover { background: #f2f3f6; }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tab .badge {
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.btn-add {
  background: var(--accent); color: #fff; border: none; border-radius: 9px; padding: 9px 15px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-add:hover { background: #4338ca; }
.btn-icon { background: none; border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; cursor: pointer; font-size: 14px; }
.btn-icon:hover { background: #f2f3f6; }

.body { display: flex; flex: 1; overflow: hidden; }

/* 侧栏 */
.sidebar {
  width: 216px; background: var(--card); border-right: 1px solid var(--border);
  padding: 16px 12px; flex-shrink: 0; overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; color: #3a3f47; margin-bottom: 2px; font-size: 14px;
}
.nav-item:hover { background: #f2f3f6; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .ico { width: 20px; text-align: center; }
.nav-item .label { flex: 1; }
.nav-item .count { background: #eef0f2; color: #5b616b; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; }
.nav-item.active .count { background: var(--accent); color: #fff; }

/* 内容区 */
.content { flex: 1; padding: 22px 30px 48px; overflow-y: auto; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.page-head h2 { font-size: 18px; font-weight: 700; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.search-wrap { position: relative; margin-left: auto; width: 300px; }
.search-wrap input {
  width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--border); border-radius: 9px; font-size: 13px; outline: none;
}
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-wrap .mag { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* 资产卡片 */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 15px 18px; margin-bottom: 11px; box-shadow: var(--shadow); cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.card.open { box-shadow: var(--shadow-lg); border-color: #d6d9ff; }
.card-head { display: flex; align-items: center; gap: 12px; }
.card-ico { width: 40px; height: 40px; border-radius: 10px; background: #f2f3f6; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.card-title { flex: 1; min-width: 0; }
.card-title .name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title .meta { color: var(--muted); font-size: 12px; margin-top: 1px; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 6px; background: #f2f3f6; color: #5b616b; font-weight: 500; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.s-normal { background: var(--green); } .s-expiring { background: var(--yellow); }
.s-expired { background: var(--red); } .s-disabled { background: var(--gray); }
.status-label { font-size: 12px; color: var(--muted); margin-left: 6px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-left: 52px; }
.card-tags .tag { background: var(--accent-soft); color: var(--accent); font-size: 11px; padding: 1px 8px; border-radius: 6px; font-weight: 500; }
.card-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-left: 52px; }
.chip { background: #f7f8fa; border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; font-size: 12px; color: #3a3f47; display: flex; align-items: center; gap: 6px; }
.chip .k { color: var(--muted); }
.chip .v { font-family: "SF Mono", Consolas, monospace; font-weight: 500; }
.detail { display: none; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--border); }
.card.open .detail { display: block; }
.field-row { display: flex; align-items: center; padding: 6px 0; gap: 12px; }
.field-row .fl { width: 90px; color: var(--muted); font-size: 12px; flex-shrink: 0; display: flex; align-items: center; gap: 5px; }
.field-row .fv { flex: 1; font-family: "SF Mono", Consolas, monospace; font-size: 13px; display: flex; align-items: center; gap: 8px; word-break: break-all; }
.field-row .fv.note { font-family: inherit; color: #5b616b; }
.field-row .fv a { color: var(--accent); text-decoration: none; }
.secret-badge { font-size: 10px; background: #fdeaea; color: #c0392b; padding: 0 6px; border-radius: 4px; font-weight: 600; }
.eye, .copy { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 13px; padding: 2px 6px; border-radius: 6px; }
.eye:hover, .copy:hover { background: #f2f3f6; color: var(--accent); }
.mono-secret { letter-spacing: 1px; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* AI 审批 */
.risk-banner {
  background: #fff7e6; border: 1px solid #ffe0a8; border-radius: 12px; padding: 14px 18px;
  margin-bottom: 18px; display: flex; gap: 12px; align-items: flex-start;
}
.risk-banner .w-ico { font-size: 20px; }
.risk-banner .w-txt { font-size: 13px; color: #7a5a00; }
.risk-banner .w-txt b { color: #6b4e00; }
.req-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.req-head { display: flex; align-items: center; gap: 12px; }
.req-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.req-title { flex: 1; }
.req-title .t { font-weight: 600; font-size: 14px; }
.req-title .m { color: var(--muted); font-size: 12px; margin-top: 2px; }
.req-actions { display: flex; gap: 8px; }
.btn-approve { background: var(--green); color: #fff; border: none; border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-approve:hover { background: #1a8a58; }
.btn-reject { background: #fdeaea; color: #c0392b; border: none; border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-reject:hover { background: #f9d2d2; }
.req-preview { display: none; margin-top: 14px; padding: 14px; background: #fafbfc; border: 1px solid var(--border); border-radius: 10px; }
.req-card.open .req-preview { display: block; }
.preview-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.preview-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.preview-table td { padding: 6px 8px; border-bottom: 1px solid #f0f1f3; }
.preview-table .pv-secret { color: #c0392b; font-family: monospace; }
.batch-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.btn-approve-all { background: var(--accent); color: #fff; border: none; border-radius: 9px; padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-approve-all:hover { background: #4338ca; }
.btn-approve-all:disabled { opacity: .45; cursor: default; }

/* 设置 */
.setting-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow); }
.setting-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.setting-card .desc { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.setting-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid #f0f1f3; }
.setting-row:first-of-type { border-top: none; }
.setting-row .label { flex: 1; }
.setting-row .label .t { font-weight: 500; }
.setting-row .label .d { color: var(--muted); font-size: 12px; }
.token-box { font-family: "SF Mono", Consolas, monospace; font-size: 12px; background: #f7f8fa; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; word-break: break-all; }
.switch { position: relative; width: 40px; height: 22px; background: #d5d8de; border-radius: 11px; cursor: pointer; transition: background .15s; flex-shrink: 0; }
.switch.on { background: var(--green); }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on::after { left: 20px; }

/* 模态框 */
.modal-mask { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 560px; max-height: 86vh; display: flex; flex-direction: column; }
.modal-head { padding: 20px 24px 12px; font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 24px; overflow-y: auto; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; color: #5b616b; margin-bottom: 6px; font-weight: 500; }
.form-row input, .form-row select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 13px; outline: none; background: #fff;
}
.form-row input:focus, .form-row select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-edit { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.field-edit .fe-label { width: 90px; flex-shrink: 0; }
.field-edit input { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; }
.field-edit input:focus { border-color: var(--accent); }
.field-edit .fe-secret { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.fe-del { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 14px; }
.fe-del:hover { color: var(--red); }
.add-field-link { color: var(--accent); cursor: pointer; font-size: 13px; font-weight: 500; }
.cat-edit-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f1f3; }
.cat-edit-row .cat-ico { width: 28px; text-align: center; font-size: 16px; }
.cat-edit-row .cat-name { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; }
.cat-edit-row .cat-name:focus { border-color: var(--accent); }
.cat-move { display: flex; gap: 2px; }
.cat-move button { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; color: #5b616b; font-size: 12px; }
.cat-move button:hover { background: #f2f3f6; }
.cat-del { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 14px; }
.cat-del:hover { color: var(--red); }
.modal-foot { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--border); }

/* ============ 补充（沿用设计风格） ============ */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1f2329; color: #fff; font-size: 13px; padding: 9px 16px;
  border-radius: 9px; box-shadow: var(--shadow-lg); z-index: 200; max-width: 80vw;
}
.toast.error { background: var(--red); }
.detail-actions { justify-content: flex-end; gap: 8px; margin-top: 10px; }
.detail-actions .btn-ghost { padding: 6px 12px; }
