/* KingWai 文件协作 —— 自有品牌门户（无第三方框架/字体/图标） */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #1c2333;
  --ink-2: #5b6478;
  --line: #e3e7ef;
  --brand: #2563eb;
  --brand-ink: #1e4fc4;
  --brand-soft: #e8f0fe;
  --side: #101a33;
  --side-ink: #c4cbe0;
  --ok: #0e9f6e;
  --warn: #c27803;
  --bad: #d92d20;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg);
  font-size: 14px; line-height: 1.55;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
code { font-family: var(--mono); font-size: 12px; background: #f0f2f7; padding: 1px 5px; border-radius: 4px; }

/* ---------- 布局 ---------- */
#app { display: none; min-height: 100vh; }
#app.on { display: flex; }
.sidebar {
  width: 220px; flex: none; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 14px 10px; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 16px; }
.brand img { width: 30px; height: 30px; }
.brand .t1 { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .5px; }
.brand .t2 { font-size: 11px; color: #8d97b5; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  border: 0; background: none; color: var(--side-ink); width: 100%; text-align: left; font-size: 14px;
}
.nav-btn .ic { width: 18px; text-align: center; opacity: .9; }
.nav-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-btn.active { background: var(--brand); color: #fff; }
.sidebar .spacer { flex: 1; }
.side-note { font-size: 11px; color: #737d9c; padding: 10px 12px; line-height: 1.5; border-top: 1px solid #232e52; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 22px;
  display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 5;
}
.topbar .crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar .crumbs .sep { color: #9aa3b8; }
.userbox { display: flex; align-items: center; gap: 10px; }
.userbox .uname { font-weight: 600; }
.userbox .urole { font-size: 11px; color: var(--ink-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.content { padding: 20px 22px; max-width: 1200px; width: 100%; }

/* ---------- 通用 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 6px 14px;
}
.btn:hover { border-color: #c9cfdd; background: #f8fafd; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.danger { color: var(--bad); border-color: #f3b9b3; }
.btn.danger:hover { background: #fdf1f0; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; border-radius: 6px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.spacer { flex: 1; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }

table.grid { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.grid th {
  text-align: left; font-size: 12px; color: var(--ink-2); font-weight: 600;
  padding: 9px 12px; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.grid td { padding: 9px 12px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr:hover td { background: #fafbfe; }
.fname { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fname .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.fic { width: 20px; text-align: center; flex: none; }
.rowacts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 1px 9px; font-size: 11.5px; white-space: nowrap; }
.badge.lease { background: #fdf3e2; color: #9a6700; }
.badge.dir { background: #eef2ff; color: #4f46e5; }
.badge.ok { background: #e5f6ef; color: var(--ok); }
.badge.bad { background: #fdeceb; color: var(--bad); }
.badge.gray { background: #eef1f6; color: var(--ink-2); }

/* ---------- 登录 ---------- */
#login {
  display: none; min-height: 100vh; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0e1730 0%, #1b2a55 55%, #2151d8 130%);
}
#login.on { display: flex; }
.login-card { width: 400px; background: #fff; border-radius: 14px; padding: 34px 34px 26px; box-shadow: 0 24px 60px rgba(8,15,40,.45); }
.login-card .brand { padding: 0 0 6px; color: var(--ink); }
.login-card .brand .t2 { color: var(--ink-2); }
.login-card h1 { font-size: 19px; margin: 4px 0 4px; }
.login-card .sub { color: var(--ink-2); font-size: 12.5px; margin-bottom: 18px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; background: #fff;
}
.field input:focus { outline: 2px solid #bcd3fb; border-color: var(--brand); }
.login-note { font-size: 11.5px; color: var(--ink-2); margin-top: 16px; line-height: 1.6; border-top: 1px dashed var(--line); padding-top: 12px; }

/* ---------- 弹窗 / 提示 ---------- */
#modal-root { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(15,23,42,.45); z-index: 50; }
#modal-root.on { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: calc(100vw - 40px); max-height: 86vh; overflow: auto; padding: 22px; }
.modal h3 { margin: 0 0 4px; font-size: 16px; }
.modal .sub { color: var(--ink-2); font-size: 12.5px; margin-bottom: 14px; }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
#toasts { position: fixed; right: 18px; top: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #111827; color: #fff; border-radius: 9px; padding: 10px 16px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 420px; animation: slidein .18s ease;
}
.toast.err { background: #7f1d1d; }
.toast.ok { background: #065f46; }
@keyframes slidein { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

.progress { height: 8px; background: #e8ecf3; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); transition: width .15s; }
.upitem { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; }
.upitem .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; word-break: break-all; }

.section-title { font-size: 13px; font-weight: 700; margin: 22px 0 10px; color: var(--ink); }
.empty { text-align: center; color: var(--ink-2); padding: 42px 10px; }
.capgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 13px; }
.capgrid .no { color: var(--bad); }
.capgrid .yes { color: var(--ok); }
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filterbar input, .filterbar select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: #fff; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { padding: 14px; }
}
