:root {
  --bg: #071428;
  --bg-2: #0a1b36;
  --sider: #061224;
  --panel: #0d2344;
  --panel-2: #102c54;
  --line: rgba(64, 158, 255, .18);
  --line-2: rgba(255, 255, 255, .06);
  --primary: #1890ff;
  --primary-2: #40a9ff;
  --success: #3dd68c;
  --danger: #ff4d4f;
  --warn: #faad14;
  --text: #e8f1ff;
  --muted: #8aa0bf;
  --radius: 6px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; }
a { color: var(--primary-2); }
[hidden] { display: none !important; }
svg { fill: currentColor; }

/* ---------- login ---------- */
.login-body {
  overflow: hidden;
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
}
.login-bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(900px 500px at 12% 10%, rgba(24,144,255,.22), transparent 55%),
    radial-gradient(700px 400px at 90% 90%, rgba(61,214,140,.08), transparent 50%),
    #061224;
}
.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(24,144,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24,144,255,.07) 1px, transparent 1px);
  background-size: 48px 48px;
}
.login-iot { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-scan {
  position: absolute; left: 0; right: 0; height: 90px;
  background: linear-gradient(180deg, transparent, rgba(64,169,255,.12), transparent);
  animation: loginScan 8s linear infinite;
  pointer-events: none;
}
@keyframes loginScan {
  0% { transform: translateY(-20%); }
  100% { transform: translateY(110vh); }
}
.orb { position: absolute; border-radius: 50%; filter: blur(80px); }
.orb-a {
  width: 360px; height: 360px; background: rgba(24,144,255,.2); top: -60px; right: 10%;
  animation: loginPulse 9s ease-in-out infinite;
}
.orb-b {
  width: 420px; height: 420px; background: rgba(232,90,154,.12); bottom: -120px; left: -40px;
  animation: loginPulse 12s ease-in-out infinite reverse;
}
@keyframes loginPulse {
  0%, 100% { transform: scale(1); opacity: .85; }
  50% { transform: scale(1.12); opacity: 1; }
}

.login-shell {
  position: relative; z-index: 1;
  min-height: 100%;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  max-width: 1180px;
  margin: 0 auto;
  align-items: center;
  gap: 48px;
  padding: 48px 32px;
}
.login-brand h1 {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: .04em;
}
.login-brand h1 #login-name-hi { margin-left: 12px; color: var(--primary-2); font-size: 28px; }
.eyebrow { letter-spacing: .24em; font-size: 11px; color: var(--primary-2); margin-bottom: 12px; }
.lead { margin-top: 18px; color: var(--muted); line-height: 1.8; }
.brand-points { margin-top: 28px; list-style: none; }
.brand-points li { padding: 8px 0 8px 16px; position: relative; color: #c5d6ef; font-size: 14px; }
.brand-points li::before {
  content: ""; position: absolute; left: 0; top: 15px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
}
.brand-mark { color: var(--primary-2); margin-bottom: 22px; }

.login-card {
  background: rgba(13, 35, 68, .42);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 12px;
  padding: 36px 32px;
  backdrop-filter: blur(16px);
}
.card-kicker { font-size: 11px; letter-spacing: .28em; color: var(--primary-2); }
.login-card h2 { font-size: 26px; margin: 8px 0 6px; }
.card-sub { color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.login-form-v2 .lg-title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 3px solid #e85a9a;
  display: inline-block;
  line-height: 1.2;
}
.login-form-v2 .lg-reg {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
  cursor: pointer;
}
.login-form-v2 .lg-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .2);
  color: var(--text);
  font-size: 14px;
}
.login-form-v2 .lg-line span { flex-shrink: 0; }
.login-form-v2 .lg-line input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 8px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.login-form-v2 .lg-line input:focus { box-shadow: none; border: 0; }
.login-form-v2 .lg-line .btn-ghost { width: auto; flex: none; white-space: nowrap; margin: 0; }
.login-form-v2 .lg-opts {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 16px;
  font-size: 13px;
}
.login-form-v2 .lg-chk {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text);
}
.login-form-v2 .lg-chk input {
  width: auto;
  margin: 0;
  accent-color: #e85a9a;
}
.login-form-v2 .lg-switch {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}
.login-form-v2 .lg-go {
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f6bff, #6aa8ff);
}
.login-form-v2 .lg-soc {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 22px 0 12px;
}
.login-form-v2 .lg-wx {
  display: block;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border: 0;
  border-radius: 50%;
  background: #07c160;
  cursor: pointer;
}
.login-form-v2 .lg-wx.has-img {
  background: #fff center/cover no-repeat;
}
.login-dlg {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 8, 20, .62);
}
.login-dlg[hidden] { display: none; }
.login-dlg-card {
  width: min(360px, 100%);
  background: #f4f7fb;
  color: #1a2433;
  border-radius: 16px;
  padding: 22px 20px 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .4);
}
.login-dlg-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 18px;
}
.login-dlg-x {
  border: 0;
  background: transparent;
  color: #5b6778;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.login-dlg-p {
  margin: 0 0 20px;
  color: #334155;
  line-height: 1.7;
  font-size: 14px;
}
@media (max-width: 800px) {
  .login-body {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  .login-shell {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 20px;
    padding: 20px 16px calc(28px + env(safe-area-inset-bottom, 0px));
    min-height: 100%;
    min-height: 100dvh;
  }
  .login-card { padding: 22px 18px 16px; }
  .login-brand h1 { font-size: 32px; }
  .login-brand h1 #login-name-hi { font-size: 22px; margin-left: 8px; }
  .login-brand .lead { margin-top: 10px; font-size: 13px; line-height: 1.65; }
  .login-brand .brand-points { margin-top: 12px; }
  .login-brand .brand-points li { padding: 5px 0 5px 16px; font-size: 13px; }
  .login-form-v2 .lg-title { font-size: 22px; }
  .login-form-v2 .lg-soc { margin: 16px 0 10px; }
  .login-card input,
  .login-form-v2 .lg-line input {
    font-size: 16px;
  }
  .login-foot { font-size: 11px; line-height: 1.5; }
}
.login-card label { display: block; margin-bottom: 14px; font-size: 12px; color: var(--muted); }
.login-card input, .modal input, .modal select, .modal textarea, .toolbar input, .toolbar select, .panel input, .panel textarea {
  width: 100%;
  margin-top: 8px;
  background: #071428;
  border: 1px solid var(--line-2);
  color: var(--text);
  border-radius: 6px;
  padding: 11px 12px;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}
.modal textarea, .panel textarea {
  min-height: 120px;
  line-height: 1.55;
  resize: vertical;
  display: block;
}
.login-card input:focus, .modal input:focus, .modal select:focus, .modal textarea:focus, .toolbar input:focus, .toolbar select:focus, .panel textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(24,144,255,.25);
}
.login-card .lg-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .2);
  color: var(--text);
  font-size: 14px;
}
.login-card .lg-line input,
.login-card .lg-line input:focus {
  width: auto;
  flex: 1;
  min-width: 0;
  margin-top: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 8px 0;
  box-shadow: none;
}
.login-card .lg-chk {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text);
  font-size: 13px;
}
.field-with-action {
  display: flex; gap: 8px; align-items: stretch; margin-top: 8px;
}
.field-with-action select, .field-with-action input { margin-top: 0; flex: 1; min-width: 0; }
.field-with-action .btn-ghost,
.field-with-action .btn-primary {
  flex: none;
  width: auto;
  white-space: nowrap;
  align-self: stretch;
}
.shop-cover-actions {
  justify-content: flex-start;
}
.shop-cover-actions .btn-ghost {
  margin: 0;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.2;
}
.shop-edit-modal {
  width: min(720px, calc(100% - 24px));
}
.shop-edit-sec {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.shop-edit-sec:last-of-type { border-bottom: 0; }
.shop-edit-sec h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: #d6e6ff;
}
.shop-edit-sec > label {
  display: block;
  width: 100%;
}
.shop-field-block {
  display: block;
  width: 100%;
  margin-bottom: 14px;
}
.shop-edit-sec textarea[name="detail"] {
  min-height: 140px;
  margin-top: 8px;
}
.shop-edit-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.shop-edit-toolbar h4 { margin: 0; }
.shop-edit-hint { margin: 8px 0 0; font-size: 12px; }
.shop-cover-box {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: start;
}
.shop-cover-preview {
  height: 120px;
  border-radius: 10px;
  background: #0b1220 center/cover no-repeat;
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}
.shop-detail-media {
  margin-top: 4px;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed var(--line-2);
  background: rgba(7, 20, 40, .55);
}
.shop-detail-media-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.shop-detail-media-h strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.shop-detail-media-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.shop-detail-media-actions .btn-ghost {
  margin: 0;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.2;
  width: auto;
}
.shop-detail-imgs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
  min-height: 72px;
}
.shop-detail-imgs .dimg-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 72px;
  color: var(--muted);
  font-size: 12px;
  border-radius: 8px;
  background: #0b1220;
  border: 1px solid transparent;
}
.shop-detail-imgs .dimg {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: #0b1220 center/cover no-repeat;
}
.shop-detail-imgs .dimg button {
  position: absolute; top: 4px; right: 4px;
  border: 0; border-radius: 4px;
  background: rgba(0,0,0,.65); color: #fff;
  font-size: 11px; padding: 2px 6px; cursor: pointer;
}
.shop-dyn-list { display: grid; gap: 8px; }
.shop-dyn-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 8px;
  align-items: center;
}
.shop-dyn-row input {
  margin: 0;
}
.shop-dyn-row .btn-ghost {
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
  width: auto;
}
.shop-sku-head,
.shop-sku-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 8px;
  align-items: center;
}
.shop-sku-head {
  font-size: 12px;
  color: var(--muted);
  padding: 0 2px;
}
.shop-sku-label {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}
.shop-sku-row input { margin: 0; }
@media (max-width: 640px) {
  .shop-cover-box { grid-template-columns: 1fr; }
  .shop-dyn-row { grid-template-columns: 1fr; }
  .shop-sku-head, .shop-sku-row { grid-template-columns: 1fr; }
}
.cs-qr-preview {
  width: 160px;
  height: 160px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff center/contain no-repeat;
  color: var(--muted);
  font-size: 12px;
  display: grid;
  place-items: center;
}
.cs-qr-preview.is-empty {
  background: var(--panel-2);
}
.login-wx-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}
.cs-ico-admin {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}
.cs-ico-admin > div span {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
}
.cs-ico-preview {
  width: 48px;
  height: 48px;
  border-radius: 8px;
}
.cs-ico-acts {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.cs-ico-acts .btn-ghost {
  padding: 4px 8px;
  font-size: 12px;
}
@media (max-width: 640px) {
  .cs-ico-admin { grid-template-columns: 1fr; }
}
.nav-img-admin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 4px 0 12px;
}
@media (max-width: 720px) {
  .nav-img-admin { grid-template-columns: 1fr; }
}
.nav-img-preview {
  width: 100%;
  height: 56px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff center/cover no-repeat;
  color: var(--muted);
  font-size: 12px;
  display: grid;
  place-items: center;
}
.nav-img-preview.is-empty {
  background: var(--panel-2);
}
.banner-admin-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 4px 0 8px;
}
.banner-admin-card {
  background: var(--panel, #141a26);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
}
.banner-admin-card .preview {
  height: 110px;
  background:
    repeating-conic-gradient(#243044 0% 25%, #0b1220 0% 50%)
    50% / 14px 14px;
  display: grid;
  place-items: center;
  color: #8a93a6;
  font-size: 12px;
}
.banner-admin-card .preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.banner-admin-card .video-thumb,
.img-picker-item .video-thumb {
  position: relative;
  overflow: hidden;
  background: #0b1220;
}
.banner-admin-card .video-thumb video,
.img-picker-item .video-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.img-picker-item .video-thumb {
  height: 88px;
}
.camera-preview {
  margin: 8px 0 4px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: #0b1220;
  max-height: 180px;
}
.camera-preview video {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #000;
}
.banner-admin-card .actions {
  display: flex;
  gap: 6px;
  padding: 8px;
  flex-wrap: wrap;
}
.banner-admin-card .actions .btn-ghost,
.banner-admin-card .actions label.btn-ghost {
  font-size: 12px;
  cursor: pointer;
}
.shop-thumb-sm {
  width: 56px;
  height: 40px;
  border-radius: 6px;
  background: #0b1220 center/cover no-repeat;
  border: 1px solid rgba(255,255,255,0.08);
}
.modal.modal-wide {
  width: min(720px, 94vw);
  max-height: 86vh;
  overflow: auto;
}
.img-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.img-picker-item {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  overflow: hidden;
  background: #0b1220;
  cursor: pointer;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
}
.img-picker-item:hover,
.img-picker-item:focus {
  border-color: #40a9ff;
  outline: none;
}
.img-picker-item .thumb {
  height: 88px;
  background: #0b1220 center/cover no-repeat;
}
.img-picker-item .cap {
  display: block;
  padding: 6px 8px;
  font-size: 12px;
  color: #9aa3b2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.img-picker-empty {
  grid-column: 1 / -1;
  padding: 24px 8px;
  text-align: center;
  color: #8a93a6;
}
.shop-cover-picker {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(0,0,0,0.25);
}
.shop-cover-picker-h {
  font-size: 12px;
  color: #9aa3b2;
  margin-bottom: 8px;
}
#img-picker-modal {
  z-index: 80;
}
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex: 1; font-family: Consolas, ui-monospace, monospace; font-size: 12px; }
.appinfo-hint { font-size: 12px; line-height: 1.55; margin: 0 0 8px; }
.appinfo-hint code { font-size: 11px; word-break: break-all; }
.btn-primary, .btn-gold {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 11px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  margin-top: 6px;
}
.btn-primary:hover, .btn-gold:hover { background: var(--primary-2); }
.btn-ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  padding: 7px 12px;
}
.demo-banner {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #9fd4ff;
  font-size: 12px;
  background: rgba(24,144,255,.08);
}
.form-error { color: var(--danger); font-size: 13px; margin: 4px 0 10px; }
.login-foot { margin-top: 16px; color: var(--muted); font-size: 12px; }

/* ---------- shell ---------- */
.app-body { display: grid; grid-template-columns: 210px 1fr; min-height: 100%; transition: grid-template-columns .22s ease; }
.sider {
  background: #061224;
  border-right: 1px solid var(--line-2);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
  z-index: 20;
  min-width: 0;
  transition: transform .22s ease;
}
.sider-brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 20px; }
.sider-brand-text { min-width: 0; flex: 1; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #1890ff, #0050b3) center/cover no-repeat;
  display: grid; place-items: center; font-weight: 800;
  border: 0; color: #fff; padding: 0; flex: none;
  cursor: pointer; overflow: hidden;
}
.logo-mark.has-img { color: transparent; background-color: #0b1a33; }
.logo-mark:hover { filter: brightness(1.08); }
.sider-brand strong { display: block; font-size: 14px; }
.sider-brand small { color: var(--muted); font-size: 11px; }
html.sider-off .app-body { grid-template-columns: 1fr; }
html.sider-off .sider {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 210px;
  transform: translateX(-100%);
  pointer-events: none;
  box-shadow: none;
}
.sider-nav { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  text-align: left; border: 0; background: transparent;
  color: #b7c8e0; padding: 10px 12px; border-radius: 6px; position: relative;
}
.nav-item svg { width: 16px; height: 16px; opacity: .85; flex: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-group { margin: 2px 0; }
.nav-parent { width: 100%; }
.nav-parent .caret { margin-left: auto; opacity: .7; font-size: 11px; }
.nav-sub { display: none; flex-direction: column; gap: 2px; padding: 2px 0 6px 8px; }
.nav-group.open .nav-sub { display: flex; }
.nav-sub .nav-item { padding-left: 36px; font-size: 13px; }
.nav-parent.is-open { background: rgba(24,144,255,.18); color: #fff; }
.sys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sys-grid .btn-primary { width: auto; margin-top: 10px; }
.sys-grid label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.setting-panel { max-width: 860px; }
.hint-box {
  font-size: 12px; color: #9fd4ff; margin: 0 0 14px;
  padding: 8px 10px; background: rgba(24,144,255,.08); border-radius: 6px;
}
.setting-form .btn-primary, .setting-panel .btn-primary { width: auto; margin-top: 8px; }
.setting-form label, .setting-panel label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.nav-badge {
  position: absolute; right: 10px; top: 9px;
  background: var(--danger); color: #fff;
  border-radius: 99px; font-size: 11px; padding: 0 6px;
}
.sider-foot {
  margin-top: auto;
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 12px;
  padding: 12px 8px 4px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #4a5d78; flex-shrink: 0; }
.live-dot.on { background: var(--success); box-shadow: 0 0 8px var(--success); }
.live-dot.off { background: var(--danger); }
.mqtt-live {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.workspace { min-width: 0; display: flex; flex-direction: column; background: var(--bg-2); }
.topbar {
  height: 52px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 16px 0 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line-2);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.sider-toggle {
  flex: none;
  font-size: 18px;
  line-height: 1;
}
.head-tabs { display: flex; align-items: center; gap: 4px; min-height: 32px; }
.head-tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: 6px; font-size: 13px;
}
.head-tab:hover { color: var(--text); background: rgba(24,144,255,.12); }
.head-tab.active {
  background: var(--primary); color: #fff;
}
.crumb { color: var(--muted); font-size: 12px; }
.top-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  color: var(--text); border: 0; background: transparent; border-radius: 6px;
  position: relative;
}
.bell-badge {
  right: -2px;
  top: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  line-height: 16px;
  text-align: center;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: rgba(24,144,255,.16); }
.icon-btn.order-bell { color: #ffc53d; }
.user-menu { position: relative; }
.user-trigger {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 99px; padding: 4px 10px 4px 4px; cursor: pointer;
}
.user-trigger:hover { border-color: var(--primary); }
.caret { font-size: 10px; opacity: .7; }
.user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-drop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  width: 200px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
.user-drop-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.user-drop-head strong { display: block; }
.user-drop-head small { color: var(--muted); }
.user-drop button {
  width: 100%; text-align: left; border: 0; background: transparent;
  color: var(--text); padding: 8px 10px; border-radius: 6px;
}
.user-drop button:hover { background: rgba(24,144,255,.12); }
.user-drop button.danger { color: var(--danger); }
.drawer-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60;
  display: flex; justify-content: flex-end;
}
.drawer {
  width: min(360px, 100%); height: 100%; background: var(--panel);
  padding: 18px 18px 24px; overflow: auto; border-left: 1px solid var(--line);
}
.drawer header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.drawer h4 { margin: 16px 0 8px; font-size: 13px; color: var(--muted); }
.drawer-tip { font-size: 12px; color: var(--muted); line-height: 1.6; }
.drawer-tip code { color: var(--primary-2); }
.chip-row, .color-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row button {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 99px; padding: 6px 12px; font-size: 12px;
}
.chip-row button.on, .color-row button.on { outline: 2px solid var(--primary); }
.color-row button { width: 28px; height: 28px; border-radius: 50%; border: 0; }
.drawer-check { margin: 16px 0; color: var(--text) !important; }
html[data-theme="light"] .app-body { color: var(--text); }
html[data-theme="light"] .sider-nav .nav-item { color: #c5d4e8; }
html[data-theme="light"] .data-table th { color: #6b7280; }
html[data-theme="light"] .login-card, html[data-theme="light"] .panel { box-shadow: 0 1px 4px rgba(0,0,0,.06); }
html[data-theme="light"] .welcome-card { background: linear-gradient(135deg, #e6f4ff, #ffffff); }
html[data-theme="light"] .quick-grid button:hover { background: #e6f4ff; }
body.compact .content { padding: 8px 10px; }
body.compact .kpi { padding: 10px; }
body.compact .nav-item { padding: 8px 10px; }
.content { padding: 14px 16px 28px; overflow: auto; flex: 1; }

.hero-row { display: grid; grid-template-columns: 1fr 280px; gap: 12px; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.kpi {
  border-radius: 12px;
  padding: 16px 14px;
  display: flex; gap: 12px; align-items: center;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
  min-height: 88px;
}
.kpi.kpi-fill.c1 { background: linear-gradient(135deg, #7b8cff 0%, #5167f5 100%); }
.kpi.kpi-fill.c2 { background: linear-gradient(135deg, #46d39a 0%, #1fad6a 100%); }
.kpi.kpi-fill.c3 { background: linear-gradient(135deg, #4db3ff 0%, #1a7fff 100%); }
.kpi.kpi-fill.c4 { background: linear-gradient(135deg, #ff8a65 0%, #f5222d 100%); }
.kpi.kpi-fill.c5 { background: linear-gradient(135deg, #ffc53d 0%, #fa8c16 100%); }
.kpi-ico {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 20px; font-weight: 700;
  background: rgba(255,255,255,.18);
}
.kpi .label { color: rgba(255,255,255,.88); font-size: 12px; }
.kpi .value { font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: .02em; }
.kpi .hint { color: rgba(255,255,255,.72); font-size: 11px; }

.welcome-card {
  background: linear-gradient(145deg, #0d3a78 0%, #1456a8 55%, #1a6fd0 100%);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex; gap: 8px; align-items: center;
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
}
.welcome-avatar svg { width: 86px; height: 100px; }
.welcome-text h2 { font-size: 18px; margin: 2px 0 6px; }
.welcome-text p { color: rgba(232,241,255,.82); font-size: 12px; }
.welcome-sub { margin-bottom: 10px !important; }
.welcome-card .btn-primary { width: auto; margin: 0; padding: 6px 12px; font-size: 12px; }

.dash-row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; margin-top: 12px; }
.panel {
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.04);
}
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.panel-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: 8px; }
.panel-h h3 { font-size: 14px; font-weight: 600; }
.panel-h span { color: var(--muted); font-size: 12px; }
.link-btn {
  border: 0; background: transparent; color: var(--primary-2); cursor: pointer; font-size: 12px; padding: 0;
}
.legend-inline { display: inline-flex; align-items: center; gap: 8px; }
.legend-inline .lg {
  display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 2px;
}
.legend-inline .lg.on { background: #1890ff; }
.legend-inline .lg.off { background: #e8f1ff; }
.legend-inline .lg.bad { background: #ff4d4f; }
.chip-btn {
  border: 1px solid var(--line-2); background: transparent; color: var(--muted);
  border-radius: 4px; padding: 2px 8px; font-size: 12px; cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}
.ticket-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}
.chip-btn.on { color: #fff; background: #1890ff; border-color: #1890ff; }
.chart { width: 100%; }
.chart-md { min-height: 180px; }
.chart-sm { min-height: 110px; }
.chart-pie-wrap { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.pie-legend { list-style: none; font-size: 12px; color: #c5d6ef; display: grid; gap: 8px; }
.pie-legend i {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px;
}
.alarm-total {
  background: linear-gradient(90deg, rgba(24,144,255,.2), rgba(24,144,255,.06));
  border-radius: 8px; padding: 8px 12px; margin-bottom: 8px;
  font-size: 13px; color: #d6e6ff;
}
.video-box {
  min-height: 180px; border-radius: 10px; overflow: hidden;
  background: #071428; position: relative;
  border: 1px solid var(--line-2);
}
.video-box video, .video-box iframe, .video-box img {
  width: 100%; height: 180px; object-fit: cover; display: block; border: 0;
}
.video-box video.overview-loop {
  object-fit: cover;
  background: #000;
  transform: translateZ(0);
  backface-visibility: hidden;
}
.video-box iframe {
  overflow: hidden;
}
.video-empty {
  min-height: 180px; display: grid; place-content: center; text-align: center;
  color: var(--primary-2); font-size: 13px; gap: 4px;
  background:
    linear-gradient(rgba(24,144,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24,144,255,.08) 1px, transparent 1px),
    #071428;
  background-size: 18px 18px;
}
.video-empty span { color: var(--muted); font-size: 12px; }
.video-cam {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px;
  border-radius: 50%; background: rgba(0,0,0,.45);
  pointer-events: none;
}
.video-cam::before {
  content: '';
  position: absolute; inset: 8px 7px 8px 6px;
  border: 2px solid #fff; border-radius: 3px;
}
.video-cam::after {
  content: '';
  position: absolute; right: 5px; top: 11px;
  border: 4px solid transparent; border-left-color: #fff;
}
.ticket-overview {
  display: grid; grid-template-columns: 200px 1fr; gap: 14px; align-items: center; min-height: 200px;
}
.radar-wrap { width: 190px; height: 190px; margin: 0 auto; position: relative; }
.radar-wrap svg { display: block; width: 100%; height: 100%; }
.radar-label {
  position: absolute; font-size: 11px; color: #9eb6d4; white-space: nowrap; pointer-events: none;
}
.ticket-stats {
  list-style: none; font-size: 13px; display: grid; gap: 10px;
  background: #071428; border-radius: 10px; padding: 14px 16px;
  border: 1px solid var(--line-2); min-height: 180px; align-content: center;
}
.ticket-stats li {
  display: flex; justify-content: space-between; align-items: center; color: #c5d6ef;
}
.ticket-stats li::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: #1890ff;
  margin-right: 8px; flex: none;
}
.ticket-stats span { flex: 1; }
.ticket-stats b { color: #fff; font-size: 15px; }
.inspect-bars {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px;
  height: 160px; align-items: end; padding: 8px 4px 0;
}
.inspect-col { display: grid; gap: 4px; align-content: end; text-align: center; }
.inspect-stack {
  height: 120px; display: flex; flex-direction: column-reverse; border-radius: 4px; overflow: hidden;
  background: #0a1b36;
}
.inspect-stack i { display: block; width: 100%; min-height: 0; }
.inspect-stack .a { background: #1890ff; }
.inspect-stack .b { background: #0958d9; }
.inspect-stack .c { background: #faad14; }
.inspect-stack .d { background: #52c41a; }
.inspect-col span { color: var(--muted); font-size: 11px; }

.panel-h-inspect {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.inspect-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto;
  position: relative;
  z-index: 6;
  pointer-events: auto;
}
.panel-ticket .panel-h-inspect,
.panel-inspect .panel-h-inspect {
  position: relative;
  z-index: 6;
  overflow: visible;
}
.inspect-dates {
  display: inline-flex; align-items: center; gap: 6px;
  background: #071428; border: 1px solid var(--line-2); border-radius: 6px;
  padding: 4px 8px; margin: 0; color: var(--muted); font-size: 12px;
  pointer-events: auto;
  position: relative;
  z-index: 2;
  cursor: pointer;
}
.inspect-dates input[type="date"] {
  width: 118px; border: 0; background: transparent; color: #c5d6ef;
  font-size: 12px; padding: 2px 0; margin: 0;
  pointer-events: auto;
  cursor: pointer;
}
.inspect-dates input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(.7); cursor: pointer;
}
.inspect-dates-sep { color: var(--muted); opacity: .7; }
.inspect-legend {
  list-style: none; display: flex; flex-wrap: wrap; gap: 14px;
  margin: 2px 0 10px; padding: 0; font-size: 12px; color: #c5d6ef;
}
.inspect-legend i {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: 6px; vertical-align: -1px;
}
.inspect-legend .a { background: #1890ff; }
.inspect-legend .b { background: #e8f1ff; }
.inspect-legend .c { background: #faad14; }
.inspect-legend .d { background: #52c41a; }
.chart-inspect { min-height: 200px; }
.inspect-chart {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 6px;
  height: 200px;
}
.inspect-y {
  display: flex; flex-direction: column; justify-content: space-between;
  align-items: flex-end; padding: 4px 0 22px;
  color: var(--muted); font-size: 11px; line-height: 1;
}
.inspect-plot {
  position: relative;
  border-left: 1px solid rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.08);
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--cols, 7), 1fr);
  gap: 8px;
  align-items: end;
  padding: 4px 4px 0;
}
.inspect-plot::before {
  content: '';
  position: absolute; inset: 4px 0 22px 0;
  background:
    repeating-linear-gradient(
      to top,
      transparent 0,
      transparent calc(25% - 1px),
      rgba(255,255,255,.06) calc(25% - 1px),
      rgba(255,255,255,.06) 25%
    );
  pointer-events: none;
}
.inspect-group {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  height: 100%; justify-content: flex-end;
}
.inspect-group-bars {
  display: flex; align-items: flex-end; gap: 3px;
  height: calc(100% - 22px); width: 100%;
  justify-content: center;
}
.inspect-group-bars b {
  display: block; width: 8px; min-height: 2px; border-radius: 2px 2px 0 0;
  align-self: flex-end;
}
.inspect-group-bars .a { background: #1890ff; }
.inspect-group-bars .b { background: #e8f1ff; }
.inspect-group-bars .c { background: #faad14; }
.inspect-group-bars .d { background: #52c41a; }
.inspect-group em {
  font-style: normal; color: var(--muted); font-size: 11px; line-height: 1;
}
.devmap-layout { display: grid; grid-template-columns: 280px 1fr; gap: 12px; min-height: 520px; }
.devmap-list { list-style: none; max-height: 520px; overflow: auto; }
.devmap-list li {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; margin-bottom: 6px;
  background: #0a1b36;
}
.devmap-list li.on, .devmap-list li:hover { border-color: rgba(24,144,255,.45); background: #12305a; }
.devmap-list strong { display: block; font-size: 13px; }
.devmap-list small { color: var(--muted); font-size: 12px; }
.devmap-canvas-wrap { border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); min-height: 520px; }
.devmap-canvas { width: 100%; height: 520px; background: #0b1f3d; }

.lite-donut {
  width: 150px; height: 150px; margin: 0;
  border-radius: 50%;
  background: conic-gradient(var(--c, #1890ff) calc(var(--p, 0) * 1%), #163a6b 0);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
}
.lite-donut:hover {
  transform: scale(1.08);
  filter: brightness(1.15);
  box-shadow: 0 0 0 4px rgba(24,144,255,.18), 0 12px 28px rgba(0,0,0,.28);
}
.lite-donut span, .lite-mini span {
  width: 70%; height: 70%; border-radius: 50%;
  background: var(--panel); color: var(--text);
  display: grid; place-items: center; text-align: center;
  font-size: 16px; font-weight: 700; line-height: 1.25;
  transition: transform .25s ease;
}
.lite-donut:hover span { transform: scale(1.04); }
.lite-donut small, .lite-mini small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.lite-mini {
  width: 96px; height: 96px; margin: 8px auto 0;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #163a6b 0);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
}
.lite-mini:hover {
  transform: scale(1.12) translateY(-2px);
  filter: brightness(1.18);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 28%, transparent), 0 10px 22px rgba(0,0,0,.3);
}
.lite-mini:hover span { transform: scale(1.05); }
.lite-bars {
  height: 180px; display: flex; align-items: flex-end; gap: 3px; padding: 8px 4px 0;
}
.lite-bars i {
  flex: 1; background: linear-gradient(#40a9ff, rgba(24,144,255,.2));
  border-radius: 2px 2px 0 0; min-height: 2px;
  transform-origin: bottom center;
  transition: transform .18s ease, filter .18s ease, background .18s ease, box-shadow .18s ease;
  cursor: pointer;
}
.lite-bars i:hover {
  transform: scaleY(1.12) scaleX(1.15);
  filter: brightness(1.35);
  background: linear-gradient(#69c0ff, #1890ff);
  box-shadow: 0 0 12px rgba(64,169,255,.55);
  z-index: 1;
}
.stack-chart { display: flex; flex-direction: column; gap: 10px; padding: 8px 4px; }
.stack-row {
  display: grid; grid-template-columns: 72px 1fr 28px; gap: 8px; align-items: center; font-size: 12px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}
.stack-row:hover {
  background: rgba(24,144,255,.1);
  transform: translateX(4px);
}
.stack-track { height: 10px; background: #163a6b; border-radius: 99px; overflow: hidden; display: flex; transition: height .2s ease, box-shadow .2s ease; }
.stack-row:hover .stack-track {
  height: 14px;
  box-shadow: 0 0 0 1px rgba(24,144,255,.25);
}
.stack-track b { display: block; height: 100%; transition: filter .2s ease; }
.stack-row:hover .stack-track .on { filter: brightness(1.25); }
.stack-track .on { background: #1890ff; }
.stack-track .off { background: #3a4f6e; }
.stack-track .bad { background: #ff4d4f; }

/* 设备实时状态：纵向堆叠柱 */
.status-chart {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 6px;
  height: 200px;
}
.status-y {
  display: flex; flex-direction: column; justify-content: space-between;
  align-items: flex-end; padding: 4px 0 22px;
  color: var(--muted); font-size: 11px; line-height: 1;
}
.status-plot {
  position: relative;
  border-left: 1px solid rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.1);
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), 1fr);
  gap: 10px;
  align-items: end;
  padding: 4px 6px 0;
}
.status-plot::before {
  content: '';
  position: absolute; inset: 4px 0 22px 0;
  background:
    repeating-linear-gradient(
      to top,
      transparent 0,
      transparent calc(25% - 1px),
      rgba(255,255,255,.07) calc(25% - 1px),
      rgba(255,255,255,.07) 25%
    );
  pointer-events: none;
}
.status-col {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  height: 100%; justify-content: flex-end;
}
.status-stack {
  width: 18px;
  height: calc(100% - 22px);
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  align-items: stretch;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(24,144,255,.35);
}
.status-stack i {
  display: block;
  width: 100%;
  min-height: 0;
  flex: 0 0 auto;
}
.status-stack .on { background: #1890ff; }
.status-stack .off { background: #e8f1ff; }
.status-stack .bad { background: #ff4d4f; }
.status-col em {
  font-style: normal; color: var(--muted); font-size: 11px; line-height: 1;
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chart-sm { height: 120px; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding: 8px 0 4px; }
.quick-grid button {
  border: 0; background: var(--panel-2); color: var(--text);
  border-radius: 6px; padding: 14px 8px; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.quick-grid button:hover { background: #163a6b; }
.q { width: 28px; height: 28px; border-radius: 8px; }
.q1 { background: #1890ff; }
.q2 { background: #13c2c2; }
.q3 { background: #ff4d4f; }
.q4 { background: #faad14; }
.q5 { background: #722ed1; }
.q6 { background: #52c41a; }

.alarm-list { list-style: none; max-height: 210px; overflow: auto; }
.alarm-list li {
  display: grid; grid-template-columns: 52px 1fr auto;
  gap: 8px; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 12px;
}
.lv {
  display: inline-block; text-align: center;
  padding: 2px 0; border-radius: 3px; font-size: 11px; color: #fff;
}
.lv-critical { background: #ff4d4f; }
.lv-warn { background: #fa8c16; }
.lv-info { background: #faad14; }
.mini-donuts { display: grid; grid-template-columns: 1fr 1fr 1fr; }

.explorer { margin-top: 12px; }
.explorer-grid { display: grid; grid-template-columns: 200px 240px 1fr; gap: 12px; min-height: 220px; }
.ex-label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.tree, .ex-list { list-style: none; }
.tree li, .ex-list li {
  padding: 8px 10px; border-radius: 4px; cursor: pointer; font-size: 13px;
}
.tree li:hover, .ex-list li:hover, .tree li.on, .ex-list li.on { background: #163a6b; }
.ex-detail {
  background: #0a1b36;
  border-radius: 6px;
  padding: 12px;
  min-height: 280px;
}
.ex-detail-head {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}
.vars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.var { background: #102c54; border-radius: 6px; padding: 10px; text-align: center; }
.var b { display: block; font-size: 22px; color: var(--primary-2); }
.var span { color: var(--muted); font-size: 12px; }
.ex-detail-body {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(220px, 1.1fr);
  gap: 12px;
  align-items: stretch;
  min-height: 160px;
}
.meta { width: 100%; font-size: 12px; color: #c5d6ef; }
.meta td { padding: 5px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.meta td:first-child { width: 88px; color: var(--muted); white-space: nowrap; }
.muted { color: var(--muted); }
.geo-hint {
  margin: -2px 0 10px;
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
  line-height: 1.4;
}
.geo-hint.ok { color: var(--success); }
.geo-hint.err { color: #d89614; }
.geo-hint.busy { color: var(--primary); }
.ex-map-wrap {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: #071428;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  position: relative;
}
.ex-map-canvas {
  flex: 1;
  min-height: 160px;
  width: 100%;
  background: #0b1f3d;
}
.ex-map-canvas .leaflet-container {
  width: 100%;
  height: 100%;
  min-height: 160px;
  background: #0b1f3d;
}
.ex-map-links {
  display: flex;
  gap: 12px;
  padding: 6px 10px;
  background: rgba(7, 20, 40, .92);
  border-top: 1px solid var(--line-2);
  font-size: 12px;
}
.ex-map-links a { color: var(--primary-2); text-decoration: none; }
.ex-map-links a:hover { text-decoration: underline; }
.ex-map-fallback {
  flex: 1;
  min-height: 160px;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
  padding: 16px;
  background:
    radial-gradient(circle at 50% 42%, rgba(24,144,255,.18), transparent 42%),
    linear-gradient(rgba(24,144,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24,144,255,.08) 1px, transparent 1px),
    #071428;
  background-size: auto, 18px 18px, 18px 18px;
}
.ex-map-fallback b { color: #e8f1ff; font-size: 13px; font-weight: 600; }
.ex-map-fallback span { color: var(--muted); font-size: 12px; }
.ex-map-pin {
  width: 18px; height: 18px; margin: 0 auto 4px;
  border-radius: 50% 50% 50% 0;
  background: #1890ff;
  transform: rotate(-45deg);
  box-shadow: 0 0 0 4px rgba(24,144,255,.25);
}
.ex-map-empty {
  min-height: 160px;
  border-radius: 8px;
  border: 1px dashed rgba(24,144,255,.35);
  background:
    linear-gradient(rgba(24,144,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24,144,255,.08) 1px, transparent 1px),
    #071428;
  background-size: 18px 18px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--primary-2);
  font-size: 13px;
  gap: 4px;
}
.ex-map-empty span { color: var(--muted); font-size: 12px; }
.loc-box {
  margin-top: 10px; height: 88px; border-radius: 6px;
  background:
    linear-gradient(rgba(24,144,255,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24,144,255,.12) 1px, transparent 1px),
    #071428;
  background-size: 18px 18px;
  display: grid; place-items: center; color: var(--primary-2); font-size: 13px;
}
@media (max-width: 1100px) {
  .ex-detail-body { grid-template-columns: 1fr; }
}

.device-card-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  align-items: stretch;
}
.dev-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
}
.dev-card:hover { box-shadow: 0 10px 28px rgba(0,0,0,.28); }
.dev-card-top {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.dev-card-name {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.dev-card-name .mark {
  flex: 0 0 32px;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #1890ff;
  color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.dev-card-name strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dev-card-tags {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px;
}
.dev-card-tags span {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 18px;
}
.dev-card-tags .on { color: #3dd68c; background: rgba(61,214,140,.14); }
.dev-card-tags .off { color: #9aa3b2; background: rgba(255,255,255,.06); }
.dev-card-tags .ok { color: #40a9ff; background: rgba(24,144,255,.14); }
.dev-card-tags .warn { color: #faad14; background: rgba(250,173,20,.14); }
.dev-card-tags .muted { color: #8aa0bf; background: rgba(255,255,255,.04); border: 1px solid var(--line-2); }
.dev-card-main {
  display: flex !important;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
}
.dev-card-info {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-width: 0;
}
.dev-card-info li {
  display: flex !important;
  gap: 8px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
.dev-card-info li em {
  flex: 0 0 40px;
  font-style: normal;
  color: var(--muted);
}
.dev-card-info li b {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}
.dev-card-icon {
  flex: 0 0 64px;
  width: 64px; height: 64px;
  border-radius: 12px;
  background: #0a1b36;
  border: 1px solid var(--line-2);
  color: #69c0ff;
  font-size: 22px;
  font-weight: 700;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.dev-card-actions {
  display: flex !important;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
}
.dev-card-actions .btn-danger-soft,
.dev-card-actions .btn-ok-soft,
.dev-card-actions .btn-ghost {
  flex: 1;
  min-width: 72px;
  text-align: center;
}
.btn-danger-soft {
  border: 1px solid rgba(255,77,79,.4); background: rgba(255,77,79,.14);
  color: #ff7875; border-radius: 6px; padding: 8px 10px; font-size: 12px;
}
.btn-ok-soft {
  border: 1px solid rgba(61,214,140,.4); background: rgba(61,214,140,.14);
  color: #73d13d; border-radius: 6px; padding: 8px 10px; font-size: 12px;
}
.device-empty {
  grid-column: 1 / -1;
  padding: 40px 16px; text-align: center; color: var(--muted);
  background: var(--panel); border-radius: 10px; border: 1px dashed var(--line);
}
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 180px; margin-top: 0; }
.toolbar .btn-primary, .toolbar .btn-gold, .toolbar .btn-ghost { width: auto; margin-top: 0; }
.table-wrap { overflow: auto; border-radius: var(--radius); background: var(--panel); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; color: var(--muted); font-weight: 500;
  padding: 11px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid rgba(255,255,255,.04); }
.data-table tr:hover td { background: rgba(24,144,255,.06); }
.chip { font-family: Consolas, monospace; color: var(--primary-2); }
.led { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.led i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.led.on i { background: var(--success); box-shadow: 0 0 8px var(--success); }
.led.off i { background: #5a6578; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px;
  border: 1px solid var(--line);
}
.tag.ok { color: var(--success); border-color: rgba(61,214,140,.4); }
.tag.no { color: var(--warn); border-color: rgba(250,173,20,.4); }
.tag.warn { color: #faad14; border-color: rgba(250,173,20,.55); background: rgba(250,173,20,.12); }
.data-table tr.is-apply td { background: rgba(250,173,20,.08); }
.tag.lv-critical { color: var(--danger); }
.tag.lv-warn { color: var(--warn); }

.switch {
  width: 44px; height: 24px; border-radius: 99px; border: 0;
  background: #2a3d5c; position: relative;
  transition: background .18s ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #c5cddb;
  transition: left .18s ease, background .18s ease;
}
.switch.on { background: rgba(24,144,255,.45); }
.switch.on::after { left: 23px; background: var(--primary-2); }
.switch:disabled { opacity: .4; cursor: not-allowed; }
.switch.busy { pointer-events: none; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button { font-size: 12px; }
.row-actions .btn-primary { width: auto; margin-top: 0; padding: 7px 12px; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 50;
  overflow-y: auto;
  padding: 24px 16px;
  box-sizing: border-box;
}
#video-picker-modal,
#img-picker-modal {
  z-index: 70;
}
.modal {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  margin: auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal.modal-lg, .modal.modal-wide {
  max-height: calc(100vh - 48px);
}
.od-no {
  border: 0;
  background: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.od-no:hover { text-decoration: underline; }
.modal header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
  position: sticky; top: -18px; z-index: 2;
  background: var(--panel);
  padding-top: 2px; padding-bottom: 8px;
  margin-top: -2px;
}
.icon-x { background: none; border: 0; color: var(--muted); font-size: 22px; }
.modal label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text) !important; font-size: 13px !important; }
.check input { width: auto; margin: 0; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px;
  position: sticky; bottom: -18px; z-index: 2;
  background: var(--panel);
  padding-top: 10px; padding-bottom: 2px;
  margin-bottom: -2px;
  border-top: 1px solid var(--line-2);
}
.modal-actions .btn-primary, .modal-actions .btn-gold, .modal-actions .btn-ghost { width: auto; }
.modal-actions #order-delete { margin-right: auto; color: #ff7875; }

.toast {
  position: fixed;
  left: 50%;
  top: 72px;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 80;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); padding: 10px 16px; border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  pointer-events: none;
  text-align: center;
  max-width: min(360px, calc(100vw - 48px));
}
.toast.toast-near {
  right: auto;
  bottom: auto;
  white-space: nowrap;
  z-index: 90;
  animation: toast-pop .18s ease-out;
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
  border-color: rgba(64,169,255,.45);
  background: rgba(13, 28, 52, 0.96);
}
@keyframes toast-pop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.92); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---------- customer app ---------- */
.client-body {
  min-height: 100%;
  background:
    radial-gradient(800px 360px at 80% -10%, rgba(24,144,255,.18), transparent 50%),
    #071428;
  padding: 20px 20px 40px;
  max-width: 1100px;
  margin: 0 auto;
}
.client-top {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 16px;
}
.client-kicker { font-size: 11px; letter-spacing: .22em; color: var(--primary-2); }
.client-top h1 { font-size: 28px; }
.client-user .btn-primary { width: auto; margin: 0; padding: 7px 12px; }
.client-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin: 8px 0 18px;
}
.client-stats div {
  background: var(--panel); border-radius: 10px; padding: 14px 16px;
}
.client-stats b { display: block; font-size: 26px; }
.client-stats span { color: var(--muted); font-size: 12px; }
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.room-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line-2);
}
.room-card.is-on { border-color: rgba(24,144,255,.45); box-shadow: 0 0 24px rgba(24,144,255,.12); }
.room-card.is-lock, .room-card.is-off { opacity: .82; }
.room-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.room-head h2 { font-size: 18px; }
.room-sub { color: var(--muted); font-size: 12px; margin: 8px 0 18px; }
.power-btn {
  width: 92px; height: 92px; border-radius: 50%;
  border: 0; display: grid; place-items: center;
  margin: 0 auto 12px;
  background: #1d3f66; color: #cfe3ff;
  font-size: 20px; font-weight: 700;
}
.power-btn.on { background: var(--primary); color: #fff; box-shadow: 0 0 28px rgba(24,144,255,.45); }
.power-btn:disabled { opacity: .45; cursor: not-allowed; }
.room-foot { text-align: center; color: var(--muted); font-size: 12px; }

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .span-6 { grid-column: span 12; }
  .devmap-layout, .ticket-overview { grid-template-columns: 1fr; }
  .hero-row, .explorer-grid, .sys-grid { grid-template-columns: 1fr; }
  .span-3, .span-4, .span-5 { grid-column: span 12; }
}
@media (max-width: 800px) {
  .app-body { grid-template-columns: 1fr; }
  .sider { display: none; }
}
