/* 友邦智慧冷库管理平台 · 效果原型样式
   视觉体系（docs/门户与大屏技术实施方案.md §5.3）：
   底色 #0B1220~#0E1A2B / 青色发光 #00E4FF / 品牌青绿 #15857A / 告警橙 #FF6A3B 红 #E5484D
   玻璃拟态卡片 + 发光描边 + LED 数字 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg0: #0B1220; --bg1: #0E1A2B;
  --cyan: #00E4FF; --teal: #15857A;
  --warn: #FF6A3B; --danger: #E5484D; --ok: #00E9A8;
  --ink: #E6F1FF; --mut: #7E93AC;
  --line: rgba(0, 228, 255, 0.14);
  --glass: rgba(255, 255, 255, 0.045);
  --led: "Orbitron", "D-DIN", ui-monospace, Consolas, monospace;
}
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: radial-gradient(1200px 700px at 70% -10%, #12263F 0%, var(--bg1) 45%, var(--bg0) 100%);
  color: var(--ink); overflow-x: hidden;
}
::selection { background: rgba(0, 228, 255, 0.35); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(0, 228, 255, 0.25); border-radius: 3px; }

/* ---------- 通用 ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 0 24px rgba(0, 228, 255, 0.04);
}
.neon { color: var(--cyan); text-shadow: 0 0 14px rgba(0, 228, 255, 0.75); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .off { color: #5A6B80; }
.panel-t { font-size: 14px; letter-spacing: 2px; color: var(--cyan); margin-bottom: 12px; font-weight: 600; }
.panel-t::before { content: "▍"; margin-right: 4px; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--mut); margin-bottom: 6px; letter-spacing: 1px; }
.field input, .field select {
  width: 100%; padding: 11px 14px; border-radius: 10px;
  border: 1px solid rgba(0, 228, 255, 0.25); outline: none;
  background: rgba(11, 18, 32, 0.6); color: var(--ink); font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field select:focus {
  border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 228, 255, 0.15);
}
.btn-neon {
  width: 100%; padding: 12px; border: none; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, var(--teal), #0E9BB8 60%, var(--cyan));
  color: #fff; font-size: 16px; font-weight: 600; letter-spacing: 6px;
  box-shadow: 0 8px 26px rgba(0, 228, 255, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-neon:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0, 228, 255, 0.5); }
.login-err { color: var(--danger); font-size: 12.5px; text-align: center; margin-top: 12px; letter-spacing: 1px; }
.shake { animation: shakeX 0.4s; }
@keyframes shakeX { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.btn-ghost2 {
  display: inline-block; padding: 9px 22px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(0, 228, 255, 0.4); color: var(--cyan);
  background: transparent; font-size: 14px; text-decoration: none; text-align: center;
  transition: background 0.2s, box-shadow 0.2s;
}
.btn-ghost2:hover { background: rgba(0, 228, 255, 0.08); box-shadow: 0 0 18px rgba(0, 228, 255, 0.25); }

/* 演示角标 */
.demo-corner {
  position: fixed; top: 14px; right: -30px; z-index: 200;
  transform: rotate(38deg); padding: 3px 34px;
  background: linear-gradient(135deg, var(--warn), var(--danger));
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 4px;
  box-shadow: 0 4px 14px rgba(229, 72, 77, 0.45); text-decoration: none;
}
.app .demo-corner { position: absolute; }

/* ---------- 视图切换 ---------- */
.view { display: none; min-height: 100vh; }
.view.active { display: block; }
#view-login.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.app[hidden] { display: none; }

/* ---------- 登录 ---------- */
.login-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 500px at 20% 110%, rgba(21, 133, 122, 0.22) 0%, transparent 60%),
    radial-gradient(900px 500px at 85% -10%, rgba(0, 228, 255, 0.12) 0%, transparent 60%);
}
.login-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(0, 228, 255, 0.045) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(0, 228, 255, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(700px 500px at 50% 45%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(700px 500px at 50% 45%, #000 0%, transparent 75%);
}
.login-card { width: min(400px, 90vw); padding: 40px 36px 28px; text-align: center; }
.login-logo { height: 52px; margin-bottom: 16px; }
.login-title { font-size: 22px; letter-spacing: 3px; margin-bottom: 6px; }
.login-sub { font-size: 10px; color: var(--mut); letter-spacing: 3px; margin-bottom: 26px; }
.login-form { text-align: left; }
.login-hint { margin-top: 14px; font-size: 11px; color: var(--mut); text-align: center; letter-spacing: 1px; }
.login-footer { margin-top: 26px; font-size: 12px; color: var(--mut); letter-spacing: 2px; }

/* ---------- 顶栏 ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; position: relative; }
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 26px;
  height: 62px; padding: 0 22px;
  border-radius: 0; border-left: none; border-right: none; border-top: none;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 34px; }
.brand-name { font-size: 15px; letter-spacing: 2px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.top-tabs { display: flex; gap: 4px; margin-left: 8px; }
.top-tabs a {
  padding: 8px 18px; border-radius: 999px; text-decoration: none;
  color: var(--mut); font-size: 14px; letter-spacing: 1px;
  border: 1px solid transparent; transition: all 0.2s; white-space: nowrap;
}
.top-tabs a:hover { color: var(--ink); }
.top-tabs a.on {
  color: var(--cyan); border-color: rgba(0, 228, 255, 0.4);
  background: rgba(0, 228, 255, 0.08); box-shadow: 0 0 16px rgba(0, 228, 255, 0.2);
}
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 1.8s infinite; }
.clock { font-family: var(--led); color: var(--cyan); letter-spacing: 2px; }
.logout { color: var(--mut); text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(126, 147, 172, 0.35); }
.logout:hover { color: var(--warn); border-color: var(--warn); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- 舞台 ---------- */
.stage { flex: 1; padding: 18px 22px 26px; }
.stage .view.active { display: block; min-height: auto; }

/* ---------- 总览 ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 16px 20px; }
.kpi-num { font-family: var(--led); font-size: 34px; font-weight: 700; letter-spacing: 2px; line-height: 1.1; }
.kpi-num i { font-style: normal; font-size: 14px; margin-left: 6px; color: var(--mut); }
.kpi-label { font-size: 12px; color: var(--mut); margin-top: 6px; letter-spacing: 2px; }
.ov-grid { display: grid; grid-template-columns: 1fr 330px; gap: 14px; }
.map-wrap { position: relative; height: calc(100vh - 240px); min-height: 430px; overflow: hidden; }
#map { position: absolute; inset: 0; background: transparent; }
/* 高德瓦片反色 → 暗色科技风 */
#map .leaflet-tile { filter: invert(1) hue-rotate(185deg) brightness(0.92) contrast(0.92) saturate(0.6); }
#map .leaflet-container { background: transparent; }
.map-legend {
  position: absolute; left: 14px; bottom: 14px; z-index: 500;
  display: flex; gap: 14px; padding: 8px 14px; font-size: 12px; color: var(--mut);
}
.map-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.map-legend .dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.map-legend .dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.map-legend .dot.off { background: #5A6B80; }

/* 地图标点（divIcon） */
.site-dot { position: relative; width: 16px; height: 16px; }
.site-dot i {
  position: absolute; inset: 3px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 10px var(--ok);
}
.site-dot.alarm i { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.site-dot.offline i { background: #5A6B80; box-shadow: none; }
.site-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid currentColor; opacity: 0.8;
  animation: ripple 2.2s ease-out infinite;
}
.site-dot.ok { color: var(--ok); } .site-dot.alarm { color: var(--warn); } .site-dot.offline { color: #5A6B80; animation: none; }
.site-dot.alarm::after { animation-duration: 1.2s; }
@keyframes ripple { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(2.6); opacity: 0; } }

/* 地图弹窗 */
.site-popup { font-size: 13px; color: var(--ink); min-width: 210px; }
.site-popup h4 { color: var(--cyan); margin-bottom: 8px; letter-spacing: 1px; }
.site-popup .row { display: flex; justify-content: space-between; gap: 18px; padding: 3px 0; color: var(--mut); }
.site-popup .row b { color: var(--ink); font-family: var(--led); font-weight: 500; }

/* 侧栏 */
.side-col { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.panel { padding: 16px; overflow: hidden; }
.alarm-list { list-style: none; max-height: 200px; overflow-y: auto; }
.alarm-list li {
  display: flex; gap: 10px; align-items: baseline;
  padding: 9px 4px; border-bottom: 1px dashed rgba(126, 147, 172, 0.18); font-size: 13px;
}
.alarm-list li:last-child { border-bottom: none; }
.alarm-list .lv { font-size: 11px; padding: 2px 8px; border-radius: 999px; flex-shrink: 0; }
.alarm-list .lv.high { background: rgba(229, 72, 77, 0.18); color: var(--danger); }
.alarm-list .lv.mid { background: rgba(255, 106, 59, 0.18); color: var(--warn); }
.alarm-list .t { margin-left: auto; color: var(--mut); font-size: 11px; flex-shrink: 0; }
.alarm-list .empty { color: var(--mut); }
.site-list { list-style: none; max-height: 320px; overflow-y: auto; }
.site-list li {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 4px; border-bottom: 1px dashed rgba(126, 147, 172, 0.18); font-size: 13px;
  cursor: pointer; transition: background 0.15s;
}
.site-list li:hover { background: rgba(0, 228, 255, 0.05); }
.site-list li:last-child { border-bottom: none; }
.site-list .st { width: 8px; height: 8px; border-radius: 50%; }
.site-list .st.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.site-list .st.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.site-list .st.off { background: #5A6B80; }
.site-list .name { color: var(--ink); }
.site-list .temp { font-family: var(--led); color: var(--cyan); }

/* ---------- 大屏 ---------- */
.dash-head { text-align: center; padding: 10px 0 16px; }
.dash-head h2 {
  font-size: 26px; letter-spacing: 8px; color: var(--cyan);
  text-shadow: 0 0 22px rgba(0, 228, 255, 0.55);
}
.dash-sub { font-size: 11px; color: var(--mut); letter-spacing: 4px; margin-top: 6px; }
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.chart-card { padding: 16px; }
.chart-card .chart { height: 262px; }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; }

/* ---------- 数字孪生 ---------- */
.twin-grid { display: grid; grid-template-columns: 1fr 320px; gap: 14px; }
.twin-stage { position: relative; height: calc(100vh - 160px); min-height: 460px; overflow: hidden; }
.twin-stage canvas { display: block; }
.twin-hint {
  position: absolute; left: 14px; top: 12px; z-index: 5;
  font-size: 12px; color: var(--mut); letter-spacing: 1px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(11, 18, 32, 0.6); border: 1px solid var(--line);
}
.twin-toolbar { position: absolute; right: 14px; top: 12px; z-index: 5; display: flex; gap: 8px; }
.twin-toolbar .btn-ghost2 { font-size: 12px; padding: 7px 14px; }
.room-list { list-style: none; }
.room-list li {
  padding: 11px 6px; border-bottom: 1px dashed rgba(126, 147, 172, 0.18);
  cursor: pointer; border-left: 2px solid transparent; transition: all 0.15s;
}
.room-list li:hover { background: rgba(0, 228, 255, 0.05); }
.room-list li.sel { border-left-color: var(--cyan); background: rgba(0, 228, 255, 0.07); }
.room-list li:last-child { border-bottom: none; }
.room-list .rn { font-size: 13.5px; color: var(--ink); display: flex; justify-content: space-between; }
.room-list .rn b { font-family: var(--led); color: var(--cyan); font-weight: 500; }
.room-list .rn b.warn { color: var(--warn); }
.room-list .rd { font-size: 11.5px; color: var(--mut); margin-top: 4px; }
.dev-list { list-style: none; }
.dev-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 6px; border-bottom: 1px dashed rgba(126, 147, 172, 0.18); font-size: 13px;
}
.dev-list li:last-child { border-bottom: none; }
.dev-list .k { color: var(--mut); }
.dev-list .v { font-family: var(--led); letter-spacing: 1px; }
.dev-list .v.run { color: var(--ok); }
.dev-list .v.idle { color: #5A6B80; }

/* ---------- 控制面板 ---------- */
.ctl-head { padding: 6px 0 14px; }
.ctl-head h2 { font-size: 20px; letter-spacing: 4px; }
.ctl-sub { font-size: 12px; color: var(--mut); margin-top: 6px; letter-spacing: 1px; }
.ctl-grid { display: flex; flex-direction: column; gap: 14px; }
.ctl-site { max-width: 420px; padding: 14px 16px 4px; }
.ctl-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.ctl-card { padding: 18px; }
.ctl-card h4 { font-size: 13px; color: var(--mut); letter-spacing: 2px; margin-bottom: 12px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(0, 228, 255, 0.35);
  background: rgba(0, 228, 255, 0.06); color: var(--cyan); font-size: 18px; cursor: pointer;
  transition: background 0.15s;
}
.stepper button:hover { background: rgba(0, 228, 255, 0.16); }
.stepper .val { font-family: var(--led); font-size: 26px; color: var(--cyan); min-width: 110px; text-align: center; }
.stepper .val i { font-style: normal; font-size: 13px; color: var(--mut); margin-left: 4px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; }
.switch-row .state { font-family: var(--led); font-size: 18px; }
.switch.on .state { color: var(--ok); } .switch.off .state { color: #5A6B80; }
.toggle {
  width: 52px; height: 28px; border-radius: 999px; position: relative; cursor: pointer;
  background: rgba(126, 147, 172, 0.3); transition: background 0.2s; border: none;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; transition: left 0.2s;
}
.toggle.on { background: linear-gradient(135deg, var(--teal), var(--cyan)); }
.toggle.on::after { left: 27px; }
.ctl-submit { display: flex; gap: 14px; align-items: center; }
.ctl-submit .btn-neon { width: auto; padding: 11px 44px; }
.ctl-submit .note { font-size: 12px; color: var(--mut); }
.audit { padding: 16px; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.audit-table th {
  text-align: left; color: var(--mut); font-weight: 500; padding: 8px 10px;
  border-bottom: 1px solid var(--line); letter-spacing: 1px;
}
.audit-table td { padding: 8px 10px; border-bottom: 1px dashed rgba(126, 147, 172, 0.15); color: var(--ink); }
.audit-table td.mut { color: var(--mut); }
.audit-table .passed { color: var(--ok); }

/* ---------- 我的 ---------- */
#view-mine.active { display: flex; align-items: flex-start; justify-content: center; padding-top: 6vh; }
.mine-card { width: min(430px, 92vw); padding: 30px; text-align: center; }
.avatar {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: linear-gradient(135deg, var(--teal), var(--cyan)); color: #fff;
  box-shadow: 0 0 24px rgba(0, 228, 255, 0.4);
}
.mine-card h3 { letter-spacing: 2px; }
.mine-card .role { font-size: 12px; color: var(--cyan); margin: 6px 0 18px; letter-spacing: 1px; }
.mine-info { list-style: none; text-align: left; margin-bottom: 18px; }
.mine-info li { display: flex; justify-content: space-between; padding: 10px 2px; border-bottom: 1px dashed rgba(126,147,172,.18); font-size: 13.5px; }
.mine-info span { color: var(--mut); } .mine-info b { font-weight: 500; }
.mine-note { font-size: 12px; color: var(--mut); text-align: left; margin-bottom: 20px; line-height: 1.7; }

/* ---------- 弹窗 / Toast ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(4, 8, 16, 0.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal-mask[hidden] { display: none; }
.modal { width: min(400px, 92vw); padding: 26px 26px 22px; }
.modal h3 { letter-spacing: 2px; color: var(--cyan); margin-bottom: 8px; }
.modal-sub { font-size: 13px; color: var(--mut); margin-bottom: 18px; line-height: 1.6; }
.verify-tip { font-size: 11px; color: var(--warn); margin-bottom: 16px; }
.modal-btns { display: flex; gap: 12px; }
.modal-btns .btn-neon { flex: 1; }
.modal-btns .btn-ghost2 { flex: 1; }
.toast {
  position: fixed; top: 84px; left: 50%; transform: translateX(-50%);
  z-index: 400; padding: 12px 26px; border-radius: 999px;
  background: rgba(11, 18, 32, 0.92); border: 1px solid rgba(0, 228, 255, 0.5);
  color: var(--cyan); font-size: 14px; letter-spacing: 1px;
  box-shadow: 0 0 30px rgba(0, 228, 255, 0.35);
  animation: toastIn 0.25s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 移动端（双布局机制 §5.2） ---------- */
.bottom-tabs { display: none; }
@media (max-width: 768px) {
  .top-tabs { display: none; }
  .brand-name { font-size: 13px; }
  .stage { padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); }
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-num { font-size: 26px; }
  .ov-grid { grid-template-columns: 1fr; }
  .map-wrap { height: 54vh; min-height: 320px; }
  .dash-grid { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: span 1; }
  .chart-card .chart { height: 230px; }
  .dash-head h2 { font-size: 19px; letter-spacing: 4px; }
  .twin-grid { grid-template-columns: 1fr; }
  .twin-stage { height: 52vh; min-height: 300px; }
  .twin-hint { font-size: 11px; }
  .bottom-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
    display: flex; justify-content: space-around; align-items: center;
    height: calc(62px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 0; border-left: none; border-right: none; border-bottom: none;
  }
  .bottom-tabs a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    text-decoration: none; color: var(--mut); font-size: 11px; flex: 1; padding: 8px 0;
  }
  .bottom-tabs a i { font-style: normal; font-size: 18px; }
  .bottom-tabs a.on { color: var(--cyan); text-shadow: 0 0 10px rgba(0, 228, 255, 0.6); }
  .clock { display: none; }
  .audit-table th:nth-child(2), .audit-table td:nth-child(2),
  .audit-table th:nth-child(6), .audit-table td:nth-child(6) { display: none; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
  .kpi-num { font-size: 22px; }
}
