* {
  box-sizing: border-box;
}

/* ===== 内嵌可商用字体：思源黑体 Noto Sans SC（SIL OFL 1.1 开源许可，免费商用，随系统分发无版权风险）=====
   字体文件位于 ../fonts/，中文子集各 1.1MB、拉丁子集各 13KB，font-display: swap 保证加载期间不白屏；
   中文子集声明在前、带 unicode-range 的拉丁子集在后，浏览器对 ASCII/数字优先命中轻量拉丁子集 */
@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/noto-sans-sc-chinese-simplified-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/noto-sans-sc-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/noto-sans-sc-chinese-simplified-700-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/noto-sans-sc-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html,
body,
#app {
  min-height: 100%;
  margin: 0;
}

/* 全免费商用字体栈：仅使用开源思源黑体（SIL OFL 1.1）与文泉驿微米黑（GPL/Apache 2.0）+ 通用无衬线回退 */
:root {
  --el-font-family: "Noto Sans SC", "Source Han Sans SC", "WenQuanYi Micro Hei", sans-serif;
}

body {
  background: #eef3f8;
  color: #172033;
  font-family: var(--el-font-family);
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: linear-gradient(135deg, #eef6ff 0%, #f8fafc 50%, #f1f5f9 100%);
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid #dbe5f0;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #1677ff;
  color: #fff;
  font-weight: 800;
}

.login-brand h1 {
  margin: 0;
  font-size: 22px;
}

.login-brand p {
  margin: 4px 0 0;
  color: #6b7890;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: #111827;
  color: #d8e1ef;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 16px;
}

.sidebar-brand strong {
  display: block;
  color: #fff;
}

.sidebar-brand span {
  color: #91a0b7;
  font-size: 12px;
}

.side-menu {
  border-right: 0;
  background: transparent;
}

.side-menu .el-menu-item {
  border-radius: 7px;
  color: #b7c2d5;
}

.side-menu .el-menu-item.is-active,
.side-menu .el-menu-item:hover {
  background: #1677ff;
  color: #fff;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 28px;
}

.eyebrow {
  color: #7b8aa4;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 3px;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-card {
  min-width: 190px;
  padding: 10px 14px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
  text-align: right;
}

.user-card strong,
.user-card span {
  display: block;
}

.user-card span {
  color: #16a34a;
  font-size: 12px;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  min-height: 108px;
  padding: 18px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
}

.metric-card span {
  color: #6b7890;
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 28px;
}

.metric-card small {
  color: #7b8aa4;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.sr-panel {
  margin-bottom: 16px;
  border-radius: 8px;
  border-color: #dbe5f0;
}

.map-panel {
  min-height: 460px;
}

.map-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  color: #6b7890;
  font-size: 12px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
}

.dot.online {
  background: #16a34a;
}

.dot.offline {
  background: #94a3b8;
}

.dot.unlocated {
  background: #f59e0b;
}

.admin-map {
  position: relative;
  height: 360px;
  overflow: hidden;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #eaf2fb;
}

.admin-map-canvas,
.map-fallback {
  position: absolute;
  inset: 0;
}

.hidden {
  display: none !important;
}

.map-fallback {
  overflow: hidden;
  background: #dcecfb;
}

.map-fallback p {
  position: absolute;
  left: 18px;
  top: 14px;
  z-index: 2;
  max-width: min(560px, calc(100% - 36px));
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .92);
  color: #536176;
  font-size: 12px;
  box-shadow: 0 6px 18px rgba(48, 69, 92, .08);
}

.fallback-pin {
  position: absolute;
  z-index: 3;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #1677ff;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(22, 119, 255, .25);
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.fallback-label {
  position: absolute;
  z-index: 2;
  max-width: 180px;
  overflow: hidden;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: #22304a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(48, 69, 92, .08);
  transform: translateY(-50%);
}

.tile-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.map-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
  -webkit-user-drag: none;
}

.tile-marker {
  position: absolute;
  z-index: 3;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 8px;
  background: #1677ff;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(22, 119, 255, .28);
  transform: translate(-50%, -85%) rotate(-45deg);
  cursor: pointer;
}

.tile-marker::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

.tile-marker.active {
  background: #16a34a;
  box-shadow: 0 10px 24px rgba(22, 163, 74, .32);
}

.tile-marker {
  font-size: 0;
}

.tile-label {
  position: absolute;
  z-index: 2;
  max-width: 180px;
  overflow: hidden;
  padding: 5px 8px;
  border: 1px solid #d7e4f2;
  border-radius: 4px;
  background: rgba(255, 255, 255, .95);
  color: #22304a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(48, 69, 92, .08);
  transform: translateY(-100%);
}

.map-info {
  display: grid;
  gap: 5px;
  min-width: 220px;
  color: #172033;
  font-size: 12px;
}

.map-info strong {
  font-size: 14px;
}

.map-info span {
  color: #536176;
}

.map-outlet-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.map-outlet-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 12px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  text-align: left;
  cursor: pointer;
}

.map-outlet-list strong,
.map-outlet-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-outlet-list span {
  color: #7b8aa4;
  font-size: 12px;
}

.map-outlet-list em {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: #1677ff;
  font-style: normal;
  font-weight: 700;
}

.panel-head {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.query-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.query-bar .el-input {
  width: 240px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  color: #6b7890;
  font-size: 13px;
}

.wallet-hero {
  margin-bottom: 16px;
  padding: 24px;
  border-radius: 8px;
  color: #fff;
  background: #1677ff;
}

.wallet-hero span {
  display: block;
  opacity: 0.86;
}

.wallet-hero strong {
  display: block;
  margin: 8px 0;
  font-size: 36px;
}

.wallet-action {
  margin-top: 14px;
}

.el-table .el-button + .el-button {
  margin-left: 6px;
}

.el-dialog .el-select,
.el-dialog .el-input,
.el-dialog .el-input-number,
.el-dialog .el-date-editor {
  width: 100%;
}

.location-picker-field {
  display: grid;
  gap: 10px;
}

.location-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.location-map-picker {
  position: relative;
  height: 260px;
  overflow: hidden;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #dcecfb;
  cursor: grab;
  touch-action: none;
}

.location-map-picker:active {
  cursor: grabbing;
}

.location-tile-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.location-map-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
  -webkit-user-drag: none;
}

.location-center-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 132px;
  height: 132px;
  border: 1px dashed rgba(22, 119, 255, .36);
  border-radius: 50%;
  background: rgba(22, 119, 255, .08);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.location-center-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 34px;
  height: 34px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 8px;
  background: #1677ff;
  color: transparent;
  box-shadow: 0 10px 24px rgba(22, 119, 255, .32);
  transform: translate(-50%, -90%) rotate(-45deg);
  pointer-events: none;
}

.location-center-pin::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

.location-status {
  margin: 0;
  color: #6b7890;
  font-size: 12px;
}

.compact-list {
  display: grid;
  gap: 10px;
}

.compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.muted {
  color: #7b8aa4;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.system-tabs {
  margin-bottom: 16px;
}

.el-table {
  --el-table-header-bg-color: #f8fafc;
}

@media (max-width: 960px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .workspace {
    padding: 16px;
  }

  .topbar,
  .grid-2,
  .pager {
    display: block;
  }

  .user-box,
  .query-bar {
    margin-top: 12px;
    flex-wrap: wrap;
  }
}
