:root {
  --brand: #2E9D61;
  --brand-dark: #217a4a;
  --bg: #f4f7f9;
  --text: #1f2d3d;
  --muted: #7b8a97;
  --border: #e5eaef;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.root { height: 100%; }

/* ---------- 登录页 ---------- */
.login-page {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #e8f5ee 0%, #f4f7f9 45%, #eef2f6 100%);
  padding: 24px;
}
.login-card {
  width: 900px;
  max-width: 100%;
  min-height: 520px;
  display: flex;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(20, 45, 60, 0.18);
  background: #fff;
}
.login-left {
  width: 45%;
  padding: 40px 36px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand .brand-mark {
  width: 56px; height: 56px; border-radius: 14px;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; letter-spacing: 2px;
}
.login-brand .brand-logo { width: 64px; max-height: 64px; object-fit: contain; }
.login-brand h1 { font-size: 24px; margin: 22px 0 10px; font-weight: 700; letter-spacing: 1px; }
.login-brand p { margin: 0; font-size: 13px; opacity: 0.82; line-height: 1.7; }
.login-features { list-style: none; padding: 0; margin: 0; font-size: 13px; line-height: 2.1; opacity: 0.9; }
.login-features li::before { content: "✓"; margin-right: 8px; opacity: 0.9; }
.login-form { flex: 1; padding: 56px 44px; display: flex; flex-direction: column; justify-content: center; }
.login-form h2 { margin: 0 0 6px; font-size: 24px; }
.login-sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.login-tip {
  margin-top: 22px; padding: 10px 12px; border-radius: 8px;
  background: #f5f9f7; color: var(--muted); font-size: 12px; line-height: 1.7;
}

/* ---------- 布局 ---------- */
.layout { height: 100%; }
.aside { background: #1b2a3a; transition: width .2s; overflow-x: hidden; }
.aside-brand {
  height: 60px; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; color: #fff; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.aside-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--brand); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.aside-logo { width: 30px; height: 30px; object-fit: contain; flex: none; }
.logo-preview {
  height: 46px; max-width: 150px; object-fit: contain;
  background: #f5f7fa; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px;
}
.aside-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-menu { border-right: none; }
.side-menu .el-menu-item.is-active { background: var(--brand) !important; }
.side-menu .el-sub-menu .el-menu-item.is-active { background: var(--brand) !important; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.collapse-btn { font-size: 18px; cursor: pointer; color: var(--muted); }
.page-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.tenant-tag { border-color: var(--brand); color: var(--brand); }
.user-chip { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; color: var(--text); outline: none; }
.main { padding: 18px; background: var(--bg); overflow-y: auto; }

/* ---------- 通用内容 ---------- */
.page { display: flex; flex-direction: column; gap: 16px; }
.panel {
  background: #fff; border-radius: 10px; padding: 16px 18px;
  box-shadow: 0 2px 10px rgba(30, 60, 80, 0.04);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title { font-size: 15px; font-weight: 600; }
.panel-sub { font-size: 12px; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .spacer { flex: 1; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: #fff; border-radius: 10px; padding: 18px;
  box-shadow: 0 2px 10px rgba(30, 60, 80, 0.04);
  display: flex; align-items: center; gap: 14px; border-left: 4px solid var(--brand);
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: rgba(46, 157, 97, 0.1); color: var(--brand);
}
.stat-info .num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-info .label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-card.warn { border-left-color: #e6a23c; }
.stat-card.warn .stat-icon { background: rgba(230,162,60,0.12); color: #e6a23c; }
.stat-card.danger { border-left-color: #f56c6c; }
.stat-card.danger .stat-icon { background: rgba(245,108,108,0.12); color: #f56c6c; }
.stat-card.info { border-left-color: #409eff; }
.stat-card.info .stat-icon { background: rgba(64,158,255,0.12); color: #409eff; }

.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.device-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: #fff;
  transition: box-shadow .2s, transform .2s;
}
.device-card:hover { box-shadow: 0 8px 22px rgba(30,60,80,0.1); transform: translateY(-2px); }
.device-card .dc-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.device-card .dc-name { font-weight: 600; font-size: 14px; }
.device-card .dc-code { font-size: 12px; color: var(--muted); margin-top: 3px; }
.device-card .dc-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 12px; font-size: 12px; }
.device-card .dc-metrics b { font-size: 15px; font-weight: 600; display: block; margin-top: 2px; }
.device-card .dc-foot { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: #c0c4cc; }
.dot.on { background: var(--brand); box-shadow: 0 0 0 3px rgba(46,157,97,0.15); }
.dot.off { background: #c0c4cc; }

.chart { width: 100%; height: 300px; }
.chart.small { height: 240px; }
.empty { padding: 30px; text-align: center; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.flex { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.mb10 { margin-bottom: 10px; }

/* 星期选择、时间段行 */
.week-checks .el-checkbox { margin-right: 14px; }
.period-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.period-row .el-input { width: 130px; }

/* 数据表紧凑一点 */
.el-table { font-size: 13px; }
.el-table th.el-table__cell { background: #f8fafb !important; color: #55616d; font-weight: 600; }

/* 首页 */
.dash-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.weather-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.weather-item {
  display: grid; grid-template-columns: 56px 90px 1fr; grid-template-rows: auto auto;
  gap: 2px 8px; padding: 8px 10px; border-radius: 8px; background: #f8fafb;
}
.weather-item .wi-date { font-weight: 600; font-size: 13px; grid-row: span 2; align-self: center; }
.weather-item .wi-temp { font-size: 13px; grid-row: span 2; align-self: center; }
.weather-item .wi-detail { font-size: 12px; color: var(--muted); }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-row { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .login-card { flex-direction: column; }
  .login-left { width: 100%; min-height: 200px; padding: 26px; }
  .login-form { padding: 30px 24px; }
  .aside { position: fixed; z-index: 2000; height: 100%; }
}

/* ---------- 数据大屏 ---------- */
.screen-root {
  position: fixed; inset: 0; z-index: 1200;
  background: radial-gradient(circle at 50% 0%, #0b2038 0%, #050e1a 55%, #03080f 100%);
  color: #cfe8f5; overflow: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
.screen-header {
  position: relative; height: 64px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 22px;
  background: linear-gradient(180deg, rgba(18, 48, 80, 0.85) 0%, rgba(5, 14, 26, 0) 100%);
}
.screen-header::after {
  content: ""; position: absolute; left: 4%; right: 4%; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124, 231, 253, 0.65), transparent);
}
.screen-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 26px; font-weight: 700; letter-spacing: 5px; color: #eaf7ff;
  text-shadow: 0 0 14px rgba(124, 231, 253, 0.75); white-space: nowrap;
}
.screen-title small {
  display: block; margin-top: 2px; font-size: 12px; font-weight: 400;
  letter-spacing: 2px; color: #7ce7fd; text-shadow: none;
}
.screen-clock { font-family: Consolas, "Courier New", monospace; font-size: 14px; color: #7ce7fd; letter-spacing: 1px; }
.screen-clock small { color: #6f93a8; margin-left: 8px; letter-spacing: 0; }
.screen-header-right { display: flex; align-items: center; gap: 12px; }
.screen-exit {
  cursor: pointer; font-size: 12px; color: #7ce7fd; border: 1px solid rgba(124,231,253,.45);
  padding: 4px 10px; border-radius: 3px; background: rgba(124,231,253,.08);
}
.screen-exit:hover { background: rgba(124,231,253,.2); }
.screen-body {
  display: grid; height: calc(100vh - 64px); padding: 4px 14px 14px;
  grid-template-columns: 320px 1fr 360px;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
}
.screen-panel {
  position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column;
  padding: 12px 14px; background: linear-gradient(180deg, rgba(11, 33, 55, 0.92), rgba(5, 16, 29, 0.92));
  border: 1px solid rgba(124, 231, 253, 0.28);
  box-shadow: inset 0 0 22px rgba(124, 231, 253, 0.07), 0 0 18px rgba(0, 0, 0, 0.35);
  clip-path: polygon(0 14px, 14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%);
}
.screen-panel::before, .screen-panel::after {
  content: ""; position: absolute; width: 16px; height: 16px; pointer-events: none;
  border-color: #7ce7fd; border-style: solid;
}
.screen-panel::before { left: 0; top: 20px; border-width: 0 0 0 2px; }
.screen-panel::after { right: 0; bottom: 20px; border-width: 0 2px 0 0; }
.screen-panel-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; letter-spacing: 2px; color: #7ce7fd; margin-bottom: 10px; flex: none;
}
.screen-panel-title span:first-child::before {
  content: ""; display: inline-block; width: 3px; height: 13px; margin-right: 8px;
  background: #7ce7fd; box-shadow: 0 0 8px #7ce7fd; vertical-align: -1px;
}
.screen-panel-title .sub { font-size: 11px; color: #6f93a8; letter-spacing: 0; }
.sp-project { grid-column: 1; grid-row: 1; }
.sp-flow { grid-column: 1; grid-row: 2; }
.sp-china { grid-column: 2; grid-row: 1; }
.sp-map { grid-column: 2; grid-row: 2; padding: 0; overflow: hidden; }
.sp-weather { grid-column: 3; grid-row: 1; }
.sp-devices { grid-column: 3; grid-row: 2; }
.screen-chart { flex: 1; min-height: 0; width: 100%; }
.screen-info-list { display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.screen-info-row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed rgba(124,231,253,.12); padding-bottom: 8px; }
.screen-info-row .k { color: #6f93a8; flex: none; }
.screen-info-row .v { color: #d8f1ff; text-align: right; word-break: break-all; }
.screen-kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }
.screen-kpi .item {
  background: rgba(124, 231, 253, 0.06); border: 1px solid rgba(124, 231, 253, 0.18);
  padding: 10px; border-radius: 4px;
}
.screen-kpi .item b { display: block; font-size: 22px; color: #7ce7fd; font-family: Consolas, monospace; line-height: 1.2; }
.screen-kpi .item span { font-size: 11px; color: #6f93a8; }
.screen-kpi .item.green b { color: #2fe39b; }
.screen-kpi .item.red b { color: #ff6b6b; }
.screen-weather-days { display: flex; gap: 4px; flex: none; margin-bottom: 4px; }
.screen-weather-day {
  flex: 1; text-align: center; padding: 5px 0; border-radius: 4px;
  background: rgba(124, 231, 253, 0.05); font-size: 11px; color: #90b3c6;
}
.screen-weather-day .ico { color: #7ce7fd; font-size: 19px; display: block; margin: 2px 0; }
.screen-weather-day .temp { color: #d8f1ff; font-family: Consolas, monospace; }
.screen-device-head, .screen-device-row {
  display: grid; grid-template-columns: 1.5fr 0.9fr 0.9fr 0.7fr;
  gap: 6px; align-items: center; font-size: 12px;
}
.screen-device-head { color: #6f93a8; padding: 6px 8px; border-bottom: 1px solid rgba(124,231,253,.18); flex: none; }
.screen-device-rows { flex: 1; overflow: hidden; }
.screen-device-row {
  padding: 8px; border-bottom: 1px dashed rgba(124,231,253,.1); color: #cfe8f5;
  animation: screenRowIn .45s ease;
}
.screen-device-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-device-row .num { font-family: Consolas, monospace; color: #7ce7fd; }
.screen-device-row .on { color: #2fe39b; }
.screen-device-row .off { color: #8a97a6; }
.screen-device-row .bad { color: #ff6b6b; }
@keyframes screenRowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.screen-map-fallback {
  position: absolute; inset: 0; z-index: 900; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  color: #47708a; font-size: 13px; letter-spacing: 2px;
}
.leaflet-container { background: #06131f; font-family: inherit; }
.leaflet-control-attribution { display: none; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: #0b2438; color: #d8f1ff; border: 1px solid rgba(124,231,253,.4);
  box-shadow: 0 0 16px rgba(124,231,253,.25);
}
.leaflet-popup-content { margin: 10px 12px; font-size: 12px; line-height: 1.8; }
.leaflet-popup-content b { color: #7ce7fd; }
.screen-empty { display: flex; align-items: center; justify-content: center; color: #47708a; font-size: 13px; flex: 1; }

.dev-locked { padding: 70px 20px; text-align: center; color: #8a97a6; }
.dev-locked .el-icon { color: #b3c2cf; margin-bottom: 12px; }
.dev-locked-title { font-size: 16px; font-weight: 600; color: #40566b; margin-bottom: 8px; }
.dev-locked-sub { font-size: 13px; color: #8a97a6; margin-bottom: 20px; }

@media (max-width: 1500px) {
  .screen-body { grid-template-columns: 280px 1fr 320px; }
  .screen-title { font-size: 22px; letter-spacing: 3px; }
}
@media (max-width: 1100px) {
  .screen-body { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); overflow: auto; }
  .sp-project { grid-column: 1; grid-row: 1; }
  .sp-flow { grid-column: 1; grid-row: 2; }
  .sp-china { grid-column: 2; grid-row: 1; }
  .sp-map { grid-column: 2; grid-row: 2; }
  .sp-weather { grid-column: 1; grid-row: 3; }
  .sp-devices { grid-column: 2; grid-row: 3; }
  .screen-title { position: static; transform: none; font-size: 18px; }
}
