:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0d9488;
  --accent-dark: #0f766e;
  --accent-soft: #ccfbf1;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.06);
  --font: "Plus Jakarta Sans", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(13,148,136,.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(15,23,42,.05), transparent);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  background: #0f172a;
  color: #e2e8f0;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 28px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 14px;
}
.brand h1 { margin: 0; font-size: 16px; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.brand p { margin: 2px 0 0; font-size: 11px; color: #94a3b8; }

.nav a {
  display: block; padding: 11px 14px; border-radius: 10px;
  color: #94a3b8; font-size: 14px; font-weight: 500;
  transition: .15s ease;
}
.nav a:hover, .nav a.active {
  background: rgba(13,148,136,.18); color: #5eead4;
}

.main { padding: 28px 32px 48px; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.topbar h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { border: 0; margin: 0; padding: 0 12px 0 0; }
  .stats { grid-template-columns: 1fr 1fr; }
}

.stat {
  background: var(--surface); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.8);
}
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -.03em; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.panel {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid #fff;
  overflow: hidden;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap;
}
.panel-head h3 { margin: 0; font-size: 15px; }

.btn {
  appearance: none; border: 0; cursor: pointer;
  background: var(--accent); color: #fff;
  font-family: inherit; font-weight: 600; font-size: 13px;
  padding: 10px 16px; border-radius: 10px;
  transition: .15s ease;
}
.btn:hover { background: var(--accent-dark); }
.btn.ghost {
  background: #f1f5f9; color: var(--ink);
}
.btn.ghost:hover { background: #e2e8f0; }
.btn.danger { background: #fee2e2; color: var(--danger); }
.btn.danger:hover { background: #fecaca; }
.btn.sm { padding: 6px 10px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #f8fafc; }
tr:hover td { background: #f8fafc; }
code {
  font-family: "JetBrains Mono", "Consolas", monospace;
  background: var(--accent-soft); color: var(--accent-dark);
  padding: 2px 7px; border-radius: 6px; font-size: 12px;
}

.badge {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
}
.badge.ok { background: #d1fae5; color: var(--ok); }
.badge.off { background: #fee2e2; color: var(--danger); }
.badge.warn { background: #ffedd5; color: var(--warn); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: none; align-items: center; justify-content: center; z-index: 50;
  padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; width: min(480px, 100%);
  border-radius: 18px; padding: 24px; box-shadow: 0 24px 80px rgba(15,23,42,.25);
}
.modal h3 { margin: 0 0 16px; font-size: 18px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-family: inherit; font-size: 14px; background: #fff;
}
.form-row input:focus, .form-row select:focus {
  outline: 2px solid rgba(13,148,136,.35); border-color: var(--accent);
}
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* Login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: min(400px, 100%); background: var(--surface);
  border-radius: 20px; padding: 36px 32px; box-shadow: var(--shadow);
  border: 1px solid #fff;
}
.login-card .mark {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  display: grid; place-items: center; color: #fff; font-weight: 800; margin-bottom: 18px;
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.03em; }
.login-card .lead { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.err {
  background: #fef2f2; color: var(--danger); padding: 10px 12px;
  border-radius: 10px; font-size: 13px; margin-bottom: 14px;
}
.full { width: 100%; }
