* { box-sizing: border-box; }
body { margin: 0; background: #f4f6fa; color: #1f2937; font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", Arial, sans-serif; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { display: flex; align-items: center; gap: 18px; background: #0f172a; color: #fff; padding: 0 18px; height: 54px; position: sticky; top: 0; z-index: 20; }
.topbar .brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.topbar .nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.topbar .nav a { color: #cbd5e1; padding: 6px 12px; border-radius: 6px; white-space: nowrap; font-size: 14px; }
.topbar .nav a.on, .topbar .nav a:hover { background: #1d4ed8; color: #fff; text-decoration: none; }
.topbar .user { font-size: 13px; color: #cbd5e1; display: flex; align-items: center; gap: 8px; }
.wrap { max-width: 1180px; margin: 18px auto 40px; padding: 0 14px; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card h2 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card h2 .tip { font-size: 12px; color: #6b7280; font-weight: 400; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.col { flex: 1 1 220px; min-width: 200px; }
label { display: block; font-size: 13px; color: #374151; margin-bottom: 4px; }
input[type=text], input[type=password], select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; background: #fff; font-family: inherit; }
textarea { min-height: 130px; line-height: 1.7; font-family: ui-monospace, Menlo, Consolas, monospace; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; border: 1px solid transparent; background: #2563eb; color: #fff; cursor: pointer; font-size: 14px; }
.btn:hover { background: #1d4ed8; text-decoration: none; }
.btn.gray { background: #fff; color: #374151; border-color: #d1d5db; }
.btn.gray:hover { background: #f3f4f6; }
.btn.green { background: #059669; } .btn.green:hover { background: #047857; }
.btn.danger { background: #dc2626; } .btn.danger:hover { background: #b91c1c; }
.btn-mini { display: inline-block; padding: 3px 9px; font-size: 12px; border-radius: 5px; border: 1px solid #d1d5db; background: #fff; color: #374151; cursor: pointer; }
.btn-mini:hover { background: #f3f4f6; text-decoration: none; }
.btn-mini.danger { color: #b91c1c; border-color: #fca5a5; }
.btn-mini.ok { color: #047857; border-color: #6ee7b7; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid #eef2f7; padding: 8px 8px; text-align: left; vertical-align: middle; }
th { background: #f8fafc; color: #475569; font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #f9fbff; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; border: 1px solid #d1d5db; background: #f8fafc; color: #475569; }
.st-wait { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.st-sent { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.st-ok   { background: #ecfdf5; color: #047857; border-color: #6ee7b7; }
.st-fail { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.on-line { color: #047857; font-weight: 600; }
.off-line { color: #9ca3af; }
.flash { background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.err { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.stats { display: flex; flex-wrap: wrap; gap: 12px; }
.stat { flex: 1 1 130px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; color: #0f172a; }
.stat span { font-size: 12px; color: #6b7280; }
.foot { text-align: center; color: #94a3b8; font-size: 12px; padding: 14px; }
.hint { font-size: 12px; color: #6b7280; margin-top: 6px; }
.err { color: #b91c1c; }
.login-box { max-width: 380px; margin: 8vh auto; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.filters .f { min-width: 150px; }
.filters input, .filters select { padding: 7px 9px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.empty { text-align: center; color: #9ca3af; padding: 22px; }
.scroll { overflow-x: auto; }
/* 固件版本状态颜色 */
.tag.fw-ok { background: #ecfdf5; color: #047857; border-color: #6ee7b7; font-weight: 600; }
.tag.fw-old { background: #fff7ed; color: #c2410c; border-color: #fdba74; font-weight: 600; }
.tag.fw-new { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.tag.fw-unknown { background: #f8fafc; color: #94a3b8; border-color: #e2e8f0; }
tr.row-old td { background: #fffdf7; }
tr.row-old.host-row td { background: #fff9ef; }
.fw-legend { display: inline-flex; gap: 10px; align-items: center; font-size: 12px; color: #6b7280; margin-left: 6px; }

/* 设备库树状视图 */
.tg { display: inline-block; width: 17px; height: 17px; line-height: 15px; text-align: center; border: 1px solid #cbd5e1; border-radius: 3px; background: #fff; color: #334155; font-weight: 700; cursor: pointer; user-select: none; font-size: 13px; }
.tg:hover { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.tree-branch { color: #94a3b8; margin-right: 1px; }
tr.host-row td { background: #f8fafc; }
tr.host-row td:first-child { border-left: 3px solid #2563eb; }
tr.child-row td:nth-child(2) { padding-left: 18px; }