:root {
  --side: #1b2838;
  --side-2: #15202c;
  --blue: #2f7bff;
  --page: #eef2f6;
  --card: #ffffff;
  --text: #1f2a37;
  --muted: #8a96a3;
  --line: #eef1f5;
  --shadow: 0 8px 24px rgba(31, 42, 55, 0.06);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--page); color: var(--text); overflow: hidden; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button {
  background: var(--blue); color: #fff; border: 0; border-radius: 8px;
  padding: 8px 16px; cursor: pointer; font-weight: 600;
}
button.ghost {
  background: #fff; color: #4b5563; border: 1px solid #dbe3ec;
}
input, select {
  width: 100%; background: #fff; border: 1px solid #dbe3ec;
  border-radius: 8px; padding: 8px 10px; color: var(--text);
}
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
label > * { margin-top: 6px; }
.muted { color: var(--muted); }
.error { color: #e15b64; font-size: 13px; }
.ok { color: #2f9e6b; }

.login-wrap {
  min-height: 100vh; height: 100%; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(160deg, #1b2838, #2f7bff 160%);
}
.login-card {
  width: min(400px, 92vw); background: #fff; padding: 36px 32px;
  border-radius: 16px; box-shadow: var(--shadow);
}
.login-logo {
  width: 44px; height: 44px; border-radius: 12px; background: #1b2838; color: #fff;
  display: grid; place-items: center; font-weight: 700; margin-bottom: 12px;
}
.login-card h1 { margin: 0 0 6px; font-size: 24px; }
.login-card button { width: 100%; }
.hint { font-size: 12px; color: var(--muted); }
.hint a { color: var(--blue); text-decoration: none; }

#app-view { display: flex; min-height: 100%; height: 100%; overflow: hidden; }
aside {
  width: 220px; background: var(--side); color: #c5d0dc;
  display: flex; flex-direction: column; padding: 18px 12px 12px;
  flex-shrink: 0; position: relative;
}
aside.collapsed { width: 72px; }
aside.collapsed .brand-text, aside.collapsed .aside-co, aside.collapsed nav a span { display: none; }
aside.collapsed nav a { justify-content: center; padding: 10px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; color: #fff; }
.brand-ico {
  width: 36px; height: 36px; border-radius: 10px; background: #243447;
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.brand-text strong { display: block; font-size: 16px; }
.brand-text span { font-size: 11px; color: #8a9aab; }
nav { display: grid; gap: 4px; flex: 1; align-content: start; }
nav a {
  display: flex; align-items: center; gap: 10px;
  color: #b7c3d0; text-decoration: none; padding: 10px 12px; border-radius: 10px;
  font-size: 14px;
}
nav a .ico { width: 18px; text-align: center; opacity: 0.9; }
nav a.active { background: var(--blue); color: #fff; }
nav a:hover:not(.active) { background: #243447; color: #fff; }
.collapse-btn {
  width: 28px; height: 28px; border-radius: 50%; background: #2c3b4d; color: #fff;
  position: absolute; right: -14px; top: 46%; padding: 0; font-size: 16px; z-index: 2;
}
.aside-tools { display: flex; gap: 8px; padding: 12px 4px 8px; }
.tool-btn {
  flex: 1; background: #fff; color: #1b2838; border-radius: 8px; padding: 8px 0;
}
.aside-co { font-size: 11px; color: #7d8b99; text-align: center; margin: 4px 0 6px; }

.workspace { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.topbar {
  background: #fff; display: flex; justify-content: space-between; align-items: center;
  padding: 16px 28px; border-bottom: 1px solid #eef1f5;
}
.topbar h2 { margin: 0; font-size: 20px; font-weight: 700; }
.clock { color: var(--muted); font-size: 13px; display: flex; gap: 14px; }
#content { padding: 22px 28px 40px; flex: 1; overflow: auto; }
.foot {
  text-align: center; color: var(--muted); font-size: 12px; padding: 12px;
}

.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px;
}
.stat {
  background: var(--card); border-radius: 14px; padding: 14px 12px 12px;
  box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center;
}
.stat-ico {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 18px;
}
.stat strong { display: block; font-size: 22px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); }
.c0 { background: #eaf2ff; } .c1 { background: #e7f8ee; } .c2 { background: #efe8ff; }
.c3 { background: #fff3e4; } .c4 { background: #fff0e8; } .c5 { background: #ffe8ea; }
.c6 { background: #fff6e0; } .c7 { background: #eaf4ff; }

.panel {
  margin-top: 16px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-h {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; font-weight: 600;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; background: #f7f9fb; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
}
.badge.on { background: #e7f3ff; color: #2f7bff; }
.badge.ok { background: #e7f8ee; color: #2f9e6b; }
.badge.warn { background: #fff3e4; color: #d9892b; }
.badge.off { background: #eef1f5; color: #8a96a3; }
.form-grid, .card {
  background: var(--card); border-radius: 14px; padding: 16px 16px 4px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar > * { min-width: 150px; flex: 1; }
.flash { margin: 0 0 12px; }
.empty { color: var(--muted); padding: 20px 16px; }

.avatar {
  position: fixed; right: 18px; bottom: 22px; width: 44px; height: 44px;
  border-radius: 50%; background: #c9a27a; color: #fff; display: grid; place-items: center;
  font-weight: 700; box-shadow: var(--shadow); border: 3px solid #fff; cursor: default;
}

@media (max-width: 860px) {
  #app-view { flex-direction: column; }
  aside { width: 100% !important; }
  .collapse-btn { display: none; }
}
