/* ================= 机位图后台 · 样式 ================= */
:root {
  --bg: #0a0f1a;
  --panel: #101827;
  --panel2: #16203a;
  --line: #22304a;
  --txt: #dbe6f7;
  --dim: #8392ad;
  --pri: #2b7cff;
  --pri2: #4fc8ff;
  --ok: #35d07f;
  --warn: #ffa300;
  --err: #ff5d6c;
}
body.light {
  --bg: #f4f7fc;
  --panel: #ffffff;
  --panel2: #eef3fb;
  --line: #d8e1ef;
  --txt: #16233a;
  --dim: #5d6b82;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--txt); font-size: 13.5px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  overflow: hidden;
}
button, input, select, textarea { font-family: inherit; font-size: 13px; color: var(--txt); }
button {
  background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; transition: .12s;
}
button:hover { border-color: #3b8dff; color: #cfe1ff; }
button:active { transform: translateY(1px); }
button.pri { background: var(--pri); border-color: var(--pri); color: #fff; font-weight: 600; }
button.pri:hover { background: #3f8bff; }
button.danger { border-color: #6b2a33; color: #ff97a2; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea {
  background: #0c1322; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%; outline: none;
}
body.light input, body.light select, body.light textarea { background: #fff; }
input:focus, select:focus, textarea:focus { border-color: var(--pri); }
input[type=range] { padding: 0; height: 22px; accent-color: var(--pri); }
input[type=color] { padding: 2px; height: 32px; cursor: pointer; }
textarea { resize: vertical; line-height: 1.55; }
a { color: var(--pri2); }
.hide { display: none !important; }
.tag {
  display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 12px;
  background: var(--panel2); color: var(--dim); border: 1px solid var(--line);
}
.tag.ok { color: #4ade80; border-color: #23543a; }
.tag.off { color: #ff8f9a; border-color: #5b2d34; }

/* ---------- 顶栏 ---------- */
#app { display: grid; grid-template-rows: 54px 1fr; height: 100%; }
#topbar {
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
#topbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; margin-right: 10px; }
#topbar .brand i {
  width: 22px; height: 22px; border-radius: 6px; display: inline-block;
  background: linear-gradient(135deg, #2b7cff, #4fc8ff);
}
#topbar nav { display: flex; gap: 4px; }
#topbar nav a {
  padding: 7px 12px; border-radius: 8px; color: var(--dim); text-decoration: none; font-size: 13.5px;
}
#topbar nav a.on, #topbar nav a:hover { background: var(--panel2); color: var(--txt); }
#topbar .sp { flex: 1; }
#topbar .who { color: var(--dim); font-size: 12.5px; }

/* ---------- 列表 ---------- */
.view { display: none; overflow: auto; padding: 18px; }
.view.on { display: block; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px;
}
.card h3 { font-size: 14.5px; margin-bottom: 12px; font-weight: 600; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > * { min-width: 0; }
.f { display: block; font-size: 12.5px; color: var(--dim); margin-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--dim); font-weight: 500; font-size: 12.5px; }
tr:hover td { background: rgba(43, 124, 255, .05); }
.cover { width: 96px; height: 54px; border-radius: 6px; object-fit: cover; background: #0b1220; border: 1px solid var(--line); }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; }
.pcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; transition: .15s;
}
.pcard:hover { border-color: var(--pri); transform: translateY(-2px); }
.pcard .thumb { height: 146px; background: #0b1220 center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: #33415c; font-size: 12px; }
.pcard .meta { padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.pcard .meta b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.pcard .ops { display: flex; gap: 6px; padding: 0 12px 12px; flex-wrap: wrap; }
.pcard .ops button { padding: 5px 8px; font-size: 12px; }

/* ---------- 编辑器 ---------- */
#viewEdit {
  display: none; position: relative; height: 100%; min-height: 0; overflow: hidden;
  grid-template-rows: 56px minmax(0, 1fr) 34px; grid-template-columns: 64px 1fr 300px;
}
#viewEdit.on { display: grid; }
#editBar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; padding: 0 12px;
  background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden;
}
#editBar::-webkit-scrollbar { height: 0; }
#editBar .title { font-weight: 600; font-size: 14.5px; cursor: pointer; padding: 4px 6px; border-radius: 6px; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#editBar .title:hover { background: var(--panel2); }
#editBar select { width: auto; padding: 5px 8px; flex: none; }
#editBar .iconbtn { min-width: 34px; padding: 5px 6px; text-align: center; font-size: 15px; line-height: 1.1; }
#zoomRange { width: 92px; padding: 0; flex: none; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; flex: none; }
.sp { flex: 1; }
.menuWrap { position: relative; flex: none; }
.menu {
  position: fixed; min-width: 198px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px; display: none; z-index: 900; box-shadow: 0 18px 44px rgba(0, 0, 0, .5);
}
.menu.on { display: block; }
.menu button { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 8px 10px; border-radius: 7px; color: var(--txt); font-size: 13px; }
.menu button:hover { background: var(--panel2); }
.menuSep { height: 1px; background: var(--line); margin: 5px 6px; }

#rails {
  background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  align-items: center; gap: 3px; padding: 6px 0; overflow: auto;
}
#rails::-webkit-scrollbar { width: 5px; }
#rails::-webkit-scrollbar-thumb { background: #243149; border-radius: 3px; }
#rails button {
  width: 58px; min-height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 3px 0; font-size: 9.5px; line-height: 1.2; color: var(--dim);
  background: transparent; border-color: transparent; flex: none;
}
#rails button b { font-size: 15px; line-height: 1; font-weight: 400; }
#rails button:hover, #rails button.armed { color: #cfe1ff; border-color: var(--line); background: var(--panel2); }
#rails button.armed { border-color: var(--pri); }

#canvasWrap {
  position: relative; min-height: 0; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 16px;
  background:
    linear-gradient(45deg, #0a1120 25%, transparent 25%) 0 0/26px 26px,
    linear-gradient(-45deg, #0a1120 25%, transparent 25%) 0 13px/26px 26px, #0d1524;
}
#stageBox { position: relative; flex: none; box-shadow: 0 22px 60px rgba(0, 0, 0, .55); border-radius: 10px; overflow: hidden; }
#stage { position: relative; transform-origin: 0 0; background: #0a1020; user-select: none; -webkit-user-select: none; }
#cGrid { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(120, 170, 255, .10) 1px, transparent 1px), linear-gradient(90deg, rgba(120, 170, 255, .10) 1px, transparent 1px); background-size: 20px 20px; }
#cLayer { position: absolute; inset: 0; }
.cel { position: absolute; cursor: move; }
.cel.sel { outline: 1px solid #2b7cff; outline-offset: 1px; }
.cel.locked { cursor: not-allowed; }
.h {
  position: absolute; width: 9px; height: 9px; background: #fff; border: 1px solid #2b7cff; border-radius: 2px;
  display: none; z-index: 20;
}
.cel.sel .h { display: block; }
.h[data-dir=nw] { left: -5px; top: -5px; cursor: nwse-resize; }
.h[data-dir=n] { left: 50%; top: -5px; margin-left: -5px; cursor: ns-resize; }
.h[data-dir=ne] { right: -5px; top: -5px; cursor: nesw-resize; }
.h[data-dir=e] { right: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }
.h[data-dir=se] { right: -5px; bottom: -5px; cursor: nwse-resize; }
.h[data-dir=s] { left: 50%; bottom: -5px; margin-left: -5px; cursor: ns-resize; }
.h[data-dir=sw] { left: -5px; bottom: -5px; cursor: nesw-resize; }
.h[data-dir=w] { left: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }
#marquee { position: absolute; border: 1px dashed #4fc8ff; background: rgba(79, 200, 255, .10); display: none; pointer-events: none; z-index: 30; }
#canvasStatus {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 6px 14px; font-size: 12px;
  color: var(--dim); background: var(--panel); border-top: 1px solid var(--line);
}
#canvasStatus .dot { opacity: .35; }
#canvasStatus .hint { font-size: 11.5px; color: #57678a; }

#side { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#sideTabs { display: flex; border-bottom: 1px solid var(--line); }
#sideTabs button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 11px 0; color: var(--dim); font-size: 13px; }
#sideTabs button.on { color: var(--pri2); box-shadow: inset 0 -2px 0 var(--pri); }
#sideBody { flex: 1; overflow: auto; padding: 12px; }
.pane { display: none; }
.pane.on { display: block; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 4px; }
.mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hint { font-size: 11.5px; color: #61708f; line-height: 1.7; }
.layerRow { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 12.5px; }
.layerRow:hover { background: var(--panel2); }
.layerRow.on { background: rgba(43, 124, 255, .16); }
.layerRow i { width: 18px; height: 18px; border-radius: 4px; background: #24344f; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; color: #9fb6d8; font-style: normal; }
.layerRow span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.themeRow { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.themeRow b { width: 62px; font-size: 12.5px; font-weight: 400; color: var(--dim); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.sw { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); cursor: pointer; }

/* ---------- 弹窗 / 提示 ---------- */
#modal { position: fixed; inset: 0; background: rgba(4, 8, 16, .68); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
#modal.on { display: flex; }
#modalBox { width: 520px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
#modalTitle { padding: 15px 18px; font-weight: 600; border-bottom: 1px solid var(--line); }
#modalBody { padding: 16px 18px; overflow: auto; }
#modalFoot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
#toast {
  position: fixed; left: 50%; bottom: 54px; transform: translateX(-50%) translateY(16px);
  background: #16233c; border: 1px solid var(--line); color: #e6f0ff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 1200; max-width: 76vw;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(1100px 620px at 50% 0%, #12325f, #060b14 70%); z-index: 1100; }
#login .box { width: 356px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px; }
#login h2 { font-size: 18px; margin-bottom: 4px; }
#login p { color: var(--dim); font-size: 12.5px; margin-bottom: 18px; }
#login .field { margin-bottom: 12px; }
.skinGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.skinCell { border: 2px solid var(--line); border-radius: 10px; padding: 6px; text-align: center; cursor: pointer; background: #0b1220; }
.skinCell img { width: 100%; height: 42px; object-fit: contain; display: block; }
.skinCell span { font-size: 10.5px; color: var(--dim); }
.skinCell.on { border-color: var(--pri); background: rgba(43, 124, 255, .12); }
.chk { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--txt); margin: 7px 0; }
.chk input { width: auto; }
.radios label { display: block; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 7px; cursor: pointer; font-size: 12.5px; }
.radios label.on { border-color: var(--pri); background: rgba(43, 124, 255, .12); }
.radios input { width: auto; margin-right: 7px; }
