/* 小康云控平台后台 · 样式（一个文件，够用就行，不引外部 UI 库） */

:root {
  --accent: #e0553f;
  --ink: #1f2430;
  --line: #e3e6ec;
  --muted: #6b7383;
  --bg: #f4f5f8;
  --card: #ffffff;
  --ok: #2e7d32;
  --bad: #c03027;
  --off: #8a8f9a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1260px; margin: 0 auto; padding: 0 18px; }

/* ---------- 顶栏 ---------- */
.topbar { background: var(--ink); color: #fff; }
.topbar-in { display: flex; align-items: center; gap: 22px; height: 56px; }
.brand { font-size: 16px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.brand::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px;
  border-radius: 2px; background: var(--accent); vertical-align: 2px; }

.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; }
.nav a { padding: 7px 12px; border-radius: 4px; color: #c9ced9; font-size: 13.5px; white-space: nowrap; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a.on { color: #fff; background: var(--accent); }

.me { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.who { color: #c9ced9; font-size: 13px; }
.tag { margin-left: 6px; padding: 1px 6px; border-radius: 3px; background: rgba(224, 85, 63, .22);
  color: #ffb4a5; font-size: 11px; font-style: normal; }
.tag-off { background: #eceef2; color: #6b7383; }
.quit { background: none; border: 0; color: #8e95a5; font-size: 12.5px; cursor: pointer; padding: 4px 2px; }
.quit:hover { color: #fff; }

/* ---------- 内容 ---------- */
.main { padding: 20px 18px 40px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; }
.card h2 { margin: 0 0 6px; font-size: 17px; }
.dim { color: var(--muted); }
.empty { color: var(--muted); padding: 26px 0; text-align: center; }

.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-bottom: 26px; color: var(--muted); font-size: 12.5px; }

/* ---------- 工具条 / 按钮 ---------- */
.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.bar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bar .tip, .bar .count { color: var(--muted); font-size: 12.5px; }
.bar .count { margin-left: auto; }
.right { margin-left: auto; }
.inline { display: inline; }
.inline-label { color: var(--muted); font-size: 12.5px; }

.btn { display: inline-block; padding: 6px 13px; border: 1px solid var(--line); border-radius: 4px;
  background: #fff; color: var(--ink); font-size: 13px; cursor: pointer; line-height: 1.5; }
.btn:hover { border-color: #c9ced9; background: #f7f8fa; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #cc4a35; border-color: #cc4a35; }
.btn-danger { background: #fff; border-color: #e6b6b0; color: var(--bad); }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 3px 9px; font-size: 12.5px; }
.w-input { width: 110px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; }
.w-input-lg { width: 220px; }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 600; color: #414a5c; background: #f7f8fa;
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
.tbl tbody tr:hover td { background: #fafbfc; }
.tbl .c { text-align: center; }
.tbl .acts { white-space: nowrap; }
.scroll { overflow-x: auto; }
.w-seq { width: 56px; } .w-phone { width: 130px; } .w-pwd { width: 130px; }
.w-parent { width: 130px; } .w-act { width: 250px; }
.w-id { width: 66px; } .w-time { width: 150px; } .w-dev { width: 110px; }
.w-res { width: 90px; }
.tbl-compact td, .tbl-compact th { padding: 6px 8px; font-size: 13px; }

.res { padding: 1px 7px; border-radius: 3px; font-size: 12px; }
.res-ok { background: #e7f4e8; color: var(--ok); }
.res-bad { background: #fdecea; color: var(--bad); }
.res-off { background: #eef0f3; color: var(--off); }

/* 用户树折叠按钮 */
.fold { width: 18px; height: 18px; margin-right: 6px; padding: 0; border: 1px solid var(--line);
  border-radius: 3px; background: #fff; color: #5a6373; cursor: pointer; line-height: 1;
  font-size: 13px; vertical-align: 1px; }
.fold-space { display: inline-block; width: 18px; margin-right: 6px; }
.nick { font-weight: 500; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; display: none; align-items: flex-start; justify-content: center;
  background: rgba(20, 24, 32, .45); padding: 60px 16px 20px; overflow-y: auto; z-index: 50; }
.modal.open { display: flex; }
.modal-box { width: 100%; max-width: 430px; background: #fff; border-radius: 10px; padding: 22px 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .25); }
.modal-box h3 { margin: 0 0 8px; font-size: 16px; }
.modal-box label { display: block; margin: 14px 0 5px; font-size: 13px; color: #444b5a; }
.modal-box input, .modal-box select { width: 100%; height: 38px; padding: 0 10px;
  border: 1px solid #d5d9e1; border-radius: 5px; font-size: 14px; outline: none; background: #fff; }
.modal-box input:focus, .modal-box select:focus { border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 85, 63, .12); }
.modal-box .readonly { background: #f5f6f8; color: var(--muted); }
.modal-box .row { display: flex; gap: 8px; }
.modal-box .hint { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.modal-foot { display: flex; gap: 8px; margin-top: 22px; }

.alert { margin-bottom: 12px; padding: 9px 12px; border-radius: 5px; background: #fdecea;
  border: 1px solid #f5c6c0; color: #a32b1c; font-size: 13px; }

/* ---------- 登录页 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(160deg, #1f2430 0%, #2c3446 100%); padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: #fff; border-radius: 10px;
  padding: 30px 28px 26px; box-shadow: 0 12px 40px rgba(0, 0, 0, .28); }
.login-card h1 { margin: 0; font-size: 20px; }
.login-card .sub { margin: 6px 0 20px; color: var(--muted); font-size: 13px; }
.login-card label { display: block; margin: 14px 0 6px; font-size: 13px; color: #444b5a; }
.login-card input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #d5d9e1;
  border-radius: 5px; font-size: 15px; outline: none; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224, 85, 63, .12); }
.btn-p { width: 100%; height: 42px; margin-top: 22px; border: 0; border-radius: 5px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-p:hover { background: #cc4a35; }

/* ---------- 左右分栏（设备信息：左列表 + 右地图） ---------- */
.split { display: flex; gap: 14px; align-items: stretch; }
.split-left { flex: 0 0 56%; min-width: 0; }
.split-right { flex: 1 1 auto; min-width: 0; }
.split-right #map { height: 560px; }
@media (max-width: 1080px) {
  .split { flex-direction: column; }
  .split-left { flex: none; }
  .split-right #map { height: 420px; }
}

/* ---------- 地图（自己铺高德瓦片） ---------- */
.csmap { position: relative; overflow: hidden; background: #e9eaee; cursor: grab;
  user-select: none; border-radius: 6px; }
.csmap.dragging { cursor: grabbing; }
.csmap-world { position: absolute; left: 0; top: 0; }
.csmap-tile { position: absolute; width: 256px; height: 256px; }
.csmap-marker { position: absolute; pointer-events: none; }
.csmap-marker i { position: absolute; left: 0; top: 6px; width: 15px; height: 15px;
  border-radius: 50% 50% 50% 0; background: var(--accent); border: 2px solid #fff;
  transform: rotate(-45deg); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.csmap-marker b { position: absolute; left: 19px; top: 0; padding: 1px 6px;
  background: rgba(31, 36, 48, .86); color: #fff; font-size: 12px; font-weight: 500;
  border-radius: 3px; white-space: nowrap; }
.csmap-marker.pinged i { background: #ffd166; }
.csmap-centerpin { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px;
  margin: -9px 0 0 -9px; border-radius: 50%; border: 3px solid var(--accent); background: rgba(224, 85, 63, .22);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); pointer-events: none; }
.csmap-credit { position: absolute; right: 4px; bottom: 2px; font-size: 11px; color: #5a6373;
  background: rgba(255, 255, 255, .74); padding: 0 4px; border-radius: 2px; }
.csmap-tip { position: absolute; left: 6px; bottom: 4px; font-size: 11.5px; color: #5a6373;
  background: rgba(255, 255, 255, .74); padding: 1px 6px; border-radius: 2px; }
.pickmap { height: 240px; margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; }
.modal-box-wide { max-width: 560px; }

/* ---------- 设备页专用 ---------- */
.w-type { width: 82px; } .w-switch { width: 84px; } .w-geo { width: 168px; }
.w-geo2 { width: 200px; } .w-act2 { width: 150px; }
.geo-link { color: #2b6cb0; border-bottom: 1px dashed #2b6cb0; cursor: pointer; }
.geo-text { color: #1e7b34; margin-right: 6px; }
.btn-on { background: #e7f4e8; border-color: #b7ddba; color: var(--ok); }
.btn-off { background: #fdecea; border-color: #f1c4bd; color: var(--bad); }

/* ---------- 运行日志 ---------- */
.logbox { margin: 0; padding: 10px 12px; height: 60vh; min-height: 320px; overflow: auto;
  background: #0b0b0b; color: #d8d8d8; border-radius: 6px; font: 12.5px/1.65 Consolas, "Courier New", monospace;
  white-space: pre-wrap; word-break: break-all; }
.logline { display: block; margin: 0; }
.log-INFO { color: #d6d6d6; }
.log-WARN { color: #e8c26a; }
.log-ERR { color: #ef8b7f; }

/* ---------- 设置页 ---------- */
.setgroup { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px 14px; margin: 0 0 14px; }
.setgroup legend { padding: 0 6px; color: #414a5c; font-weight: 600; }
.setrow { display: grid; grid-template-columns: 210px minmax(0, 420px) 1fr; gap: 10px;
  align-items: center; padding: 5px 0; }
.setrow label { color: #444b5a; font-size: 13px; }
.setrow input, .setrow select { height: 34px; padding: 0 9px; border: 1px solid #d5d9e1;
  border-radius: 4px; font-size: 13.5px; outline: none; }
.setrow input:focus, .setrow select:focus { border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 85, 63, .12); }
.sethint { color: var(--muted); font-size: 12px; }
@media (max-width: 780px) { .setrow { grid-template-columns: 1fr; } }

/* ---------- 操作记录 ---------- */
.w-action { width: 110px; } .w-ip { width: 130px; }
.tag-act { padding: 1px 7px; border-radius: 3px; background: #eef2f7; color: #45506a; font-size: 12px; }

/* ---------- MQTT 状态小标 ---------- */
.chip { padding: 2px 9px; border-radius: 10px; font-size: 12.5px; white-space: nowrap; }
.chip-ok { background: #e7f4e8; color: var(--ok); }
.chip-bad { background: #fdecea; color: var(--bad); }

/* ---------- 选点地图上的三种标记 ---------- */
/* 设备原位置：灰色、虚线感 */
.csmap-marker.old i { background: #6b7383; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.csmap-marker.old b { background: rgba(107, 115, 131, .9); }
/* 我的位置：蓝色，慢闪 */
.csmap-marker.me i { background: #2f7bd6; border-color: #fff;
  box-shadow: 0 0 0 3px rgba(47, 123, 214, .28); animation: csPulse 1.8s ease-in-out infinite; }
.csmap-marker.me b { background: rgba(47, 123, 214, .92); }
@keyframes csPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgba(47, 123, 214, .28); }
  50%      { opacity: .35; box-shadow: 0 0 0 8px rgba(47, 123, 214, .10); }
}
