* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; font-size: 14px; color: #1f2329; background: #f3f5f9; }
a { color: #1677ff; text-decoration: none; }
button { font-family: inherit; }

/* ---------- 顶部导航 ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: 60px; z-index: 1000; display: flex; align-items: center;
  padding: 0 24px; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: #1677ff; white-space: nowrap; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #1677ff, #36cfc9);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.nav { display: flex; height: 100%; margin-left: auto; }
.nav a { display: flex; align-items: center; white-space: nowrap; padding: 0 22px; color: #333; font-size: 15px; height: 100%; border-bottom: 3px solid transparent; }
.nav a:hover { color: #1677ff; }
.nav a.active { color: #1677ff; background: #f0f6ff; border-bottom-color: #1677ff; font-weight: 600; }
.user { margin-left: 28px; padding-left: 20px; border-left: 1px solid #e5e6eb; color: #555; white-space: nowrap; }
.user a { margin-left: 10px; color: #888; }
.main { padding: 76px 16px 16px; min-height: 100%; }

/* ---------- 通用组件 ---------- */
.card { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; padding-left: 10px; border-left: 4px solid #1677ff; line-height: 1.1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 34px; padding: 0 16px;
  border-radius: 4px; border: 1px solid #d9d9d9; background: #fff; color: #333; cursor: pointer; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: #1677ff; color: #1677ff; }
.btn-primary { background: #1677ff; border-color: #1677ff; color: #fff; }
.btn-primary:hover { background: #4096ff; color: #fff; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-link { border: none; background: none; color: #1677ff; cursor: pointer; padding: 0 4px; font-size: 14px; }
.input, .select { height: 34px; padding: 0 10px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px; background: #fff; min-width: 180px; color: #333; }
.input:focus, .select:focus { outline: none; border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22, 119, 255, .12); }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.toolbar .sep { color: #888; }
.table { width: 100%; border-collapse: collapse; }
.table th { background: #f2f6fc; color: #333; font-weight: 600; }
.table th, .table td { padding: 12px 10px; border-bottom: 1px solid #edf0f5; text-align: center; font-size: 14px; }
.table tbody tr:hover { background: #fafcff; }
.empty { text-align: center; color: #999; padding: 48px 0; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 12px; border: 1px solid; }
.tag-在线, .tag-已处理, .tag-已开通, .tag-已激活 { color: #00a870; border-color: #a6e3c8; background: #e8f8f1; }
.tag-离线, .tag-未处理 { color: #e34d59; border-color: #f8b9be; background: #fdecee; }
.tag-未注册, .tag-未开通, .tag-未激活 { color: #888; border-color: #ddd; background: #f5f5f5; }
.tag-处理中 { color: #ed7b2f; border-color: #f9c9a4; background: #fef3e6; }
.tag-op { color: #1677ff; border-color: #91caff; background: #f0f6ff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; background: #bbb; }
.dot-在线 { background: #00c48c; } .dot-离线 { background: #e34d59; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 16px; color: #666; }
.pager a, .pager span.cur { min-width: 28px; height: 28px; line-height: 26px; text-align: center; border: 1px solid #d9d9d9; border-radius: 4px; color: #333; padding: 0 6px; }
.pager span.cur { border-color: #1677ff; color: #1677ff; }
.flash { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 2000; background: #fff; padding: 10px 24px;
  border-radius: 6px; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); color: #333; }

/* ---------- 登录 ---------- */
.login-page { display: flex; height: 100vh; }
.login-left { flex: 1; position: relative; overflow: hidden; color: #fff; display: flex; flex-direction: column;
  background: radial-gradient(circle at 30% 60%, #2f7bff 0%, #0b3fd8 55%, #062a9c 100%); }
.login-left::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 40px 40px; }
.login-company { position: relative; z-index: 1; padding: 40px 48px 0; font-size: 28px; font-weight: 700; letter-spacing: 2px; display: flex; align-items: center; gap: 12px; }
.login-slogan { position: relative; z-index: 1; padding: 10px 48px 0; font-size: 15px; opacity: .8; letter-spacing: 1px; }
.login-photo { position: relative; z-index: 1; flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-photo img { max-height: 70vh; max-width: 80%; border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 30, .45); }
.login-right { flex: 1; display: flex; align-items: center; justify-content: center; background: #fff; }
.login-box { width: min(380px, 86%); }
.login-box h2 { font-size: 26px; margin-bottom: 8px; }
.login-box .sub { color: #999; margin-bottom: 32px; }
.field { display: flex; align-items: center; height: 48px; border: 1px solid #dcdfe6; border-radius: 6px; margin-bottom: 20px; padding-left: 14px; background: #fff; }
.field:focus-within { border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22, 119, 255, .12); }
.field .ico { width: 20px; color: #a0a8b8; font-size: 16px; }
.field input { flex: 1; min-width: 0; height: 100%; border: none; outline: none; font-size: 15px; padding: 0 10px; background: transparent; }
.field img { height: 100%; width: 120px; flex-shrink: 0; border-left: 1px solid #dcdfe6; border-radius: 0 6px 6px 0; cursor: pointer; }
.btn-login { width: 100%; height: 52px; margin-top: 12px; border: none; border-radius: 26px; cursor: pointer; color: #fff; font-size: 18px;
  font-weight: 700; letter-spacing: 6px; background: linear-gradient(90deg, #ff7a18, #ff3d3d); box-shadow: 0 8px 20px rgba(255, 77, 45, .4); transition: transform .15s, box-shadow .15s; }
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(255, 77, 45, .5); }
.login-error { color: #e34d59; margin: -8px 0 12px; min-height: 20px; }

/* ---------- 工作台 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.stat { display: flex; align-items: center; gap: 16px; padding: 20px; border: 1px solid #edf0f5; border-radius: 8px; }
.stat-ico { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; flex-shrink: 0; }
.stat-label { color: #666; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; }
.bg-blue { background: linear-gradient(135deg, #4fa3ff, #1677ff); } .bg-green { background: linear-gradient(135deg, #3ddc97, #00a870); }
.bg-red { background: linear-gradient(135deg, #ff8a8a, #e34d59); } .bg-orange { background: linear-gradient(135deg, #ffb35c, #ed7b2f); }
.bg-purple { background: linear-gradient(135deg, #b18cff, #7b4dff); } .bg-cyan { background: linear-gradient(135deg, #5cdbd3, #13a8a8); }

/* ---------- 视频监控 ---------- */
.monitor { display: grid; grid-template-columns: 16% 1fr 18%; gap: 16px; height: calc(100vh - 92px); }
.panel { background: #fff; border-radius: 8px; padding: 16px; display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid #edf0f5; margin-bottom: 12px; }
.tabs a { flex: 1; text-align: center; white-space: nowrap; padding: 8px 0; color: #555; border-bottom: 2px solid transparent; cursor: pointer; }
.tabs a.active { color: #1677ff; border-bottom-color: #1677ff; font-weight: 600; }
.tree { overflow: auto; flex: 1; margin-top: 12px; }
.tree-node { font-weight: 600; padding: 6px 4px; color: #1677ff; }
.tree-item { padding: 6px 4px 6px 20px; cursor: pointer; border-radius: 4px; display: flex; align-items: center; }
.tree-item:hover, .tree-item.active { background: #f0f6ff; color: #1677ff; }
.player-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.player-head h3 { font-size: 17px; }
.player { position: relative; flex: 1; background: #000; border-radius: 4px; overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 0; }
.player img { width: 100%; height: 100%; object-fit: contain; }
.player .live { position: absolute; right: 12px; bottom: 12px; color: #fff; background: rgba(0, 0, 0, .55); padding: 3px 10px; border-radius: 12px; font-size: 12px; }
.player .live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #00e676; margin-right: 6px; }
.player-tip { color: #aaa; }
.player-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: #666; }
.dev-list { overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.dev-card { border: 1px solid #e5e6eb; border-radius: 6px; padding: 8px; cursor: pointer; }
.dev-card:hover, .dev-card.active { border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22, 119, 255, .1); }
.dev-card .t { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; }
.dev-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; background: #222; display: block; }
.dev-card .meta { font-size: 12px; color: #888; margin-top: 6px; }
.star { cursor: pointer; color: #ccc; font-size: 16px; border: none; background: none; }
.star.on { color: #fadb14; }

/* ---------- 设备详情 ---------- */
.detail { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.detail-side { background: #fff; border-radius: 8px; padding: 20px; text-align: center; }
.detail-side .photo { width: 180px; height: 180px; border-radius: 50%; margin: 10px auto 16px; border: 1px solid #edf0f5; overflow: hidden; position: relative; }
.detail-side .photo img { width: 100%; height: 100%; object-fit: cover; }
.detail-side h3 { font-size: 18px; margin-bottom: 20px; word-break: break-all; }
.side-menu a { display: block; text-align: left; padding: 10px 16px; border-radius: 6px; color: #333; margin-bottom: 6px; }
.side-menu a.active { background: #e8f1ff; color: #1677ff; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 24px; }
.info-grid .k { color: #888; }
.info-grid .row { display: flex; align-items: center; gap: 6px; }
.flow-box { background: #f5f7fa; border-radius: 8px; padding: 16px; }
.flow-bar { height: 6px; background: #e5e6eb; border-radius: 3px; margin-top: 12px; overflow: hidden; }
.flow-bar i { display: block; height: 100%; background: #1677ff; }
.card-grid { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 20px; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 32px; max-width: 900px; }
.form-grid label { display: block; color: #666; margin-bottom: 6px; }
.form-grid .input, .form-grid .select { width: 100%; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- 位置服务 ---------- */
.location { position: relative; height: calc(100vh - 92px); border-radius: 8px; overflow: hidden; }
#map { position: absolute; inset: 0; z-index: 1; }
.loc-panel { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 500; max-height: 36%; overflow: auto; background: rgba(255, 255, 255, .96);
  border-radius: 8px; padding: 14px 80px 14px 16px; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); }
.loc-panel.collapsed .loc-body { display: none; }
.loc-panel .toolbar { margin-bottom: 10px; }
.loc-panel .table th, .loc-panel .table td { padding: 8px; }
.loc-toggle { position: absolute; top: 12px; right: 16px; }
