* { box-sizing: border-box; }
:root {
  --bg: #f4f6fb; --panel: #fff; --ink: #1f2733; --muted: #7a8699;
  --line: #e3e8f0; --brand: #2f6df0; --brand-d: #1f4fb0;
  --ok: #1f9d55; --warn: #e0a106; --danger: #d64545; --chip: #eef2fb;
}
body { margin: 0; font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); }
#app { display: flex; min-height: 100vh; }
#sidebar { width: 210px; background: #0f1b33; color: #cdd6e6; display: flex; flex-direction: column; }
.brand { font-size: 18px; font-weight: 700; padding: 18px 18px 10px; color: #fff; }
.brand span { display: block; font-size: 11px; font-weight: 400; color: #7e8aa6; letter-spacing: 2px; }
#nav { flex: 1; padding: 8px 10px; }
#nav a { display: block; padding: 9px 12px; border-radius: 8px; color: #cdd6e6; text-decoration: none; margin: 2px 0; }
#nav a:hover { background: #1b2b4d; }
#nav a.active { background: var(--brand); color: #fff; }
.side-foot { padding: 12px 16px; border-top: 1px solid #1b2b4d; font-size: 12px; }
#who { color: #9fb0d0; margin-bottom: 6px; }
.link { background: none; border: none; color: #7fa9ff; cursor: pointer; padding: 0; font-size: 12px; }
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
#page-title { font-size: 18px; margin: 0; }
#top-actions { display: flex; gap: 8px; }
/* 底部多留 34px：页面底部固定了一条 ICP 备案号，滚到底时不能压住最后一行内容 */
#view { padding: 22px 24px 34px; overflow: auto; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 24px; font-weight: 700; margin-top: 6px; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.grid th, table.grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
table.grid th { background: #f7f9fd; color: var(--muted); font-weight: 600; }
table.grid tr:hover td { background: #fafcff; }

.btn { background: var(--brand); color: #fff; border: none; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn:hover { background: var(--brand-d); }
.btn.ghost { background: #eef2fb; color: var(--brand); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.section { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 16px; }
.section h3 { margin: 0 0 12px; font-size: 15px; }

.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--chip); color: var(--brand); }
.chip.ok { background: #e6f6ec; color: var(--ok); }
.chip.warn { background: #fdf3da; color: var(--warn); }
.chip.danger { background: #fbe6e6; color: var(--danger); }
.chip.gray { background: #eef1f6; color: var(--muted); }

.modal-mask { position: fixed; inset: 0; background: rgba(15,27,51,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: min(720px, 94vw); max-height: 90vh; overflow: auto; padding: 20px; }
.modal h2 { margin: 0 0 14px; font-size: 17px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 26px; text-align: center; color: var(--muted); background: #fafcff; }
.drop.over { border-color: var(--brand); background: #eef4ff; }
input.bad, .field input.bad { border-color: var(--danger); background: #fff6f6; }

.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #0f1b33; }
.login .box { background: #fff; padding: 28px; border-radius: 14px; width: 320px; }
.login h2 { margin: 0 0 16px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast-i { background: #1f2733; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; }
.toast-i.err { background: var(--danger); }
.toast-i.ok { background: var(--ok); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.bar { height: 8px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.seg-actions button { margin-right: 6px; }
.legend { font-size: 12px; color: var(--muted); margin-top: 8px; }
.hl { background: #fff6d6; }

/* 通用显隐（原先缺失，导致部分元素无法隐藏） */
.hidden { display: none !important; }
