:root {
  --primary: #1677ff;
  --primary-dark: #0b5ed7;
  --green: #00b578;
  --red: #f5222d;
  --orange: #fa8c16;
  --text: #111827;
  --muted: #8a93a3;
  --line: #e8ecf2;
  --bg: #f2f4f8;
  --card: #ffffff;
  --shadow: 0 6px 20px rgba(15, 23, 42, .10);
  --radius: 14px;
  --tabbar: 58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
input, select { outline: none; }

#app { position: relative; height: 100vh; height: 100dvh; overflow: hidden; }

.page {
  position: absolute;
  inset: 0 0 var(--tabbar) 0;
  display: none;
  overflow: hidden;
  background: var(--bg);
}
.page.active { display: block; }
.page.subpage.active { display: flex; flex-direction: column; }
#pageHome.active { display: flex; flex-direction: column; }
#pageTrack.active { display: flex; flex-direction: column; }
#pageMine.active { display: block; overflow-y: auto; padding-bottom: 18px; }

.subpage-head { display: flex; align-items: center; gap: 10px; }
.subpage-head h2 { font-size: 19px; flex: 1; }
.head-action {
  flex: none;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}
.back-btn {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  color: #334155;
  font-size: 12.5px;
  flex: none;
}
.subpage-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px calc(24px + env(safe-area-inset-bottom, 0px));
}
.admin-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 30px;
  padding: 0;
  border: none;
  background: none;
  color: #1f2937;
  font-size: 15px;
  text-align: left;
}
.menu-arrow { color: #9aa3b2; font-size: 18px; line-height: 1; }

.list-header {
  flex: none;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
}
.list-header .search-row { margin-top: 0; }
.list-header .sheet-tabs { padding: 0; border-bottom: 0; }

.map { position: absolute; inset: 0; background: #e6ebf2; z-index: 0; }
.leaflet-container { font-family: inherit; background: #e6ebf2; }
.leaflet-control-attribution { font-size: 9px; opacity: .65; }

/* ========== 首页 ========== */
.home-top {
  position: absolute;
  z-index: 500;
  left: 0; right: 0;
  top: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 0;
  pointer-events: none;
}
.home-top > * { pointer-events: auto; }

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .96);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 10px; height: 32px; border-radius: 5px;
  background: linear-gradient(180deg, #1677ff, #00b578);
  flex: none;
}
.brand h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.brand p { margin: 2px 0 0; font-size: 11px; color: var(--muted); }

.round-btn {
  padding: 7px 13px;
  border-radius: 999px;
  background: #f2f6ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}
.round-btn:active { background: #e3edff; }

.search-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .96);
  border-radius: 999px;
  padding: 6px 6px 6px 14px;
  box-shadow: var(--shadow);
}
.search-row svg { width: 16px; height: 16px; color: #9aa4b2; flex: none; }
.search-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 13px;
  height: 28px;
}
.search-row input::placeholder { color: #a6aebb; }
.group-search { margin: 0 0 12px; }
.search-row #btnLocate {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.map-locate-btn {
  position: absolute;
  left: 12px;
  bottom: 18px;
  z-index: 600;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .97);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.map-locate-btn:disabled { opacity: .65; }
.user-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1677ff;
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, .25), 0 2px 8px rgba(0, 0, 0, .25);
}

.map-focus-btn {
  position: absolute;
  right: 12px;
  bottom: 18px;
  z-index: 600;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .97);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.map-layer {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 700;
}
.map-layer-btn {
  display: block;
  margin-left: auto;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .97);
  color: #1f2937;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.map-layer-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 140px;
  padding: 4px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .22);
}
.map-layer-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  text-align: left;
  font-size: 12.5px;
  color: #2b3444;
}
.map-layer-menu button:hover { background: #f4f7fc; }
.map-layer-menu button.active { background: #eef4ff; color: var(--primary); font-weight: 700; }
.map-layer-menu button:disabled { color: #b8c0cc; cursor: not-allowed; }
.map-layer-menu button:disabled:hover { background: transparent; }

.map-popup {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 62px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  max-height: 58%;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .22);
  overflow: hidden;
}
.map-popup[hidden] { display: none; }
.map-popup-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.map-popup-head b { font-size: 15px; color: #16233a; }
.acc-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 18px;
}
.acc-badge.on { background: #e7f8ee; color: #16a34a; }
.acc-badge.off { background: #f1f5f9; color: #94a3b8; }
.map-popup-close {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5fb;
  color: #55627a;
  font-size: 12px;
  font-weight: 600;
}
.map-popup-body {
  padding: 6px 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.popup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed #eef2f8;
  font-size: 12.5px;
}
.popup-row:last-child { border-bottom: 0; }
.popup-row span { color: #7b869a; flex: none; }
.popup-row b { color: #1e2a3d; font-weight: 600; text-align: right; word-break: break-all; }
.map-popup-foot { padding: 10px 14px 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.map-popup-foot .primary-btn { width: auto; flex: 1; }
.popup-detail-btn {
  flex: 1;
  height: 40px;
  border-radius: 10px;
  background: #eef4ff;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}
.popup-detail-btn:active { background: #dfeaff; }

#pageAlarms .alarm-list { padding: 6px 0 0; }

.sheet-tabs {
  display: flex;
  gap: 8px;
  padding: 4px 12px 8px;
  flex: none;
  border-bottom: 1px solid var(--line);
}
.sheet-tabs .tab {
  flex: 1;
  padding: 7px 0;
  border-radius: 9px;
  background: #f4f6fa;
  color: #5b6474;
  font-size: 12px;
  font-weight: 600;
}
.sheet-tabs .tab em { font-style: normal; font-weight: 500; opacity: .85; margin-left: 2px; }
.sheet-tabs .tab.active { background: #e8f1ff; color: var(--primary); }

.vehicle-list { flex: 1; overflow-y: auto; padding: 8px 12px 18px; -webkit-overflow-scrolling: touch; }

.tree-node { position: relative; }
.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 4px;
  font-size: 12.5px;
  color: #2b3444;
  cursor: pointer;
  user-select: none;
  border-radius: 7px;
}
.tree-row:active { background: #f1f6ff; }
.tree-row b { font-weight: 700; font-size: 13px; color: #2b3444; }
.tree-arrow {
  width: 0; height: 0;
  border-left: 5px solid #8e99a8;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .18s ease;
  flex: none;
}
.tree-arrow.open { transform: rotate(90deg); }
.tree-check {
  width: 14px; height: 14px;
  flex: none;
  margin: 0;
  accent-color: var(--primary);
}
.tree-folder { width: 18px; height: 18px; flex: none; color: #f0a020; }
.tree-folder.open { color: #2f7fe8; }
.tree-folder svg { width: 100%; height: 100%; display: block; }
.tree-count {
  margin-left: auto;
  font-size: 11.5px;
  color: #8a93a3;
  font-variant-numeric: tabular-nums;
}
.tree-children {
  margin-left: 9px;
  padding-left: 10px;
  border-left: 1px solid #dfe6f0;
}
.tree-children.collapsed { display: none; }
.tree-empty {
  padding: 6px 4px 6px 30px;
  font-size: 12px;
  color: #9aa3b2;
}

.tree-vehicle { padding: 6px 4px; gap: 7px; }
.tree-vehicle.selected { background: #e9f2ff; }
.car-icon { width: 22px; height: 22px; flex: none; color: #9aa3b2; }
.car-icon svg { width: 100%; height: 100%; display: block; }
.veh-plate {
  color: #1d5fd0;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-vehicle.is-offline .car-icon, .tree-vehicle.is-offline .veh-plate { color: #9aa3b2; }
.tree-vehicle.is-online .car-icon, .tree-vehicle.is-online .veh-plate { color: #16a34a; }
.tree-vehicle.is-moving .car-icon, .tree-vehicle.is-moving .veh-plate { color: #e11d48; }
.veh-mile {
  margin-left: auto;
  flex: none;
  color: #8a93a3;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.empty-state {
  padding: 36px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.9;
}
.empty-state b { display: block; color: #4b5563; font-size: 14px; margin-bottom: 4px; }

/* ========== 车辆标记 ========== */
.veh-marker {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #cfd8e6;
  border-radius: 999px;
  padding: 3px 8px 3px 5px;
  font-size: 11px;
  font-weight: 700;
  color: #263244;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(15, 23, 42, .22);
  transform: translate(-50%, -50%);
}
.veh-marker i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; display: block; }
.veh-marker.offline { color: #7b8494; border-color: #d9dee7; background: #f7f8fa; }
.veh-marker.offline i { background: #a5adba; }
.veh-marker.moving { color: #d92d20; border-color: #f6c9c5; background: #fff6f5; }
.veh-marker.moving i { background: var(--red); }
.veh-marker.selected { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 3px rgba(22, 119, 255, .22), 0 4px 12px rgba(22, 119, 255, .25); }

.point-marker {
  width: 14px; height: 14px; border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .3);
  transform: translate(-50%, -50%);
}
.point-start { background: var(--green); }
.point-end { background: var(--red); }
.point-play {
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(22, 119, 255, .25), 0 1px 8px rgba(0, 0, 0, .35);
}

/* ========== 页面通用 ========== */
.page-top {
  flex: none;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 8px;
}
.page-top h2 { margin: 0; font-size: 20px; font-weight: 700; }
.page-top p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
  margin: 10px 12px 0;
  padding: 13px;
}

/* ========== 轨迹 ========== */
.track-form { flex: none; margin: 6px 12px 10px; padding: 12px; }
.track-row { display: flex; gap: 8px; }
.track-row select {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 10px;
  background: #f9fbfd;
  font-size: 13px;
}
.track-row input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 10px;
  background: #f9fbfd;
  font-size: 13px;
  -webkit-appearance: none;
  appearance: none;
}
.track-row input:focus { border-color: var(--primary); background: #fff; outline: none; }
.track-results {
  margin-top: 8px;
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.track-results[hidden] { display: none; }
.track-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.track-option:last-child { border-bottom: 0; }
.track-option.selected { background: #eef5ff; }
.track-option b { flex: none; font-size: 13px; color: var(--text); }
.track-option span {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.track-option em {
  flex: none;
  font-style: normal;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #eef2f7;
  color: #5b6474;
}
.track-option em.on { background: #e8f8ee; color: var(--green); }
.track-empty { padding: 10px; font-size: 12px; color: var(--muted); text-align: center; }
.track-selected {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 9px;
  background: #eef5ff;
  font-size: 12px;
}
.track-selected[hidden] { display: none; }
.track-selected span { flex: none; color: var(--muted); }
.track-selected b { flex: none; color: var(--text); }
.track-selected i {
  flex: 1;
  min-width: 0;
  font-style: normal;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.track-selected button {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: #7b869a;
  font-size: 14px;
  line-height: 1;
}
.primary-btn {
  padding: 0 16px;
  height: 38px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.primary-btn:disabled { opacity: .55; }
.primary-btn:active { background: var(--primary-dark); }

.time-range { display: flex; gap: 8px; margin-top: 9px; }
.time-range label {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 4px 9px 5px;
  background: #f9fbfd;
}
.time-range label span { display: block; font-size: 10px; color: var(--muted); margin-bottom: 1px; }
.time-range input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 12px;
  padding: 0;
  height: 22px;
}
.quick-row { display: flex; gap: 6px; margin-top: 9px; }
.quick-row button {
  flex: 1;
  padding: 6px 0;
  border-radius: 8px;
  background: #f2f5fa;
  color: #566173;
  font-size: 11.5px;
  font-weight: 600;
}
.quick-row button.active { background: #e8f1ff; color: var(--primary); }

.track-map {
  position: relative;
  flex: 1;
  min-height: 150px;
  margin: 0 12px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  z-index: 1;
}
.track-summary {
  flex: none;
  margin: 9px 12px 0;
  padding: 9px 12px;
  background: rgba(255, 255, 255, .96);
  border-radius: 10px;
  font-size: 11.5px;
  color: #4b5563;
  line-height: 1.65;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .07);
}
.track-summary b { color: var(--text); }
.track-summary .s-item { margin-right: 12px; display: inline-block; }

.playback {
  flex: none;
  margin: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .06);
}
.playback button {
  flex: none;
  width: 58px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.playback button:disabled { background: #c7d2e3; }
.playback input[type=range] { flex: 1; accent-color: var(--primary); min-width: 0; }
.playback span { flex: none; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ========== 报警 ========== */
.alarm-list { padding: 2px 12px 10px; }
.alarm-card {
  background: var(--card);
  border-radius: 12px;
  padding: 11px 12px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
  border-left: 3px solid var(--red);
}
.alarm-card .a-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.alarm-card .a-head b { font-size: 14px; }
.alarm-card .a-type { font-size: 11px; color: var(--red); background: #fff1f0; padding: 2px 7px; border-radius: 6px; font-weight: 600; }
.alarm-card .a-meta { margin-top: 5px; font-size: 11.5px; color: var(--muted); line-height: 1.7; }

/* ========== 我的 ========== */
.info-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.info-row:last-child { border-bottom: 0; }
.info-row span { color: #596273; }
.info-row b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.info-row b.ok { color: var(--green); }
.info-row b.bad { color: var(--red); }

.form-card h3 { margin: 0 0 3px; font-size: 14px; }
.form-card .hint { margin: 0 0 9px; font-size: 11px; color: var(--muted); }
.inline-form { display: flex; gap: 8px; }
.inline-form input {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 10px;
  background: #f9fbfd;
  font-size: 13px;
}
.inline-form button {
  flex: none;
  padding: 0 16px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1;
  padding: 8px 0;
  border-radius: 8px;
  background: #f2f5fa;
  color: #566173;
  font-size: 12px;
  font-weight: 600;
}
.seg button.active { background: #e8f1ff; color: var(--primary); }
.about-card { text-align: center; color: var(--muted); font-size: 11.5px; padding: 14px; }

/* ========== 底部导航 ========== */
.tabbar {
  position: absolute;
  z-index: 900;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  background: rgba(255, 255, 255, .98);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 12px rgba(15, 23, 42, .05);
}
.nav-btn {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #8a93a3;
  position: relative;
}
.nav-btn.active { color: var(--primary); }
.nav-btn.active::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 7px;
  width: 16px; height: 3px;
  border-radius: 2px;
  background: var(--primary);
  transform: translateX(-50%);
}

/* ========== 弹窗 ========== */
.modal {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: none;
}
.modal.show { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(10, 15, 28, .48); }
.modal-card {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 96%;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.detail-card { top: calc(env(safe-area-inset-top, 0px) + 22px); border-radius: 18px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex: none; }
.detail-head h3 { margin: 0; font-size: 20px; font-weight: 700; }
.detail-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }
.detail-head-actions { display: flex; gap: 8px; flex: none; }
.close-btn { padding: 6px 12px; border-radius: 8px; background: #f2f5fa; color: #566173; font-size: 12px; font-weight: 600; }
.detail-scroll { overflow-y: auto; margin-top: 12px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }

.detail-hero {
  display: flex;
  background: linear-gradient(120deg, #0f2a53, #14539b);
  border-radius: 13px;
  padding: 13px 6px;
  color: #fff;
}
.detail-hero > div { flex: 1; text-align: center; border-right: 1px solid rgba(255, 255, 255, .16); }
.detail-hero > div:last-child { border-right: 0; }
.detail-hero b { display: block; font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.detail-hero span { font-size: 10px; opacity: .75; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 11px;
}
.info-cell {
  background: #f7f9fc;
  border-radius: 9px;
  padding: 8px 10px;
}
.info-cell span { display: block; font-size: 10px; color: var(--muted); margin-bottom: 2px; }
.info-cell b { font-size: 12.5px; font-weight: 600; word-break: break-all; }
.info-cell b.good { color: var(--green); }
.info-cell b.bad { color: var(--red); }

.section-title { margin: 15px 0 8px; font-size: 13px; }
.group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #f7f9fc;
  font-size: 13px;
  font-weight: 600;
}
.group-row button {
  flex: none;
  padding: 7px 13px;
  border-radius: 8px;
  background: #f2f6ff;
  color: #1f5fbf;
  font-size: 12px;
  font-weight: 600;
}
.cmd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.cmd-grid button {
  padding: 10px 4px;
  border-radius: 9px;
  background: #f2f6ff;
  color: #1f5fbf;
  font-size: 12px;
  font-weight: 600;
}
.cmd-grid button:active { background: #e3edff; }
.cmd-result {
  margin-top: 9px;
  padding: 9px 11px;
  border-radius: 9px;
  background: #f7f9fc;
  color: #5b6474;
  font-size: 11.5px;
  line-height: 1.6;
  word-break: break-all;
  min-height: 38px;
}
.cmd-result.ok { background: #eefaf4; color: #147a54; }
.cmd-result.err { background: #fff1f0; color: #cf1322; }

.input-card { left: 12px; right: 12px; bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 16px; padding: 18px; }
.input-card h3 { margin: 0 0 12px; font-size: 16px; flex: none; }
.input-card #inputFields {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.input-card .modal-actions { flex: none; }
.input-field { margin-bottom: 10px; }
.input-field span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.input-field input, .input-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  background: #f9fbfd;
  font-size: 13px;
}
.input-field textarea { min-height: 74px; resize: none; }
.scope-tree {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  background: #f9fbfd;
}
.scope-tree .scope-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-radius: 7px;
  cursor: pointer;
}
.scope-tree .scope-row > .scope-guides {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 10px;
  display: flex;
  margin: 0;
  pointer-events: none;
}
.scope-tree .scope-guide {
  position: relative;
  width: 16px;
  flex: none;
  border-left: 1px dashed #d6deea;
}
.scope-tree .scope-guide.arm::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 14px;
  border-top: 1px dashed #d6deea;
}
.scope-tree .scope-row:active { background: #eef4ff; }
.scope-tree .scope-row input {
  width: 15px; height: 15px;
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--primary);
}
.scope-tree .scope-row > span {
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-size: 12.5px;
  color: #2b3444;
}
.scope-tree .scope-folder, .scope-tree .scope-car { width: 16px; height: 16px; flex: none; }
.scope-tree .scope-folder { color: #f0a020; }
.scope-tree .scope-car { color: #9aa3b2; }
.scope-tree .scope-folder svg, .scope-tree .scope-car svg { width: 100%; height: 100%; display: block; }
.scope-tree .scope-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perm-tree {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #f9fbfd;
}
.perm-group { min-width: 0; }
.perm-group-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 2px;
}
.perm-tree .perm-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  color: #2b3444;
}
.perm-tree .perm-row:active { background: #eef4ff; }
.perm-tree .perm-row input {
  width: 15px; height: 15px;
  flex: none;
  margin: 0;
  accent-color: var(--primary);
}
.modal-actions { display: flex; gap: 9px; margin-top: 14px; }
.modal-actions button { flex: 1; height: 40px; border-radius: 9px; background: #f2f5fa; color: #4b5563; font-weight: 600; }
.modal-actions .primary-btn { background: var(--primary); color: #fff; }

.toast {
  position: absolute;
  z-index: 2000;
  left: 50%;
  bottom: calc(var(--tabbar) + 26px);
  transform: translate(-50%, 10px);
  max-width: 82%;
  padding: 9px 15px;
  border-radius: 9px;
  background: rgba(17, 24, 39, .92);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 登录 ---------------- */
.login-screen {
  position: absolute;
  inset: 0;
  z-index: 3000;
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  background: linear-gradient(160deg, #0f2747, #123f74 55%, #0b2038);
}
.login-screen.show { display: flex; }
.login-card {
  width: 100%;
  max-width: 330px;
  margin: auto;
  padding: 26px 22px 20px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.login-logo {
  width: 54px; height: 54px;
  margin: 0 auto 12px;
  border-radius: 15px;
  background: linear-gradient(140deg, #3b8cff, #1677ff);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(22, 119, 255, .3);
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; text-align: center; }
.login-card > p { font-size: 12px; color: var(--muted); margin-bottom: 18px; text-align: center; }
.login-field { display: block; margin-bottom: 12px; }
.login-field span { display: block; font-size: 12px; color: #5b6474; margin-bottom: 5px; }
.login-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9fc;
  font-size: 14px;
  color: #1f2937;
}
.login-field input:focus { border-color: var(--primary); background: #fff; outline: none; }
.login-error { min-height: 17px; font-size: 11.5px; color: var(--red); margin-bottom: 6px; }
.login-submit { width: 100%; height: 42px; font-size: 15px; border-radius: 10px; }
.login-register {
  width: 100%;
  height: 34px;
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.login-code-row { display: flex; gap: 8px; }
.login-code-row input { flex: 1; min-width: 0; }
.login-code-btn {
  flex: none;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cfe0ff;
  border-radius: 10px;
  background: #eef4ff;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.login-code-btn:disabled { color: #9aa6b8; background: #f1f4f9; border-color: var(--line); cursor: not-allowed; }
.login-links { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; }
.login-links .login-register { width: auto; margin-top: 0; padding: 0 12px; }
.sys-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: #1f2937;
  cursor: pointer;
}
.sys-check input { width: 16px; height: 16px; }
.sys-check-row { display: flex; flex-wrap: wrap; gap: 24px; margin: 4px 0 10px; }
.sys-textarea {
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9fc;
  font-size: 13px;
  color: #1f2937;
  font-family: inherit;
  resize: vertical;
}
.sys-textarea:focus { border-color: var(--primary); background: #fff; outline: none; }
.sys-test-row { display: flex; gap: 10px; margin-top: 12px; }
.sys-test-row input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9fc;
  font-size: 13px;
}
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2px 0 8px;
}
.login-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #5b6474;
}
.login-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}
.login-footer { margin-top: 14px; font-size: 11px; color: #98a2b1; text-align: center; }

/* ---------------- 账号与用户管理 ---------------- */
.pwd-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.pwd-block h3 { margin: 0 0 8px; font-size: 13.5px; }
.pwd-block .input-field { margin-bottom: 8px; }
.pwd-block .input-field input { height: 38px; }
.pwd-error { min-height: 16px; font-size: 11.5px; color: var(--red); margin-bottom: 4px; }
.logout-btn {
  width: 100%;
  margin-top: 10px;
  height: 38px;
  border-radius: 9px;
  background: #fff1f0;
  color: #d4380d;
  font-size: 13px;
  font-weight: 600;
}
.primary-btn.wide { display: block; width: 100%; margin-top: 10px; height: 40px; }
.user-empty { padding: 12px 2px; font-size: 12px; color: var(--muted); text-align: center; }
.user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.user-row:last-child { border-bottom: 0; }
.user-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.user-main b { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.user-main > span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-badge { padding: 1px 6px; border-radius: 5px; font-size: 10px; font-weight: 600; }
.role-badge.MONITOR { background: #eef2f7; color: #5b6474; }
.role-badge.ADMIN { background: #e8f2ff; color: #1d5fd0; }
.role-badge.SUPER_ADMIN { background: #fff4e6; color: #d46b08; }
.role-badge.freeze { background: #fff1f0; color: #cf1322; }
.freeze-tag { flex: none; margin-left: 4px; font-size: 10.5px; font-weight: 600; color: #cf1322; }
.user-actions { display: flex; gap: 6px; flex: none; }
.user-actions button {
  padding: 5px 9px;
  border-radius: 7px;
  background: #f2f6ff;
  color: #1f5fbf;
  font-size: 11.5px;
  font-weight: 600;
}
.user-actions button.danger { background: #fff1f0; color: #d4380d; }
.perm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.perm-row:last-child { border-bottom: 0; }
.perm-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.perm-row b { font-size: 13px; }
.perm-row span { font-size: 11px; color: var(--muted); }
.perm-row select {
  flex: none;
  max-width: 46%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
  font-size: 12px;
  color: #2b3444;
}
.perm-matrix {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 11px;
}
.perm-matrix th, .perm-matrix td {
  padding: 6px 4px;
  border: 1px solid var(--line);
  text-align: center;
  color: #566173;
}
.perm-matrix th { background: #f5f8fc; font-weight: 600; color: #2b3444; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; padding-left: 8px; }
#cmdGrid button:disabled { opacity: .45; }
.input-field select {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7f9fc;
  font-size: 13px;
  color: #2b3444;
}
.date-span { display: flex; align-items: center; gap: 6px; }
.date-span input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f9fbfd;
  font-size: 12.5px;
  color: #2b3444;
  -webkit-appearance: none;
  appearance: none;
}
.date-span i { flex: none; font-style: normal; font-size: 11px; color: var(--muted); }
.date-quick { display: flex; gap: 6px; margin-top: 6px; }
.date-quick button {
  flex: 1;
  height: 30px;
  border-radius: 8px;
  background: #eef5ff;
  color: var(--primary);
  font-size: 12px;
}
.treeselect {
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f9fbfd;
}
.treeselect-item {
  display: flex;
  align-items: stretch;
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  font-size: 13px;
  color: #374151;
}
.tree-guides {
  display: inline-flex;
  flex: none;
  padding-left: 6px;
}
.tree-guide {
  display: inline-block;
  position: relative;
  width: 20px;
  flex: none;
}
.tree-guide::before {
  content: '';
  position: absolute;
  left: 10px;
  top: -7px;
  bottom: -7px;
  border-left: 1px dotted #b6c2d2;
}
.tree-guide::after {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  width: 10px;
  border-top: 1px dotted #b6c2d2;
}
.tree-label {
  flex: 1;
  align-self: center;
  padding-left: 8px;
  line-height: 18px;
}
.treeselect-item.selected {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.treeselect-item.selected .tree-guide::before,
.treeselect-item.selected .tree-guide::after {
  border-color: rgba(255, 255, 255, .6);
}

.mig-log {
  margin: 14px 0 0;
  padding: 12px 14px;
  max-height: 260px;
  overflow: auto;
  background: #0f172a;
  color: #d7e3f4;
  border-radius: 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 分组管理树 */
.group-tree-row { position: relative; cursor: default; }
.group-tree-row[data-group-toggle] { cursor: pointer; }
.group-toggle {
  width: 14px;
  flex: none;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1;
  transition: transform .15s ease;
}
.group-toggle.open { transform: rotate(90deg); }
.group-guides {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  pointer-events: none;
}
.group-guide {
  position: relative;
  width: 16px;
  flex: none;
  border-left: 1px dashed #d6deea;
}
.group-guide.arm::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 14px;
  border-top: 1px dashed #d6deea;
}

/* 接入文档 */
.docs-total { margin-left: auto; font-size: 12px; color: var(--muted, #94a3b8); }
.docs-search { margin-bottom: 10px; }
.docs-dir-tabs { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; }
.docs-dir-tabs .tab {
  flex: none;
  padding: 5px 14px;
  border: 1px solid var(--line, #e5e9f0);
  border-radius: 999px;
  background: #fff;
  color: #5b6474;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}
.docs-dir-tabs .tab.active { background: #e8f1ff; border-color: #cfe0ff; color: var(--primary, #1677ff); font-weight: 700; }
.docs-params { margin-bottom: 12px; padding: 14px 16px; }
.doc-param { display: flex; gap: 12px; padding: 4px 0; font-size: 12.5px; line-height: 1.6; }
.doc-param span { flex: none; width: 108px; color: #8a93a3; }
.doc-param b { color: #1f2937; font-weight: 600; word-break: break-all; }
.doc-notes { margin: 8px 0 0; padding-left: 18px; color: #64748b; font-size: 12px; line-height: 1.7; }
.docs-list { display: flex; flex-direction: column; gap: 10px; }
.doc-card {
  background: #fff;
  border: 1px solid var(--line, #e5e9f0);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .04);
}
.doc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-id { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--primary, #1677ff); }
.doc-dir { padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.doc-dir.up { background: #e8f7ef; color: #15803d; }
.doc-dir.down { background: #fff4e5; color: #b45309; }
.doc-head h3 { margin: 0; font-size: 14px; color: #0f172a; }
.doc-desc { margin: 8px 0; font-size: 12.5px; color: #64748b; line-height: 1.65; }
.doc-fields { margin: 0; padding-left: 18px; font-size: 12.5px; color: #334155; line-height: 1.75; }
.doc-steps { margin: 10px 0 0; padding-left: 20px; font-size: 12.5px; color: #334155; line-height: 1.7; }
.doc-steps li { margin-bottom: 10px; }
.doc-steps li b { display: block; color: #1f2937; font-size: 13px; }
.doc-steps li p { margin: 4px 0; color: #64748b; }
.doc-steps li code {
  display: inline-block;
  margin: 4px 0;
  padding: 4px 8px;
  background: #f1f5fb;
  border-radius: 6px;
  font-family: ui-monospace, Consolas, monospace;
  color: #0f4c9c;
  word-break: break-all;
}
.doc-steps li em { display: block; margin-top: 4px; color: #94a3b8; font-style: normal; font-size: 12px; }
.doc-example { margin-top: 8px; padding: 8px 10px; background: #f8fafc; border-radius: 8px; font-size: 11.5px; color: #475569; }
.doc-example span { margin-right: 8px; color: #94a3b8; }
.doc-example code { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }

@media (max-width: 360px) {
  .brand h1 { font-size: 16px; }
  .sheet-tabs .tab { font-size: 11.5px; }
}
