* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2a3544;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --green: #22c55e;
  --red: #ef4444;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.login-box h1 {
  font-size: 1.4rem;
  margin-bottom: 24px;
  text-align: center;
}

.login-box label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.login-box input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.login-box button {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.login-box button:hover { opacity: 0.9; }

.error {
  background: rgba(239,68,68,0.15);
  color: var(--red);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  text-align: center;
}

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header h1 { font-size: 1.2rem; }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

#refresh-hint { color: var(--muted); font-size: 0.85rem; }

.btn-sm {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.btn-sm:hover { color: var(--text); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.alert {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--red);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge.online {
  background: rgba(34,197,94,0.15);
  color: var(--green);
}

.badge.offline {
  background: rgba(139,156,179,0.15);
  color: var(--muted);
}

@media (max-width: 600px) {
  .summary { grid-template-columns: 1fr 1fr; }
  th, td { padding: 10px 12px; }
}

.form-card {
  max-width: 420px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
}

.form-card label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
  margin-top: 16px;
}

.form-card label:first-of-type { margin-top: 0; }

.form-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.btn-primary {
  width: 100%;
  margin-top: 24px;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover { opacity: 0.9; }

.success {
  background: rgba(34,197,94,0.15);
  color: var(--green);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  text-align: center;
}

.notice {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  color: var(--muted);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.notice strong { color: var(--text); }

.ip-cell {
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 140px;
  word-break: break-all;
}

.btn-copy {
  padding: 4px 10px;
  font-size: 0.78rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-copy:hover { opacity: 0.85; }

.toolbar { margin-bottom: 20px; }

.toolbar .btn-primary {
  width: auto;
  margin-top: 0;
  padding: 10px 20px;
}

.btn-danger {
  padding: 4px 10px;
  font-size: 0.78rem;
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.4);
  border-radius: 4px;
  cursor: pointer;
}

.btn-danger:hover { background: rgba(239,68,68,0.1); }

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 32px !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 400px;
}

.modal-box h2 {
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.modal-box label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 12px 0 6px;
}

.modal-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

.modal-box .hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 8px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: flex-end;
}

.modal-actions .btn-primary { width: auto; margin-top: 0; }

.modal-box .error {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 12px;
}

.modal-box .error.hidden { display: none; }
