:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --line: #e5e7eb;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 10% 0%, rgba(37, 99, 235, 0.12), transparent 30%), var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
}

a {
  color: var(--blue);
  text-decoration: none;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px 1fr;
}

.sidebar {
  background: #111827;
  color: #d1d5db;
  padding: 24px 18px;
}

.brand {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 28px;
}

.nav a {
  display: block;
  padding: 11px 12px;
  border-radius: 10px;
  color: #d1d5db;
  margin-bottom: 6px;
}

.nav a.active,
.nav a:hover {
  background: rgba(37, 99, 235, 0.18);
  color: #fff;
}

.main {
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.muted {
  color: var(--muted);
}

.flash {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.flash.ok {
  background: #dcfce7;
  color: #166534;
}

.flash.err {
  background: #fee2e2;
  color: #991b1b;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 9px 13px;
  background: #eef2ff;
  color: var(--blue);
  cursor: pointer;
  font-weight: 600;
  line-height: 1.2;
}

.btn:hover {
  background: #dbeafe;
}

.btn.primary {
  background: var(--blue);
  color: #fff;
}

.btn.primary:hover {
  background: var(--blue-2);
}

.btn.danger {
  background: #fee2e2;
  color: var(--red);
}

.btn.warn {
  background: #fef3c7;
  color: var(--amber);
}

.btn.green {
  background: #dcfce7;
  color: var(--green);
}

.btn.small {
  padding: 7px 9px;
  font-size: 12px;
}

.btnrow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
}

th {
  background: #f8fafc;
  color: #374151;
  font-weight: 700;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 700;
  font-size: 12px;
  background: #e5e7eb;
  color: #374151;
}

.badge.running {
  background: #dcfce7;
  color: #166534;
}

.badge.stopped {
  background: #f3f4f6;
  color: #374151;
}

.badge.busy {
  background: #fef3c7;
  color: #92400e;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 7px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 11px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 90px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: 390px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card h1 {
  margin: 0 0 8px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.mono {
  font-family: Consolas, Monaco, monospace;
}

.hint {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  padding: 13px;
  color: #475569;
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .stats,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
