:root {
  --header: #2d2a28;
  --sidebar: #3a3a3a;
  --side-w: 168px;
  --accent: #f5a623;
  --green: #52c41a;
  --teal: #0d7377;
  --red: #e5484d;
  --text: #333;
  --muted: #888;
  --line: #eee;
  --tab-h: 38px;
  --top-h: 48px;
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: var(--font); color: var(--text); background: #f5f5f5; }
button, input, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* login */
.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 20% 0%, #1a3a4a, #121418 55%);
}
.login-card {
  width: 420px;
  background: #fff;
  border-radius: 8px;
  padding: 36px 40px 32px;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand img { width: 36px; height: 36px; }
.login-brand b { font-size: 22px; color: #1d4e6b; }
.login-card h1 { font-size: 16px; font-weight: 600; color: #555; margin: 0 0 24px; }
.login-card label { display: block; font-size: 13px; color: #666; margin: 0 0 6px; }
.login-card input {
  width: 100%; height: 38px; border: 1px solid #d9d9d9; border-radius: 4px;
  padding: 0 12px; margin-bottom: 14px; font-size: 14px;
}
.login-card input:focus { outline: none; border-color: #40a9ff; }
.login-card button {
  width: 100%; height: 40px; border: 0; border-radius: 4px; cursor: pointer;
  background: #1890ff; color: #fff; font-size: 15px;
}
.login-hint { margin-top: 12px; color: #999; font-size: 12px; text-align: center; }

/* shell */
.app { display: none; height: 100%; }
.app.on { display: flex; flex-direction: column; }
.topbar {
  height: var(--top-h); background: var(--header); color: #fff;
  display: flex; align-items: center; padding: 0 16px; flex-shrink: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.brand img { width: 28px; height: 28px; }
.brand .name { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand .name em { font-style: normal; color: #2ec7ff; }
.sys-title { font-size: 18px; font-weight: 600; margin-left: 8px; }
.top-user { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: #f5c542; cursor: pointer; }
.top-user i { width: 8px; height: 8px; border-radius: 50%; background: #f5c542; display: inline-block; }

.body { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: var(--side-w); background: var(--sidebar); color: #ddd; flex-shrink: 0;
  display: flex; flex-direction: column; padding-top: 6px; overflow: auto;
}
.side-grid {
  height: 36px; display: grid; place-items: center; color: #bbb; font-size: 18px;
  border-bottom: 1px solid #4a4a4a; margin-bottom: 4px;
}
.nav-item, .nav-sub {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px; cursor: pointer; font-size: 13px; user-select: none;
}
.nav-item:hover, .nav-sub:hover { background: #464646; }
.nav-item.on, .nav-sub.on { background: #2f2f2f; color: var(--accent); }
.nav-item .caret { margin-left: auto; font-size: 10px; opacity: .7; }
.nav-group .kids { display: none; background: #333; }
.nav-group.open .kids { display: block; }
.nav-sub { padding-left: 36px; height: 36px; font-size: 13px; }
.ico { width: 16px; text-align: center; opacity: .9; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #fff; }
.tabs {
  height: var(--tab-h); background: #fafafa; border-bottom: 1px solid #e6e6e6;
  display: flex; align-items: stretch; overflow-x: auto; flex-shrink: 0;
}
.tab {
  display: flex; align-items: center; gap: 8px; padding: 0 16px;
  font-size: 13px; color: #555; border-right: 1px solid #eee; cursor: pointer; white-space: nowrap;
}
.tab.on { background: #fff; color: #1890ff; border-bottom: 2px solid #1890ff; }
.tab .x { font-size: 12px; color: #aaa; }
.tab .x:hover { color: #f5222d; }
.page { flex: 1; overflow: auto; min-height: 0; position: relative; }
.crumb { padding: 12px 16px 4px; font-size: 13px; color: #888; }
.crumb b { color: #333; font-weight: 500; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px 12px; align-items: center; }
.toolbar input, .toolbar select {
  height: 32px; border: 1px solid #d9d9d9; border-radius: 4px; padding: 0 10px; font-size: 13px; background: #fff;
}
.toolbar input { min-width: 180px; }
.btn { height: 32px; padding: 0 14px; border: 0; border-radius: 4px; cursor: pointer; font-size: 13px; color: #fff; }
.btn-green { background: var(--green); }
.btn-teal { background: var(--teal); }
.btn-ghost { background: #fff; color: #555; border: 1px solid #d9d9d9; }
.btn-red { background: #ff4d4f; }
.spin { width: 72px; height: 32px; }

.table-wrap { padding: 0 16px 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 500; color: #555; background: #fafafa;
  border-bottom: 1px solid #f0f0f0; padding: 10px 8px; white-space: nowrap;
}
table.data td { padding: 11px 8px; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
table.data tr:hover td { background: #fafafa; }
.exp { display: inline-block; width: 14px; color: #bbb; cursor: pointer; }
.xmark { color: #ff4d4f; font-weight: 700; }
.pager {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; font-size: 13px; color: #666;
}
.pager a, .pager span { min-width: 24px; text-align: center; cursor: pointer; padding: 2px 6px; }
.pager .cur { color: #1890ff; font-weight: 600; }
.overdue { color: #f5222d; }
.ok-dot { color: #52c41a; }
.online { color: #52c41a; }
.offline { color: #ff4d4f; }

/* map home */
#home-map { position: absolute; inset: 0; isolation: isolate; z-index: 1; }
#cfg-map { position: relative; min-height: 420px; isolation: isolate; z-index: 1; border: 1px solid #eee; }
.leaflet-container { font-family: var(--font); background: #f4efe6; }

/* matrix */
.matrix-grid { display: grid; gap: 12px; padding: 0 16px 16px; }
.lift-card {
  display: grid; grid-template-columns: 160px 1fr; gap: 8px;
  border: 1px solid #eee; background: #fff; padding: 8px;
  cursor: pointer; transition: box-shadow .15s, border-color .15s;
}
.lift-card:hover { border-color: #1890ff; box-shadow: 0 4px 14px rgba(24,144,255,.18); }
.cabin {
  height: 150px; background: linear-gradient(#6a6a6a, #3a3a3a);
  position: relative; overflow: hidden; perspective: 400px;
}
.cabin-3d {
  position: absolute; inset: 10px;
  transform: rotateY(-8deg) rotateX(6deg);
  background: linear-gradient(90deg, #2a2a2a 0 8px, #555 8px, #666 50%, #444);
  box-shadow: inset 0 0 30px #000;
  display: grid; grid-template-columns: 1fr 1fr;
}
.cabin-3d::before, .cabin-3d::after {
  content: ""; border-right: 2px solid #222; background: linear-gradient(#777, #444);
}
.xf {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #c00; font-size: 72px; font-weight: 700; text-shadow: 0 0 8px #000; pointer-events: none;
}
.spd { position: absolute; left: 8px; bottom: 4px; color: #fff; font-size: 12px; }
.lift-meta { font-size: 12px; color: #444; line-height: 1.7; }
.lift-meta b { font-weight: 600; }
.kv { display: flex; justify-content: space-between; gap: 8px; }
.kv span:last-child { color: #111; }

/* form */
.form-page { display: grid; grid-template-columns: 420px 1fr; gap: 16px; padding: 16px; min-height: 100%; }
.form-grid { display: grid; gap: 12px; }
.form-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 8px; font-size: 13px; }
.form-row input { height: 32px; border: 1px solid #d9d9d9; border-radius: 4px; padding: 0 8px; }
.req { color: #f5222d; }
.form-actions { padding-left: 110px; display: flex; gap: 8px; }

/* dashboard */
.screen {
  position: fixed; inset: 0; z-index: 4000; background: #020814; color: #d7f3ff;
  display: none; flex-direction: column; overflow: hidden;
}
.screen.on { display: flex; }
.screen-head {
  height: 48px; display: flex; align-items: center; justify-content: center;
  background: #071428; border-bottom: 1px solid #1c6aa8; position: relative; flex-shrink: 0;
}
.screen-head h1 {
  margin: 0; font-size: 20px; letter-spacing: 4px;
  background: linear-gradient(#9fe8ff, #2ec7ff); -webkit-background-clip: text; color: transparent;
}
.screen-head .back {
  position: absolute; left: 16px; top: 10px; height: 28px; padding: 0 12px;
  border: 1px solid #2ec7ff; background: transparent; color: #9fe8ff; cursor: pointer; border-radius: 2px;
}
.screen-body {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 300px;
  grid-template-rows: 200px minmax(0, 1fr) 168px;
  gap: 8px;
  padding: 8px 10px 10px;
  overflow: hidden;
}
.panel {
  border: 1px solid #1a6aa3; background: rgba(4, 18, 40, .92);
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
}
.panel h3 {
  margin: 0; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; letter-spacing: 2px; color: #9fe8ff; border-bottom: 1px solid #164e78;
}
.chart-box { flex: 1; min-height: 0; position: relative; }
.chart-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.p-iot { grid-area: 1 / 1; }
.p-model { grid-area: 2 / 1; }
.p-cover { grid-area: 3 / 1; }
.p-map { grid-area: 1 / 2 / 3 / 3; background: rgba(3, 16, 36, .75); }
.p-month { grid-area: 3 / 2; }
.p-fault { grid-area: 1 / 3; }
.p-rank { grid-area: 2 / 3; }
.p-feed { grid-area: 3 / 3; }
.kpis {
  display: grid; grid-template-columns: repeat(5, 1fr); flex-shrink: 0;
  height: 64px; border-bottom: 1px solid #164e78;
}
.kpi { text-align: center; padding-top: 6px; }
.kpi .n { font-size: 22px; font-weight: 700; color: #4df; line-height: 1.1; text-shadow: 0 0 10px #2ec7ff; }
.kpi .n.warn { color: #ff5a5a; text-shadow: 0 0 10px #f44; }
.kpi .l { font-size: 12px; color: #9fe8ff; margin-top: 2px; }
#globe { flex: 1; min-height: 0; position: relative; }
#globe canvas { display: block; width: 100% !important; height: 100% !important; }
.home-enter {
  position: absolute; right: 18px; top: 12px; z-index: 8;
  height: 36px; padding: 0 16px; border: 0; border-radius: 4px; cursor: pointer;
  background: #1890ff; color: #fff; font-size: 14px; box-shadow: 0 6px 16px rgba(24,144,255,.35);
}
.rank { flex: 1; min-height: 0; overflow: hidden; padding: 4px 10px; font-size: 12px; display: flex; flex-direction: column; justify-content: space-evenly; }
.rank-row { display: grid; grid-template-columns: 40px 1fr 28px; gap: 4px; align-items: center; margin: 0; flex: 1; min-height: 0; }
.bar { height: 4px; background: #133; grid-column: 1 / -1; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #1aa, #2ec7ff); }
.feed-wrap { flex: 1; min-height: 0; overflow: hidden; }
.feed { width: 100%; border-collapse: collapse; font-size: 11px; table-layout: fixed; }
.feed th, .feed td { padding: 4px 5px; border-bottom: 1px solid #123; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed th { color: #7ad; background: #071428; }
.idx { display: inline-grid; place-items: center; width: 16px; height: 16px; background: #1890ff; color: #fff; font-size: 10px; }

.hidden { display: none !important; }
.logout-menu {
  position: absolute; right: 12px; top: 44px; background: #fff; color: #333;
  border: 1px solid #eee; box-shadow: 0 8px 20px rgba(0,0,0,.12); display: none; z-index: 30;
}
.logout-menu.on { display: block; }
.logout-menu div { padding: 8px 16px; cursor: pointer; font-size: 13px; }
.logout-menu div:hover { background: #f5f5f5; }

.lift-mask {
  position: fixed; inset: 0; z-index: 4100; background: rgba(8,12,18,.55);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.lift-mask.on { display: flex; }
.lift-dlg {
  width: min(1180px, 96vw); height: min(720px, 92vh);
  background: #111; color: #e8eef4; border-radius: 8px; overflow: hidden;
  display: grid; grid-template-columns: 1.35fr 360px; box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.lift-video { position: relative; background: #090909; min-height: 0; }
.cctv {
  position: absolute; inset: 0; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #4a4a4a 0%, #1c1c1c 70%);
  perspective: 700px;
}
.cctv.offline { background: #111; }
.cctv-hud {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  font-family: Consolas, "Courier New", monospace; font-size: 13px; color: #9fef7a;
  text-shadow: 0 0 6px #000;
}
.cctv-hud .rec { position: absolute; left: 12px; top: 10px; color: #ff4d4f; }
.cctv-hud .rec i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff4d4f; margin-right: 6px; animation: blink 1s infinite; }
.cctv-hud .cam { position: absolute; right: 12px; top: 10px; }
.cctv-hud .ts { position: absolute; left: 12px; bottom: 10px; }
.cctv-hud .fl { position: absolute; right: 12px; bottom: 10px; font-size: 22px; color: #fff; }
@keyframes blink { 50% { opacity: .2; } }
.scan { position: absolute; inset: 0; z-index: 4; pointer-events: none; background: repeating-linear-gradient(transparent 0 2px, rgba(0,0,0,.12) 2px 3px); }
.cabin-live {
  position: absolute; left: 12%; right: 12%; top: 8%; bottom: 6%;
  transform: rotateX(6deg);
  background: linear-gradient(#7a7a7a, #4e4e4e);
  box-shadow: inset 0 0 40px #000, 0 10px 30px #000;
  border: 8px solid #2a2a2a;
}
.cabin-wall {
  position: absolute; inset: 10px 10px 18px;
  background:
    linear-gradient(90deg, #5c5c5c 0 12px, transparent 12px),
    linear-gradient(#6e6e6e, #555);
  box-shadow: inset 0 0 30px rgba(0,0,0,.45);
}
.handrail { position: absolute; left: 8%; right: 8%; bottom: 28%; height: 6px; background: #cfcfcf; border-radius: 3px; box-shadow: 0 4px 8px #000; }
.display {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  width: 72px; height: 36px; background: #041; color: #6f6; text-align: center;
  line-height: 36px; font-weight: 700; letter-spacing: 1px; box-shadow: 0 0 12px #0f0;
}
.doors { position: absolute; inset: 18% 18% 8%; overflow: hidden; background: #1a1a1a; }
.dl, .dr {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background: linear-gradient(90deg, #8a8a8a, #5a5a5a 12%, #777 50%, #4a4a4a);
  border: 1px solid #222; transition: transform 1.15s cubic-bezier(.2,.7,.2,1);
}
.dl { left: 0; box-shadow: inset -8px 0 16px rgba(0,0,0,.35); }
.dr { right: 0; box-shadow: inset 8px 0 16px rgba(0,0,0,.35); }
.doors.open .dl, .doors.opening .dl { transform: translateX(-92%); }
.doors.open .dr, .doors.opening .dr { transform: translateX(92%); }
.nosig { position: absolute; inset: 0; display: grid; place-items: center; color: #f66; font-size: 28px; letter-spacing: 4px; z-index: 6; }
.lift-side { background: #1b1f24; padding: 16px; overflow: auto; border-left: 1px solid #2a323c; }
.lift-side h2 { margin: 0 0 4px; font-size: 16px; color: #fff; }
.lift-side .sub { color: #8ea0b3; font-size: 12px; margin-bottom: 14px; }
.st-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.st { background: #12161b; border: 1px solid #2a323c; padding: 8px 10px; border-radius: 4px; }
.st .k { color: #8ea0b3; font-size: 12px; }
.st .v { color: #e8eef4; font-size: 15px; margin-top: 2px; }
.st .v.on { color: #52c41a; }
.st .v.off { color: #ff4d4f; }
.st .v.act { color: #f5c542; }
.door-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.door-btns button { height: 40px; border: 0; border-radius: 4px; cursor: pointer; color: #fff; font-size: 14px; }
.btn-open { background: #52c41a; }
.btn-close { background: #1890ff; }
.btn-stop { background: #faad14; color: #222; grid-column: 1 / -1; height: 34px; }
.btn-off { opacity: .45; pointer-events: none; }
.lift-side .close-x {
  position: absolute; right: 12px; top: 10px; border: 0; background: transparent;
  color: #9aa; font-size: 20px; cursor: pointer;
}
.lift-side { position: relative; }
.log-box { background: #12161b; border: 1px solid #2a323c; border-radius: 4px; padding: 8px; max-height: 220px; overflow: auto; font-size: 12px; }
.log-box div { padding: 4px 0; border-bottom: 1px solid #222; color: #c5d0da; }
.log-box em { color: #8ea0b3; font-style: normal; margin-right: 8px; }
