: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; }
.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%; }
}
