:root {
  --bg: #f3f5f7;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --danger: #dc2626;
  --side: #111827;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.hidden { display: none !important; }
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(800px 400px at 20% 0%, rgba(15,118,110,.18), transparent),
    var(--bg);
}
.login-card {
  width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 16px 40px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.sub, .hint { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
label { font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
  margin-bottom: 8px;
  background: #fafafa;
}
textarea { height: 80px; padding: 10px 12px; resize: vertical; }
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  background: #e5e7eb;
}
.btn.primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.2); }
.btn.sm { padding: 6px 10px; font-size: 13px; }

#appView { display: flex; min-height: 100vh; }
.side {
  width: 220px;
  background: var(--side);
  color: #fff;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.logo { font-weight: 700; padding: 8px 10px 18px; }
.side .nav {
  text-align: left;
  background: transparent;
  color: rgba(255,255,255,.75);
  border: none;
  border-radius: 10px;
  padding: 12px 12px;
  cursor: pointer;
  font: inherit;
}
.side .nav.active, .side .nav:hover { background: rgba(255,255,255,.1); color: #fff; }
.logout { margin-top: auto; }
main { flex: 1; padding: 20px 24px; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.top h2 { margin: 0; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,.04);
}
.card .label { color: var(--muted); font-size: 13px; }
.card .value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.panel {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,.04);
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #ecfdf5;
  color: var(--accent);
}
.tag.off { background: #f3f4f6; color: var(--muted); }
.tag.warn { background: #fff7ed; color: #c2410c; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mask {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal {
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
}
.modal h3 { margin: 0 0 12px; }
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.modal-actions .btn { flex: 1; }
.field { margin-bottom: 8px; }
.field label { display: block; margin-bottom: 4px; }
