/* ==========================================================================
   基础层与组件层
   --------------------------------------------------------------------------
   调性：工业仪表盘（Industrial / utilitarian）
     底色不是纯黑，是带绿的墨黑（仓库 / 粮食 / 钢铁的工业联想）；
     唯一强调色是琥珀金，只留给关键读数与关键动作；
     数据一律等宽数字，线条一律发丝级，氛围靠墨色层次而非渐变光晕。
   字体：Bebas Neue 承担大号读数（辨识度），IBM Plex Mono 承担坐标与序号，
        中文用系统黑体保证在各类终端上的可读性。
   ========================================================================== */

:root {
  --bg: #030705;
  --bg-2: #050c0a;
  --surface: rgba(6, 12, 10, 0.86);
  --surface-solid: #070f0d;
  --surface-2: #0a1512;

  --ink: #ece6d9;
  --ink-2: #b9c3bc;
  --muted: #71827a;
  --muted-2: #54635d;

  --accent: #e0a83f;
  --accent-bright: #ffd58a;
  --accent-dim: rgba(224, 168, 63, 0.14);

  --line: rgba(198, 220, 206, 0.1);
  --line-strong: rgba(198, 220, 206, 0.19);

  --ok: #4fbf95;
  --warn: #d9a441;
  --err: #d4665a;

  --radius: 3px;
  --radius-md: 6px;
  --radius-lg: 12px;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.62);

  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC", sans-serif;
  --font-display: "Bebas Neue", "IBM Plex Mono", var(--font-sans);
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 160ms;
  --dur-base: 320ms;
  --dur-slow: 640ms;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}
h2 {
  font-size: 15px;
  letter-spacing: 0.02em;
}
h3 {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.mono,
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---------- 氛围层：极淡的噪点，避免大面积纯色显得像死掉的灰阶 ---------- */
.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(70rem 50rem at 8% -12%, rgba(224, 168, 63, 0.045), transparent 62%),
    radial-gradient(60rem 46rem at 104% 8%, rgba(46, 118, 106, 0.04), transparent 58%);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 控件 ---------- */

.btn {
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 7px 15px;
  border: 1px solid transparent;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #14100a;
  font-weight: 500;
}
.btn-primary:hover {
  background: var(--accent-bright);
}
.btn-primary:disabled {
  background: rgba(224, 168, 63, 0.16);
  color: rgba(20, 16, 10, 0.5);
  cursor: not-allowed;
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.icon-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
}

.mini-btn {
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--radius-md);
  padding: 3px 9px;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.mini-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip {
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 4px 11px;
}
.chip.is-active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* 焦点可见性：键盘用户必须看得见自己停在哪 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.conn i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
  display: block;
  flex: none;
}
.conn.is-ok i {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(79, 191, 149, 0.16);
}
.conn.is-err i {
  background: var(--err);
  box-shadow: 0 0 0 3px rgba(212, 102, 90, 0.16);
}
.conn.is-local i {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.16);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 170px;
  transform: translate(-50%, 14px);
  background: #101a16;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 12.5px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base), transform var(--dur-base) var(--ease-out);
  z-index: 4000;
  max-width: 70vw;
}
.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast[data-kind="warn"] {
  border-color: rgba(224, 168, 63, 0.45);
  color: var(--accent-bright);
}

/* ---------- 主框架 ---------- */

main {
  position: relative;
  height: calc(100% - 62px);
  z-index: 2;
}
.view {
  position: absolute;
  inset: 0;
  display: none;
}
.view.is-active {
  display: block;
}

/* ---------- 后台台账 ---------- */

.view-admin {
  overflow-y: auto;
  padding: 30px 34px 70px;
}
.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.admin-head h2 {
  font-size: 21px;
  letter-spacing: 0.02em;
}
.admin-head p {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.admin-actions {
  display: flex;
  gap: 8px;
}

/* ---------------- 台账检索条 / 分页器 / 只读提示 ---------------- */
/* 控件条在表格之前、分页器在表格之后；两者都不进 thead/tbody（列数与行数被回归盯着） */

.lf-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.lf-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lf-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
}
.lf-input,
.lf-select {
  height: 30px;
  padding: 0 8px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.lf-input {
  width: 190px;
}
.lf-input:focus,
.lf-select:focus {
  outline: none;
  border-color: var(--accent);
}
.lf-btn {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.lf-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.lf-btn:disabled {
  opacity: 0.45;
  cursor: default;
  border-color: var(--line);
  color: var(--muted-2);
}
.lf-btn.is-on {
  border-color: var(--accent);
  color: var(--accent);
}
.lf-count {
  margin-left: auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.lf-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0 2px;
}
.lf-size-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.lf-size {
  width: auto;
  padding: 2px 6px;
  font-size: 12px;
}
.lf-page {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.table-note {
  padding: 10px 16px 12px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.table-wrap {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.1em;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
  color: var(--ink-2);
}
.data-table tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr {
  transition: background var(--dur-fast);
}
.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}
.data-table .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.data-table .name-cell {
  color: var(--ink);
  font-weight: 500;
}
.data-table .sub {
  display: block;
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 2px;
}
.col-ops {
  text-align: right;
}
.ops {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
}
.link-btn {
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  background: transparent;
  border: 0;
  color: var(--accent);
  padding: 4px 7px;
  border-radius: 4px;
}
.link-btn:hover {
  background: var(--accent-dim);
}
.link-btn.danger {
  color: var(--err);
}
.link-btn.danger:hover {
  background: rgba(212, 102, 90, 0.12);
}

.type-badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  color: var(--tc);
  background: color-mix(in srgb, var(--tc) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tc) 34%, transparent);
}

.empty {
  padding: 48px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- 弹窗 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(2, 6, 5, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal[hidden] {
  display: none;
}
.modal-card {
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 440px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: card-in var(--dur-base) var(--ease-out) both;
}
@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
}
.modal-card-wide {
  width: 940px;
}
.modal-card-form {
  width: 1040px;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 13px;
  border-bottom: 1px solid var(--line);
}
.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
  background: rgba(255, 255, 255, 0.015);
}
.panel-sub {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}
/* 设置弹窗底部常驻版本信息：手机端顶栏角标隐藏后，这里是核对版本的入口 */
.set-ver {
  margin-right: auto;
  font-size: 10.5px;
  color: var(--muted);
  opacity: .8;
  white-space: nowrap;
}
.form-msg {
  margin-right: auto;
  font-size: 12px;
  color: var(--muted);
}
.form-msg.is-err {
  color: var(--err);
}
.form-msg.is-warn {
  color: var(--accent);
}

/* 三维场景 */
.scene-wrap {
  position: relative;
  background: #07100d;
}
.scene {
  width: 100%;
  height: min(58vh, 520px);
}
.scene canvas {
  display: block;
}
.scene-hud {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  gap: 6px;
}
.hud-btn {
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  background: rgba(10, 20, 17, 0.86);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  color: var(--ink-2);
  backdrop-filter: blur(8px);
}
.hud-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.hud-btn.is-active {
  background: var(--accent);
  color: #14100a;
  border-color: var(--accent);
}
.scene-note {
  position: absolute;
  right: 16px;
  bottom: 16px;
  font-size: 11px;
  color: var(--ink-2);
  background: rgba(10, 20, 17, 0.86);
  padding: 5px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
}

/* 三维弹窗的天地图署名：放在画布外，不跟 HUD / 读数抢位置，窄屏也不会被挤掉 */
.scene-credit {
  padding: 8px 20px 10px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  text-align: right;
}

/* 表单 */
.form-body {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 0;
  overflow: hidden;
}
.form-fields {
  padding: 18px 20px;
  overflow-y: auto;
  max-height: calc(100vh - 210px);
}
.form-preview {
  border-left: 1px solid var(--line);
  background: #070f0d;
  display: flex;
  flex-direction: column;
}
.preview-scene {
  flex: 1;
  min-height: 260px;
}
.preview-scene canvas {
  display: block;
}
.preview-note {
  font-size: 11px;
  color: var(--muted);
  padding: 10px 14px;
  margin: 0;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  min-width: 0;
}
.field > span {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.field input,
.field select {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.03);
  width: 100%;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.field input:hover,
.field select:hover {
  border-color: rgba(198, 220, 206, 0.3);
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(224, 168, 63, 0.05);
}
.field input[readonly] {
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted);
}
.field input::placeholder {
  color: var(--muted-2);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* 多行内容（主导产业表）：等宽字方便对齐"市名: 产业, 产业"的列 */
.field-area textarea {
  font: inherit;
  font-size: 12.5px;
  line-height: 1.75;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, 'Noto Sans Mono CJK SC', monospace;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  width: 100%;
  resize: vertical;
  min-height: 120px;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.field-area textarea:hover {
  border-color: rgba(198, 220, 206, 0.3);
}
.field-area textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(224, 168, 63, 0.05);
}
.area-count {
  float: right;
  font-size: 11px;
  color: var(--accent-bright);
  font-weight: 500;
}
/* 有行没认出来：不是报错，是提醒——多半个是冒号写成了空格 */
.area-count.is-warn {
  color: #e8894a;
}

.type-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.type-card {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 10px 11px;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.type-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.type-card b {
  font-size: 13px;
  font-weight: 500;
}
.type-card em {
  font-size: 10.5px;
  color: var(--muted);
  font-style: normal;
  line-height: 1.4;
}
.type-card:hover {
  border-color: rgba(198, 220, 206, 0.32);
}
.type-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.type-card:has(input:checked) b {
  color: var(--accent-bright);
}
.type-card:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.attr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.attr-head > span {
  font-size: 11.5px;
  color: var(--muted);
}
.attr-rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.attr-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 26px;
  gap: 7px;
  align-items: center;
}
.attr-row input {
  font: inherit;
  font-size: 12px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
}
.attr-row button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
  height: 26px;
}
.attr-row button:hover {
  background: rgba(212, 102, 90, 0.14);
  color: var(--err);
}

.settings-body {
  padding: 18px 20px;
}
.hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.75;
  margin: -2px 0 14px;
}
.loc-actions {
  display: flex;
  gap: 5px;
}
.mat-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

/* ---------- 地图底座 ---------- */

.map {
  position: absolute;
  inset: 0;
  background: #050b0a;
}
.maplibregl-map {
  font-family: var(--font-sans);
}
.map.no-tk {
  background-image: radial-gradient(rgba(120, 170, 155, 0.09) 1px, transparent 1px);
  background-size: 26px 26px;
}
.maplibregl-ctrl-group {
  border-radius: var(--radius-md) !important;
  box-shadow: none !important;
  background: rgba(9, 17, 14, 0.9) !important;
  border: 1px solid var(--line-strong);
  overflow: hidden;
}
.maplibregl-ctrl-group button {
  width: 30px;
  height: 30px;
}
.maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--line);
}
.maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: invert(0.78) sepia(0.15) saturate(0.6);
}
.maplibregl-ctrl-attrib {
  font-size: 10px;
  background: rgba(5, 11, 10, 0.6) !important;
  color: var(--muted-2) !important;
}
.maplibregl-ctrl-attrib a {
  color: var(--muted) !important;
}
.maplibregl-ctrl-attrib.maplibregl-compact {
  margin: 0 8px 8px 0;
}
.maplibregl-ctrl-scale {
  background: rgba(5, 11, 10, 0.6) !important;
  border-color: var(--line-strong) !important;
  color: var(--muted) !important;
  font-family: var(--font-mono);
  font-size: 10px;
}

/* 悬停气泡只做提示，不能吃掉点击 */
.maplibregl-popup.wh-pop {
  pointer-events: none !important;
}
.maplibregl-popup.wh-pop .maplibregl-popup-content {
  background: #101a16;
  color: var(--ink);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  box-shadow: none;
  pointer-events: none !important;
  white-space: nowrap;
}
.maplibregl-popup.wh-pop .maplibregl-popup-tip {
  display: none;
}

/* 城市名标签 */
.city-label {
  width: 0;
  height: 0;
  pointer-events: none;
  transition: opacity var(--dur-base);
}
.city-label span {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #cddbd3;
  white-space: nowrap;
  text-shadow: 0 0 6px #030807, 0 0 14px #030807;
  pointer-events: none;
}
.city-label.is-empty span {
  color: #5c6e66;
}
.city-label.is-top span {
  color: var(--accent-bright);
  font-weight: 600;
}
/* 触摸设备：城市名本身是点击目标（桌面仍让 canvas 接管 hover，不抢鼠标） */
@media (pointer: coarse) {
  .city-label.is-clickable,
  .city-label.is-clickable span {
    pointer-events: auto;
    cursor: pointer;
  }
  .city-label.is-clickable span {
    padding: 6px 8px;
    touch-action: manipulation;
  }
  .city-label.is-clickable:focus-visible span {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }
}

/* 区县名（市级视图）：比地市名小一号、淡一档——十几个名字要同时浮在三维体块上，
   字号再大就喧宾夺主；放大到库区尺度时由 JS 挂 .is-off 整体淡出 */
.county-label {
  width: 0;
  height: 0;
  pointer-events: none;
  transition: opacity var(--dur-base);
}
.county-label span {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #9db1a7;
  white-space: nowrap;
  text-shadow: 0 0 5px #030807, 0 0 12px #030807, 0 0 3px #030807;
  pointer-events: none;
  transition: color var(--dur-fast);
}
.county-label.is-empty span {
  color: #55665f;
}
.county-label.is-top span {
  color: var(--accent-bright);
  font-weight: 600;
}
.county-label.is-hot span {
  color: #ffe0a8;
}
.county-label.is-active span {
  color: var(--accent-bright);
  font-weight: 600;
}
.county-label.is-off {
  opacity: 0;
}
/* 挤不下时让位；但悬停/选中的那一个必须露出来，否则鼠标指到哪都看不见名字 */
.county-label.is-tight:not(.is-hot):not(.is-active) {
  opacity: 0;
}

/* 仓库点位 */
.wh-pin {
  cursor: pointer;
}
.wh-pin .pin {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tc, #e0703a);
  border: 1.5px solid #0a1411;
  box-shadow: 0 0 0 1px var(--tc, #e0703a), 0 0 16px color-mix(in srgb, var(--tc, #e0703a) 55%, transparent);
  transition: transform var(--dur-fast);
}
.wh-pin .pin-ring {
  position: absolute;
  left: -14px;
  top: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0;
}
.wh-pin.steel {
  --tc: #e0703a;
}
.wh-pin.standard {
  --tc: #4f93d1;
}
.wh-pin.silo_steel {
  --tc: #c9a53f;
}
.wh-pin.silo_concrete {
  --tc: #8f7fc4;
}
.wh-pin.is-active {
  color: var(--accent-bright);
}
.wh-pin.is-active .pin {
  transform: scale(1.4);
  background: var(--accent-bright);
  box-shadow: 0 0 0 2px var(--accent-bright), 0 0 26px rgba(255, 213, 138, 0.6);
}
.wh-pin.is-active .pin-ring {
  opacity: 0.55;
  animation: halo 1.9s ease-out infinite;
}

/* 点位代表库区，角标写"这个园区里有几栋仓"；只有 1 栋时不显示，避免噪音 */
.wh-pin .pin-count {
  position: absolute;
  left: 5px;
  top: -15px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--accent);
  color: #14100a;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 0 0 1.5px rgba(5, 11, 10, 0.92);
  pointer-events: none;
}
.wh-pin.is-active .pin-count {
  background: var(--accent-bright);
  box-shadow: 0 0 0 1.5px rgba(5, 11, 10, 0.92), 0 0 14px rgba(255, 213, 138, 0.5);
}
@keyframes halo {
  0% {
    transform: scale(0.65);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

.draw-tip {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: rgba(16, 26, 22, 0.95);
  border: 1px solid var(--accent);
  color: var(--accent-bright);
  font-size: 12px;
  padding: 8px 15px;
  border-radius: var(--radius-md);
  z-index: 600;
}

.banner {
  position: absolute;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(31, 25, 12, 0.92);
  border: 1px solid rgba(224, 168, 63, 0.4);
  color: var(--accent-bright);
  font-size: 12px;
  padding: 8px 10px 8px 15px;
  border-radius: var(--radius-md);
  z-index: 500;
  backdrop-filter: blur(8px);
  /* 横幅正文不拦截地图；只有「去填写」按钮可点 */
  pointer-events: none;
}
.banner-btn {
  pointer-events: auto;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid rgba(224, 168, 63, 0.5);
  background: transparent;
  color: var(--accent-bright);
  border-radius: 4px;
  padding: 3px 10px;
  flex: none;
  white-space: nowrap;
}
.banner > span {
  min-width: 0;
}

/* ---------- 拍照建模 ---------- */

.modal-card-photo {
  width: 1180px;
  max-width: calc(100vw - 40px);
  position: relative;
}
.photo-body {
  display: grid;
  grid-template-columns: 1fr 400px;
  min-height: 560px;
}
.photo-left {
  padding: 16px 18px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}
.photo-right {
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.014);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}
.photo-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.pstep {
  font-size: 11px;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  letter-spacing: 0.04em;
}
.pstep.is-on {
  background: var(--accent);
  color: #14100a;
}
.pstep.is-done {
  background: var(--accent-dim);
  color: var(--accent);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.slot-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.015);
  transition: border-color var(--dur-fast);
}
.slot-card.has-photo {
  border-color: var(--line-strong);
}
.slot-card.is-core {
  background: rgba(224, 168, 63, 0.04);
}
.slot-head {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
}
.slot-head b {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 500;
  display: grid;
  place-items: center;
  flex: none;
}
.slot-card.has-photo .slot-head b {
  background: var(--accent);
  color: #14100a;
}
.slot-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot-thumb {
  aspect-ratio: 16 / 10;
  border-radius: 4px;
  background: #08120f;
  overflow: hidden;
  display: grid;
  place-items: center;
  position: relative;
  border: 1px dashed var(--line-strong);
}
.slot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.slot-thumb .ph {
  font-size: 10.5px;
  color: var(--muted-2);
}
.slot-badge {
  position: absolute;
  left: 4px;
  top: 4px;
  font-size: 9.5px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 3px;
  background: rgba(5, 11, 10, 0.75);
  color: var(--ink);
}
.slot-badge.is-ok {
  background: rgba(224, 168, 63, 0.88);
  color: #14100a;
}
.slot-how {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  min-height: 30px;
}
.slot-ops {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.slot-ops button {
  font: inherit;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink-2);
}
.slot-ops button:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.photo-tip {
  font-size: 10.5px;
  color: var(--muted);
  margin: 12px 0 0;
  line-height: 1.7;
}

.side-head .mini-btn {
  border-style: solid;
  border-color: rgba(224, 168, 63, 0.5);
  color: var(--accent);
}
.side-head .mini-btn:hover {
  background: var(--accent);
  color: #14100a;
}
.side-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.side-head h3 {
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 2px;
  color: var(--ink);
}
.analyze-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.analyze-list .hint {
  margin: 0;
}
.an-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.an-item b {
  font-weight: 400;
  color: var(--muted);
  font-size: 11.5px;
  flex: none;
}
.an-item span {
  color: var(--ink);
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.an-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  flex: none;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 6px;
}
.an-warn {
  font-size: 11px;
  color: var(--accent);
  background: rgba(224, 168, 63, 0.08);
  padding: 7px 11px;
  border-radius: var(--radius-md);
  line-height: 1.65;
}

.mat-editor {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mat-row {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.mat-row:first-child {
  border-top: 0;
}
.mat-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.mat-row-head > span {
  font-size: 11.5px;
  color: var(--ink-2);
}
.mat-row-head em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  padding: 0;
  transition: box-shadow var(--dur-fast), transform var(--dur-fast);
}
.swatch:hover {
  transform: translateY(-1px);
}
.swatch.is-on {
  box-shadow: 0 0 0 2px var(--accent);
}
.mat-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.mat-toggle input {
  accent-color: var(--accent);
}
.mat-note {
  font-size: 10.5px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.65;
}

/* 墙角标注 */
.corner-editor {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: var(--surface-solid);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}
.ce-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.ce-head b {
  display: block;
  font-size: 13px;
  font-weight: 500;
}
.ce-head span {
  font-size: 11px;
  color: var(--muted);
}
.ce-ops {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ce-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  min-height: 0;
}
.ce-stage {
  position: relative;
  background: #030807;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 380px;
}
#ce-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}
.ce-handles {
  position: absolute;
  inset: 0;
}
.ce-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #14100a;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  cursor: grab;
  touch-action: none;
  z-index: 2;
}
.ce-handle.is-drag {
  cursor: grabbing;
  transform: scale(1.14);
}
.ce-side {
  border-left: 1px solid var(--line);
  padding: 12px;
  background: rgba(255, 255, 255, 0.014);
  overflow-y: auto;
}
.ce-label {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}
#ce-preview {
  width: 100%;
  border-radius: 4px;
  background: #000;
  display: block;
}
.ce-stat {
  font-size: 10.5px;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.65;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1280px) {
  .modal-card-form {
    width: 860px;
  }
  .form-body {
    grid-template-columns: 1fr 320px;
  }
  .type-picker {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1080px) {
  .modal-card-form {
    width: 720px;
  }
  .form-body {
    grid-template-columns: 1fr;
  }
  .form-preview {
    display: none;
  }
  .photo-body {
    grid-template-columns: 1fr;
  }
  .photo-left {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .view-admin {
    padding: 20px 16px 60px;
  }
  .admin-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .slot-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .field-row,
  .field-row-3 {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   后台设置（由 config.js 的 schema 生成）
   --------------------------------------------------------------------------
   左导航 + 右侧分组表单。表单控件与仓储表单共用 .field 的观感，
   只有密钥那一块特殊：它永远只显示尾号，不给"看明文"的入口。
   ========================================================================== */

.modal-card-settings {
  width: 900px;
  height: min(80vh, 660px);
}

.settings-body {
  display: flex;
  flex: 1;
  min-height: 0;
  border-bottom: 1px solid var(--line);
}

.set-nav {
  width: 170px;
  flex: none;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}

.set-tab {
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  color: var(--muted);
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  padding: 9px 11px;
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);
}
.set-tab:hover {
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.03);
}
.set-tab.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border-left-color: var(--accent);
}

.set-panes {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 15px 20px 18px;
}

.set-pane {
  display: none;
}
.set-pane.is-active {
  display: block;
  animation: pane-in 220ms var(--ease-out) both;
}
@keyframes pane-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.set-desc {
  margin: 0 0 16px;
  font-size: 11.5px;
  line-height: 1.62;
  color: var(--muted);
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}

.field-hint {
  font-size: 11px;
  font-style: normal;
  line-height: 1.55;
  color: var(--muted-2);
}

.cfg-inline {
  display: flex;
  align-items: center;
  gap: 9px;
}
.cfg-inline input {
  flex: 1;
}
.cfg-unit {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- 品牌角标：文字 / 图片 二选一 ---------- */
.mark-mode-tag {
  float: right;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--accent);
}
.mark-image-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 2px 0 4px;
}
.mark-preview {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  place-items: center;
  padding: 3px;
  border-radius: 3px;
  overflow: hidden;
  background: linear-gradient(150deg, var(--accent), #8a6220);
  color: #0c0906;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.mark-preview i {
  font-style: normal;
}
.mark-preview.has-image {
  display: block;
  padding: 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-strong);
}
.mark-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.mark-image-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.mark-image-btns .field-hint {
  flex-basis: 100%;
}
.mark-image-btns .mini-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
@media (max-width: 640px) {
  .mark-image-row {
    gap: 10px;
  }
  .mark-preview {
    width: 40px;
    height: 40px;
    font-size: 11px;
  }
}

.cfg-range > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cfg-out {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.cfg-range input[type="range"] {
  padding: 0;
  height: 20px;
  border: none;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}

.cfg-color .cfg-inline input[type="color"] {
  flex: none;
  width: 46px;
  height: 32px;
  padding: 2px;
  cursor: pointer;
}
.cfg-hex {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  text-transform: uppercase;
}

/* 开关行：整行可点，比 checkbox 本身好按 */
.cfg-switch {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
}
.cfg-switch:last-of-type {
  border-bottom: none;
}
.cfg-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cfg-switch .switch {
  flex: none;
  width: 34px;
  height: 19px;
  margin-top: 2px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--line-strong);
  position: relative;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.cfg-switch .switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform var(--dur-fast), background var(--dur-fast);
}
.cfg-switch input:checked + .switch {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.cfg-switch input:checked + .switch::after {
  transform: translateX(15px);
  background: var(--accent);
}
.cfg-switch input:focus-visible + .switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cfg-switch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cfg-switch-text b {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}

/* 密钥：永远只出现尾号 */
.field-secret {
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 14px;
}
.secret-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
#tk-mask {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--ink-2);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 10px;
}
.secret-tag {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  padding: 2px 8px;
}
.secret-input {
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}
.mini-btn.danger {
  color: var(--err);
  border-color: rgba(212, 102, 90, 0.4);
}

@media (max-width: 900px) {
  .modal-card-settings {
    width: 100%;
    height: min(92vh, 700px);
  }
  .settings-body {
    flex-direction: column;
  }
  .set-nav {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 6px;
    gap: 4px;
  }
  .set-tab {
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 4px 4px 0 0;
    white-space: nowrap;
  }
  .set-tab.is-active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }
}

/* 设置里的运维动作区（数据源分组底部） */
.cfg-actions {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.cfg-actions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 11.5px;
  color: var(--muted);
}
.cfg-actions-head em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}
.cfg-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

/* ==========================================================================
   管理模式门禁（系统设置 → 后台与权限）
   --------------------------------------------------------------------------
   两套卡片：锁定态只要一个口令框，解锁态给台账入口 + 改口令 + 退出。
   用 hidden 切换而不是重建 DOM，避免输入到一半被重绘冲掉。
   ========================================================================== */

.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  border-radius: 2px;
  padding: 4px 9px;
  cursor: pointer;
  white-space: nowrap;
}
.admin-chip::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}
/* 平板与小窗下顶栏本来就挤：徽标收成一个亮点，省下的 56px 留给标题和导航 */
@media (max-width: 900px) {
  .admin-chip {
    font-size: 0;
    gap: 0;
    padding: 5px 7px;
  }
  .admin-chip::before {
    width: 7px;
    height: 7px;
  }
}

.gate-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gate-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}
.gate-head b {
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.gate-head span {
  font-size: 11.5px;
  line-height: 1.62;
  color: var(--muted);
}
.gate-head.is-ok {
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.gate-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gate-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}
.gate-form input {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.03);
  width: 100%;
  min-width: 0;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.gate-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(224, 168, 63, 0.05);
}
.gate-form input::placeholder {
  color: var(--muted-2);
}

@media (max-width: 620px) {
  .gate-form {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   安装到桌面（系统设置 → 安装到手机）
   ========================================================================== */

.btn-block {
  width: 100%;
  justify-content: center;
}

.install-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.install-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

.install-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.install-icon img {
  display: block;
  width: 100%;
  height: 100%;
}

.install-head b {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.install-head em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
}
.install-head em[data-state="ready"],
.install-head em[data-state="installed"] {
  color: var(--accent);
}
.install-head em[data-state="ios"] {
  color: #8fb6a8;
}

.install-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: step;
}

.install-steps li {
  counter-increment: step;
  position: relative;
  padding: 10px 12px 10px 38px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}
.install-steps li::before {
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 10px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 17px;
  text-align: center;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

.install-steps b {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.install-steps span {
  display: block;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--muted);
}
.install-steps span b {
  display: inline;
  font-size: inherit;
  color: var(--accent);
}

.install-foot {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
}

/* ==========================================================================
   手机上的台账：一张 9 列的宽表在 390px 屏上怎么排都是灾难（横向被裁掉一半），
   所以这里把每行改成一张卡片：编号当小标题、名称当主标题、库容右上角、操作放底部。
   纯 CSS 改造，不动数据与交互，桌面端完全不受影响。
   ========================================================================== */

@media (max-width: 640px) {
  .view-admin {
    padding: 16px 14px calc(40px + env(safe-area-inset-bottom));
  }
  .admin-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .admin-actions {
    width: 100%;
  }
  .admin-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .table-wrap {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  #wh-table thead {
    display: none;
  }
  #wh-table,
  #wh-table tbody,
  #wh-table tr,
  #wh-table td {
    display: block;
    width: auto;
  }
  #wh-table tr {
    position: relative;
    margin: 0 0 10px;
    padding: 12px 14px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
  }
  #wh-table td {
    padding: 0;
    border: 0;
    font-size: 12px;
    color: var(--ink-2);
  }

  /* 编号 */
  #wh-table td:nth-child(1) {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 3px;
  }
  /* 名称 */
  #wh-table td:nth-child(2) {
    font-size: 14px;
    line-height: 1.35;
    color: var(--ink);
    padding-right: 76px;
    margin-bottom: 5px;
  }
  /* 所属库区 / 所在地 */
  #wh-table td:nth-child(3),
  #wh-table td:nth-child(4) {
    font-size: 11.5px;
    color: var(--muted);
    padding-left: 34px;
    position: relative;
  }
  #wh-table td:nth-child(3)::before {
    content: "库区";
    position: absolute;
    left: 0;
    color: var(--muted-2);
    font-size: 10.5px;
  }
  #wh-table td:nth-child(4)::before {
    content: "地址";
    position: absolute;
    left: 0;
    color: var(--muted-2);
    font-size: 10.5px;
  }
  #wh-table td:nth-child(3) .sub,
  #wh-table td:nth-child(4) .sub {
    display: none;
  }
  /* 类型 */
  #wh-table td:nth-child(5) {
    margin-top: 7px;
  }
  /* 尺寸与面积：手机上省略，点开编辑里都有 */
  #wh-table td:nth-child(6),
  #wh-table td:nth-child(7) {
    display: none;
  }
  /* 库容挪到右上角 */
  #wh-table td:nth-child(8) {
    position: absolute;
    top: 26px;
    right: 14px;
    font-size: 12.5px;
    color: var(--accent);
    text-align: right;
  }
  #wh-table td:nth-child(8)::before {
    content: "库容 ";
    font-size: 10px;
    color: var(--muted);
  }
  #wh-table td:nth-child(8) .vol-u {
    display: inline;
  }
  /* 操作 */
  #wh-table td:nth-child(9) {
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
  }
  #wh-table .ops {
    display: flex;
    gap: 8px;
  }
  #wh-table .ops .link-btn {
    flex: 1;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-align: center;
    font-size: 12px;
  }
}

/* 台账「库容」的单位：桌面表头已写单位，手机卡片没有表头才显示 */
.vol-u {
  display: none;
  font-style: normal;
  font-size: 10px;
  color: var(--muted);
  margin-left: 2px;
}

/* ==================== 仓库码 / 盘点 / 拍照入库 ==================== */

.modal-card-qr {
  width: 420px;
}
.qr-body {
  padding: 18px 20px 6px;
  text-align: center;
}
.qr-body img {
  width: 220px;
  height: 220px;
  image-rendering: pixelated;
  background: #fff;
  padding: 10px;
  border-radius: 4px;
}
.qr-hint {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
  margin: 14px 0 8px;
}
.qr-link {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  word-break: break-all;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  padding: 7px 9px;
  border-radius: 3px;
}

.modal-card-checkin {
  width: 600px;
}
.checkin-body {
  padding: 4px 20px 8px;
  max-height: min(64vh, 620px);
  overflow: auto;
}
.ck-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px;
}
.ck-last {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 14px;
}
.ck-last b {
  color: var(--accent-bright);
  font-weight: 500;
}
.ck-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.ck-grid .field {
  margin: 0;
}
.ck-shot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.ck-shot img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}
.ck-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.ck-thumbs img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 3px;
}

/* 表单里的现场照片 */
.quick-shot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.quick-shot img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}

/* 手机上的「拍照入库」：悬在工具条上方，避开抽屉 */
.quick-add {
  position: absolute;
  right: 12px;
  bottom: 62px;
  z-index: 520;
  font: inherit;
  font-size: 12.5px;
  color: #0a1310;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  display: none;
  cursor: pointer;
}
.quick-add[hidden] {
  display: none;
}
@media (max-width: 860px) {
  .quick-add {
    display: inline-flex;
    align-items: center;
    bottom: calc(64px + env(safe-area-inset-bottom));
  }
}

/* 回收站 */
.recycle-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}
.recycle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.rr-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rr-name em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
}
.rr-time {
  font-size: 10.5px;
  color: var(--muted-2);
}
@media (max-width: 560px) {
  .ck-grid {
    grid-template-columns: 1fr;
  }
  .recycle-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 6px;
  }
  .rr-time {
    grid-column: 1 / -1;
  }
}
.ck-thumbs .rank-empty {
  grid-column: 1 / -1;
  white-space: nowrap;
}

/* 手机端弹窗底部：提示消息不能被三个按钮挤成一列竖排字。
   版本信息、消息、按钮各占一行；空消息直接收起，不占高度。 */
@media (max-width: 640px) {
  .modal-foot {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 10px;
    padding: 10px 14px;
  }
  .modal-foot .set-ver,
  .modal-foot .form-msg {
    flex: 1 1 100%;
    min-width: 0;
    margin-right: 0;
    white-space: normal;
    line-height: 1.45;
  }
  .modal-foot .form-msg {
    max-height: 2.9em;
    overflow: hidden;
  }
  .modal-foot .form-msg:empty {
    display: none;
  }
  .modal-foot .btn {
    flex: 0 1 auto;
  }
}
/* 三维画布必须按容器缩放：three 用 setSize(w, h, false) 只设绘制缓冲，配合 setPixelRatio(≤2)，
   2x 屏上画布元素会被撑成两倍宽（实测手机 1876px、表单预览 20832px 高），模型被裁到只剩一角；
   表单预览还会「画布撑高容器 → ResizeObserver 再放大」，必须绝对定位断掉这个循环。 */
.scene canvas{width:100%;height:100%}
.preview-scene{position:relative;overflow:hidden}
.preview-scene canvas{position:absolute;inset:0;width:100%;height:100%}
@media (max-width:860px){
  .modal{padding:10px}
  .modal-card,.modal-card-wide,.modal-card-form{width:100%;max-width:calc(100vw - 20px)}
  .scene{height:min(44vh,300px)}
  .scene-hud{left:10px;bottom:10px;flex-wrap:wrap;max-width:calc(100% - 20px)}
  .scene-note{top:10px;right:10px;bottom:auto;max-width:58%;text-align:right}
}

/* 名称与类型不一致时的提示：改类型不改名字，标题会一直显示旧类型词 */
.name-sync {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--accent-bright, #e0a83f);
}
.name-sync .link-btn {
  color: inherit;
  text-decoration: underline;
  font-size: 12px;
}

/* ==================== 批量导入 ==================== */
.modal-card-import {
  width: 880px;
}
.import-body {
  padding: 16px 20px 6px;
  max-height: min(62vh, 560px);
  overflow: auto;
}
.import-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.import-datum {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
.import-datum select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: inherit;
  font-size: 12px;
  padding: 5px 8px;
}
.import-summary {
  padding: 14px 0 10px;
}
.imp-hint {
  font-size: 12px;
  color: var(--muted);
}
.imp-nums {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--muted);
}
.imp-nums b {
  display: block;
  font-size: 20px;
  line-height: 1.2;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.imp-nums .imp-bad b {
  color: var(--err);
}
.imp-sub {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.imp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.imp-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.imp-list li i {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
  min-width: 58px;
}
.imp-list li em {
  font-style: normal;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}
.imp-list li span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.imp-list .is-bad em {
  background: rgba(224, 90, 90, 0.18);
  color: var(--err);
}
.imp-list .is-bad span {
  color: var(--err);
}
.imp-list .is-warn em {
  background: rgba(201, 165, 63, 0.18);
  color: var(--accent);
}
.imp-list .is-del em {
  background: rgba(224, 90, 90, 0.12);
}
.imp-list .is-new em {
  background: rgba(79, 147, 209, 0.18);
}
@media (max-width: 860px) {
  .modal-card-import {
    width: 100%;
  }
  .import-datum {
    margin-left: 0;
  }
}
